R Under development (unstable) (2024-06-20 r86796 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > if(MuMIn:::.parallelPkgCheck(quiet = TRUE)) { + clusterType <- if(length(find.package("snow", quiet = TRUE))) "SOCK" else "PSOCK" + clust <- try(makeCluster(getOption("cl.cores", 2), type = clusterType)) + if(inherits(clust, "cluster")) { + + library(MuMIn) + library(nlme) + + data(Orthodont, package = "nlme") + #Orthodont <- Orthodont[sample.int(nrow(Orthodont), size = 64, + #replace = TRUE), ] + Orthodont$rand1 <- runif(nrow(Orthodont)) + Orthodont$rand2 <- runif(nrow(Orthodont)) + clusterExport(clust, "Orthodont") + clusterCall(clust, "library", "nlme", character.only = TRUE) + + # fm2 <- lmer(log(distance) ~ rand*Sex*age + (1|Subject) + (1|Sex), + # data = Orthodont, REML=FALSE) + fm2 <- lme(log(distance) ~ rand1*Sex*age + rand2, ~ 1|Subject / Sex, + data = Orthodont, method = "ML") + print(system.time(pdd1 <- dredge(fm2, cluster = FALSE))) + print(system.time(pddc <- dredge(fm2, cluster = clust))) + print(system.time(dd1 <- dredge(fm2))) + + print(pddc) + print(pdd1) + print(dd1) + + #print(all.equal(pddc, dd1)) + ma1 <- model.avg(pdd1, beta = "none") + ma0 <- model.avg(pddc) + + if(!isTRUE(test <- all.equal(ma1$avg.model, ma0$avg.model))) { + print(test) + warning("'ma1' and 'ma0' are not equal") + } + if(!isTRUE(test <- all.equal(ma1$summary, ma0$summary))) { + print(test) + warning("'ma1' and 'ma0' are not equal") + } + + if(!(identical(c(pddc), c(pdd1)) && identical(c(pdd1), c(dd1)))) { + warning("results of 'dredge' and 'pdredge' are not equal") + print(all.equal(c(pddc), c(pdd1))) + print(all.equal(c(pdd1), c(dd1))) + } + + stopCluster(clust) + + # suppressPackageStartupMessages(library(spdep)) + # suppressMessages(example(NY_data, echo = FALSE)) + # esar1f <- spautolm(Z ~ PEXPOSURE * PCTAGE65P + PCTOWNHOME, + # data=nydata, listw=listw_NY, family="SAR", method="full", verbose=FALSE) + # clusterCall(clust, "library", "spdep", character.only = TRUE) + # clusterExport(clust, "listw_NY", "nydata") + # options(warn=1) + + # varying <- list(family = list("CAR", "SAR"), method=list("Matrix_J", "full")) + + # dd <- dredge(esar1f, m.lim=c(0, 1), fixed=~PEXPOSURE, varying = varying, trace=FALSE) + + } else # if(inherits(clust, "try-error")) + message("Could not set up the cluster") + + } Fixed term is "(Intercept)" user system elapsed 1.05 0.05 1.09 Fixed term is "(Intercept)" user system elapsed 0.04 0.00 1.43 Fixed term is "(Intercept)" user system elapsed 0.86 0.05 0.91 Global model call: lme.formula(fixed = log(distance) ~ rand1 * Sex * age + rand2, data = Orthodont, random = ~1 | Subject/Sex, method = "ML") --- Model selection table (Int) Sex age rn1 rn2 Sex:age Sex:rn1 age:rn1 Sex:age:rn1 df 87 3.007 + 0.01958 -0.26280 + 0.02241 9 95 3.024 + 0.01939 -0.26830 -0.029620 + 0.02288 10 71 3.060 + 0.01473 -0.29020 0.02509 8 79 3.075 + 0.01492 -0.29420 -0.032980 0.02539 9 19 2.862 + 0.03170 + 7 119 3.012 + 0.01942 -0.26860 + + 0.02248 10 111 3.085 + 0.01502 -0.31140 -0.035510 + 0.02530 10 27 2.875 + 0.03176 -0.027290 + 8 103 3.067 + 0.01480 -0.30330 + 0.02500 9 127 3.034 + 0.01907 -0.27980 -0.031260 + + 0.02304 11 23 2.878 + 0.03123 -0.01893 + 8 3 2.910 + 0.02740 6 11 2.922 + 0.02774 -0.031250 7 31 2.891 + 0.03128 -0.01934 -0.027680 + 9 247 3.036 + 0.01725 -0.31430 + + 0.02664 + 11 255 3.061 + 0.01667 -0.33040 -0.031870 + + 0.02764 + 12 7 2.924 + 0.02690 -0.01690 7 55 2.881 + 0.03114 -0.02267 + + 9 15 2.937 + 0.02722 -0.01748 -0.031680 8 63 2.899 + 0.03109 -0.02736 -0.029020 + + 10 78 3.036 0.01479 -0.29620 -0.034140 0.02590 8 70 3.021 0.01457 -0.29260 0.02565 7 39 2.932 + 0.02693 -0.03183 + 8 47 2.948 + 0.02729 -0.03646 -0.034310 + 9 2 2.870 0.02740 5 10 2.883 0.02776 -0.032720 6 6 2.881 0.02703 -0.01266 6 14 2.895 0.02736 -0.01344 -0.033090 7 5 3.256 + -0.08312 6 37 3.263 + -0.09555 + 7 13 3.262 + -0.08360 -0.011300 7 45 3.271 + -0.09769 -0.013320 + 8 1 3.211 + 5 9 3.215 + -0.007432 6 4 3.211 -0.07550 5 12 3.219 -0.07616 -0.013910 6 0 3.172 4 8 3.177 -0.010120 5 logLik AICc delta weight 87 131.028 -242.2 0.00 0.161 95 131.997 -241.7 0.49 0.125 71 129.457 -241.5 0.76 0.110 79 130.629 -241.4 0.80 0.108 19 127.865 -240.6 1.61 0.072 119 131.060 -239.9 2.37 0.049 111 131.052 -239.8 2.38 0.049 27 128.633 -239.8 2.41 0.048 103 129.707 -239.6 2.64 0.043 127 132.113 -239.5 2.74 0.041 23 128.232 -239.0 3.21 0.032 3 125.738 -238.6 3.58 0.027 11 126.706 -238.3 3.93 0.023 31 129.024 -238.2 4.01 0.022 247 131.229 -237.7 4.51 0.017 255 132.324 -237.4 4.86 0.014 7 126.017 -236.9 5.31 0.011 55 128.249 -236.7 5.56 0.010 15 127.012 -236.6 5.65 0.010 63 129.098 -235.9 6.29 0.007 78 126.509 -235.6 6.66 0.006 70 125.266 -235.4 6.81 0.005 39 126.276 -235.1 7.12 0.005 47 127.432 -235.0 7.19 0.004 2 121.539 -232.5 9.73 0.001 10 122.587 -232.3 9.88 0.001 6 121.694 -230.6 11.66 0.000 14 122.767 -230.4 11.81 0.000 5 93.073 -173.3 68.91 0.000 37 93.160 -171.2 71.02 0.000 13 93.132 -171.1 71.08 0.000 45 93.241 -169.0 73.19 0.000 1 89.806 -169.0 73.20 0.000 9 89.830 -166.8 75.39 0.000 4 88.245 -165.9 76.32 0.000 12 88.331 -163.8 78.39 0.000 0 85.606 -162.8 79.40 0.000 8 85.650 -160.7 81.51 0.000 Models ranked by AICc(x) Random terms (all models): 1 | Subject, 1 | Sex %in% Subject Global model call: lme.formula(fixed = log(distance) ~ rand1 * Sex * age + rand2, data = Orthodont, random = ~1 | Subject/Sex, method = "ML") --- Model selection table (Int) Sex age rn1 rn2 Sex:age Sex:rn1 age:rn1 Sex:age:rn1 df 88 3.007 + 0.01958 -0.26280 + 0.02241 9 96 3.024 + 0.01939 -0.26830 -0.029620 + 0.02288 10 72 3.060 + 0.01473 -0.29020 0.02509 8 80 3.075 + 0.01492 -0.29420 -0.032980 0.02539 9 20 2.862 + 0.03170 + 7 120 3.012 + 0.01942 -0.26860 + + 0.02248 10 112 3.085 + 0.01502 -0.31140 -0.035510 + 0.02530 10 28 2.875 + 0.03176 -0.027290 + 8 104 3.067 + 0.01480 -0.30330 + 0.02500 9 128 3.034 + 0.01907 -0.27980 -0.031260 + + 0.02304 11 24 2.878 + 0.03123 -0.01893 + 8 4 2.910 + 0.02740 6 12 2.922 + 0.02774 -0.031250 7 32 2.891 + 0.03128 -0.01934 -0.027680 + 9 248 3.036 + 0.01725 -0.31430 + + 0.02664 + 11 256 3.061 + 0.01667 -0.33040 -0.031870 + + 0.02764 + 12 8 2.924 + 0.02690 -0.01690 7 56 2.881 + 0.03114 -0.02267 + + 9 16 2.937 + 0.02722 -0.01748 -0.031680 8 64 2.899 + 0.03109 -0.02736 -0.029020 + + 10 79 3.036 0.01479 -0.29620 -0.034140 0.02590 8 71 3.021 0.01457 -0.29260 0.02565 7 40 2.932 + 0.02693 -0.03183 + 8 48 2.948 + 0.02729 -0.03646 -0.034310 + 9 3 2.870 0.02740 5 11 2.883 0.02776 -0.032720 6 7 2.881 0.02703 -0.01266 6 15 2.895 0.02736 -0.01344 -0.033090 7 6 3.256 + -0.08312 6 38 3.263 + -0.09555 + 7 14 3.262 + -0.08360 -0.011300 7 46 3.271 + -0.09769 -0.013320 + 8 2 3.211 + 5 10 3.215 + -0.007432 6 5 3.211 -0.07550 5 13 3.219 -0.07616 -0.013910 6 1 3.172 4 9 3.177 -0.010120 5 logLik AICc delta weight 88 131.028 -242.2 0.00 0.161 96 131.997 -241.7 0.49 0.125 72 129.457 -241.5 0.76 0.110 80 130.629 -241.4 0.80 0.108 20 127.865 -240.6 1.61 0.072 120 131.060 -239.9 2.37 0.049 112 131.052 -239.8 2.38 0.049 28 128.633 -239.8 2.41 0.048 104 129.707 -239.6 2.64 0.043 128 132.113 -239.5 2.74 0.041 24 128.232 -239.0 3.21 0.032 4 125.738 -238.6 3.58 0.027 12 126.706 -238.3 3.93 0.023 32 129.024 -238.2 4.01 0.022 248 131.229 -237.7 4.51 0.017 256 132.324 -237.4 4.86 0.014 8 126.017 -236.9 5.31 0.011 56 128.249 -236.7 5.56 0.010 16 127.012 -236.6 5.65 0.010 64 129.098 -235.9 6.29 0.007 79 126.509 -235.6 6.66 0.006 71 125.266 -235.4 6.81 0.005 40 126.276 -235.1 7.12 0.005 48 127.432 -235.0 7.19 0.004 3 121.539 -232.5 9.73 0.001 11 122.587 -232.3 9.88 0.001 7 121.694 -230.6 11.66 0.000 15 122.767 -230.4 11.81 0.000 6 93.073 -173.3 68.91 0.000 38 93.160 -171.2 71.02 0.000 14 93.132 -171.1 71.08 0.000 46 93.241 -169.0 73.19 0.000 2 89.806 -169.0 73.20 0.000 10 89.830 -166.8 75.39 0.000 5 88.245 -165.9 76.32 0.000 13 88.331 -163.8 78.39 0.000 1 85.606 -162.8 79.40 0.000 9 85.650 -160.7 81.51 0.000 Models ranked by AICc(x) Random terms (all models): 1 | Subject, 1 | Sex %in% Subject Global model call: lme.formula(fixed = log(distance) ~ rand1 * Sex * age + rand2, data = Orthodont, random = ~1 | Subject/Sex, method = "ML") --- Model selection table (Int) Sex age rn1 rn2 Sex:age Sex:rn1 age:rn1 Sex:age:rn1 df 88 3.007 + 0.01958 -0.26280 + 0.02241 9 96 3.024 + 0.01939 -0.26830 -0.029620 + 0.02288 10 72 3.060 + 0.01473 -0.29020 0.02509 8 80 3.075 + 0.01492 -0.29420 -0.032980 0.02539 9 20 2.862 + 0.03170 + 7 120 3.012 + 0.01942 -0.26860 + + 0.02248 10 112 3.085 + 0.01502 -0.31140 -0.035510 + 0.02530 10 28 2.875 + 0.03176 -0.027290 + 8 104 3.067 + 0.01480 -0.30330 + 0.02500 9 128 3.034 + 0.01907 -0.27980 -0.031260 + + 0.02304 11 24 2.878 + 0.03123 -0.01893 + 8 4 2.910 + 0.02740 6 12 2.922 + 0.02774 -0.031250 7 32 2.891 + 0.03128 -0.01934 -0.027680 + 9 248 3.036 + 0.01725 -0.31430 + + 0.02664 + 11 256 3.061 + 0.01667 -0.33040 -0.031870 + + 0.02764 + 12 8 2.924 + 0.02690 -0.01690 7 56 2.881 + 0.03114 -0.02267 + + 9 16 2.937 + 0.02722 -0.01748 -0.031680 8 64 2.899 + 0.03109 -0.02736 -0.029020 + + 10 79 3.036 0.01479 -0.29620 -0.034140 0.02590 8 71 3.021 0.01457 -0.29260 0.02565 7 40 2.932 + 0.02693 -0.03183 + 8 48 2.948 + 0.02729 -0.03646 -0.034310 + 9 3 2.870 0.02740 5 11 2.883 0.02776 -0.032720 6 7 2.881 0.02703 -0.01266 6 15 2.895 0.02736 -0.01344 -0.033090 7 6 3.256 + -0.08312 6 38 3.263 + -0.09555 + 7 14 3.262 + -0.08360 -0.011300 7 46 3.271 + -0.09769 -0.013320 + 8 2 3.211 + 5 10 3.215 + -0.007432 6 5 3.211 -0.07550 5 13 3.219 -0.07616 -0.013910 6 1 3.172 4 9 3.177 -0.010120 5 logLik AICc delta weight 88 131.028 -242.2 0.00 0.161 96 131.997 -241.7 0.49 0.125 72 129.457 -241.5 0.76 0.110 80 130.629 -241.4 0.80 0.108 20 127.865 -240.6 1.61 0.072 120 131.060 -239.9 2.37 0.049 112 131.052 -239.8 2.38 0.049 28 128.633 -239.8 2.41 0.048 104 129.707 -239.6 2.64 0.043 128 132.113 -239.5 2.74 0.041 24 128.232 -239.0 3.21 0.032 4 125.738 -238.6 3.58 0.027 12 126.706 -238.3 3.93 0.023 32 129.024 -238.2 4.01 0.022 248 131.229 -237.7 4.51 0.017 256 132.324 -237.4 4.86 0.014 8 126.017 -236.9 5.31 0.011 56 128.249 -236.7 5.56 0.010 16 127.012 -236.6 5.65 0.010 64 129.098 -235.9 6.29 0.007 79 126.509 -235.6 6.66 0.006 71 125.266 -235.4 6.81 0.005 40 126.276 -235.1 7.12 0.005 48 127.432 -235.0 7.19 0.004 3 121.539 -232.5 9.73 0.001 11 122.587 -232.3 9.88 0.001 7 121.694 -230.6 11.66 0.000 15 122.767 -230.4 11.81 0.000 6 93.073 -173.3 68.91 0.000 38 93.160 -171.2 71.02 0.000 14 93.132 -171.1 71.08 0.000 46 93.241 -169.0 73.19 0.000 2 89.806 -169.0 73.20 0.000 10 89.830 -166.8 75.39 0.000 5 88.245 -165.9 76.32 0.000 13 88.331 -163.8 78.39 0.000 1 85.606 -162.8 79.40 0.000 9 85.650 -160.7 81.51 0.000 Models ranked by AICc(x) Random terms (all models): 1 | Subject, 1 | Sex %in% Subject > > #system.time(pdredge(fm2, cluster = clust)) > #system.time(pdredge(fm2, cluster = F)) > #system.time(dredge(fm2)) > > proc.time() user system elapsed 4.20 0.20 6.04