R Under development (unstable) (2026-03-25 r89703 ucrt) -- "Unsuffered Consequences" Copyright (C) 2026 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.37 0.06 1.43 Fixed term is "(Intercept)" user system elapsed 0.04 0.00 2.12 Fixed term is "(Intercept)" user system elapsed 1.45 0.08 1.53 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 19 2.862 + 0.03170 + 23 2.874 + 0.03193 -0.028620 + 27 2.856 + 0.03160 0.014910 + 87 2.815 + 0.03734 0.090040 + -0.0107300 3 2.910 + 0.02740 7 2.921 + 0.02782 -0.031680 31 2.868 + 0.03183 -0.027500 0.013190 + 55 2.872 + 0.03189 -0.023050 + + 11 2.903 + 0.02732 0.015680 71 2.876 + 0.03191 0.062680 -0.0085490 95 2.814 + 0.03695 0.083940 0.010070 + -0.0101000 119 2.815 + 0.03720 0.090320 + + -0.0104900 39 2.914 + 0.02796 -0.020520 + 15 2.915 + 0.02774 -0.030510 0.013730 63 2.867 + 0.03180 -0.023070 0.012560 + + 247 2.867 + 0.03238 -0.012500 + + -0.0009757 + 103 2.874 + 0.03172 0.064900 + -0.0078930 79 2.875 + 0.03151 0.056010 0.011330 -0.0078570 47 2.909 + 0.02787 -0.020550 0.012320 + 127 2.814 + 0.03685 0.084300 0.009818 + + -0.0099380 255 2.865 + 0.03207 -0.017730 0.009479 + + -0.0004940 + 2 2.870 0.02740 111 2.872 + 0.03137 0.058660 0.010280 + -0.0073190 6 2.879 0.02776 -0.027040 10 2.864 0.02733 0.014530 70 2.836 0.03168 0.063660 -0.0082080 14 2.873 0.02768 -0.025940 0.012880 78 2.835 0.03131 0.057410 0.010570 -0.0075600 1 3.211 + 9 3.200 + 0.023710 5 3.215 + -0.007902 13 3.203 + -0.006083 0.023330 37 3.213 + -0.004312 + 0 3.172 45 3.202 + -0.004641 0.023110 + 8 3.161 0.021130 4 3.170 0.003393 12 3.159 0.005086 0.021460 df logLik AICc delta weight 19 7 127.865 -240.6 0.00 0.214 23 8 128.590 -239.7 0.88 0.138 27 8 128.123 -238.8 1.82 0.086 87 9 129.268 -238.7 1.91 0.082 3 6 125.738 -238.6 1.97 0.080 7 7 126.590 -238.1 2.55 0.060 31 9 128.793 -237.7 2.86 0.051 55 9 128.649 -237.5 3.15 0.044 11 7 126.009 -236.9 3.71 0.033 71 8 127.004 -236.6 4.06 0.028 95 10 129.385 -236.5 4.11 0.027 119 10 129.283 -236.3 4.31 0.025 39 8 126.816 -236.2 4.43 0.023 15 8 126.800 -236.1 4.47 0.023 63 10 128.831 -235.4 5.22 0.016 247 11 130.021 -235.3 5.32 0.015 103 9 127.164 -234.5 6.12 0.010 79 9 127.144 -234.5 6.16 0.010 47 9 126.983 -234.1 6.48 0.008 127 11 129.394 -234.0 6.57 0.008 255 12 130.125 -233.0 7.64 0.005 2 5 121.539 -232.5 8.12 0.004 111 10 127.279 -232.3 8.32 0.003 6 6 122.145 -231.5 9.15 0.002 10 6 121.770 -230.7 9.90 0.002 70 7 122.523 -229.9 10.68 0.001 14 7 122.328 -229.5 11.07 0.001 78 8 122.645 -227.8 12.78 0.000 1 5 89.806 -169.0 71.59 0.000 9 6 90.071 -167.3 73.30 0.000 5 6 89.830 -166.8 73.78 0.000 13 7 90.086 -165.1 75.56 0.000 37 7 89.840 -164.6 76.05 0.000 0 4 85.606 -162.8 77.79 0.000 45 8 90.087 -162.7 77.89 0.000 8 5 85.813 -161.0 79.57 0.000 4 5 85.611 -160.6 79.98 0.000 12 6 85.823 -158.8 81.80 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 20 2.862 + 0.03170 + 24 2.874 + 0.03193 -0.028620 + 28 2.856 + 0.03160 0.014910 + 88 2.815 + 0.03734 0.090040 + -0.0107300 4 2.910 + 0.02740 8 2.921 + 0.02782 -0.031680 32 2.868 + 0.03183 -0.027500 0.013190 + 56 2.872 + 0.03189 -0.023050 + + 12 2.903 + 0.02732 0.015680 72 2.876 + 0.03191 0.062680 -0.0085490 96 2.814 + 0.03695 0.083940 0.010070 + -0.0101000 120 2.815 + 0.03720 0.090320 + + -0.0104900 40 2.914 + 0.02796 -0.020520 + 16 2.915 + 0.02774 -0.030510 0.013730 64 2.867 + 0.03180 -0.023070 0.012560 + + 248 2.867 + 0.03238 -0.012500 + + -0.0009757 + 104 2.874 + 0.03172 0.064900 + -0.0078930 80 2.875 + 0.03151 0.056010 0.011330 -0.0078570 48 2.909 + 0.02787 -0.020550 0.012320 + 128 2.814 + 0.03685 0.084300 0.009818 + + -0.0099380 256 2.865 + 0.03207 -0.017730 0.009479 + + -0.0004940 + 3 2.870 0.02740 112 2.872 + 0.03137 0.058660 0.010280 + -0.0073190 7 2.879 0.02776 -0.027040 11 2.864 0.02733 0.014530 71 2.836 0.03168 0.063660 -0.0082080 15 2.873 0.02768 -0.025940 0.012880 79 2.835 0.03131 0.057410 0.010570 -0.0075600 2 3.211 + 10 3.200 + 0.023710 6 3.215 + -0.007902 14 3.203 + -0.006083 0.023330 38 3.213 + -0.004312 + 1 3.172 46 3.202 + -0.004641 0.023110 + 9 3.161 0.021130 5 3.170 0.003393 13 3.159 0.005086 0.021460 df logLik AICc delta weight 20 7 127.865 -240.6 0.00 0.214 24 8 128.590 -239.7 0.88 0.138 28 8 128.123 -238.8 1.82 0.086 88 9 129.268 -238.7 1.91 0.082 4 6 125.738 -238.6 1.97 0.080 8 7 126.590 -238.1 2.55 0.060 32 9 128.793 -237.7 2.86 0.051 56 9 128.649 -237.5 3.15 0.044 12 7 126.009 -236.9 3.71 0.033 72 8 127.004 -236.6 4.06 0.028 96 10 129.385 -236.5 4.11 0.027 120 10 129.283 -236.3 4.31 0.025 40 8 126.816 -236.2 4.43 0.023 16 8 126.800 -236.1 4.47 0.023 64 10 128.831 -235.4 5.22 0.016 248 11 130.021 -235.3 5.32 0.015 104 9 127.164 -234.5 6.12 0.010 80 9 127.144 -234.5 6.16 0.010 48 9 126.983 -234.1 6.48 0.008 128 11 129.394 -234.0 6.57 0.008 256 12 130.125 -233.0 7.64 0.005 3 5 121.539 -232.5 8.12 0.004 112 10 127.279 -232.3 8.32 0.003 7 6 122.145 -231.5 9.15 0.002 11 6 121.770 -230.7 9.90 0.002 71 7 122.523 -229.9 10.68 0.001 15 7 122.328 -229.5 11.07 0.001 79 8 122.645 -227.8 12.78 0.000 2 5 89.806 -169.0 71.59 0.000 10 6 90.071 -167.3 73.30 0.000 6 6 89.830 -166.8 73.78 0.000 14 7 90.086 -165.1 75.56 0.000 38 7 89.840 -164.6 76.05 0.000 1 4 85.606 -162.8 77.79 0.000 46 8 90.087 -162.7 77.89 0.000 9 5 85.813 -161.0 79.57 0.000 5 5 85.611 -160.6 79.98 0.000 13 6 85.823 -158.8 81.80 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 20 2.862 + 0.03170 + 24 2.874 + 0.03193 -0.028620 + 28 2.856 + 0.03160 0.014910 + 88 2.815 + 0.03734 0.090040 + -0.0107300 4 2.910 + 0.02740 8 2.921 + 0.02782 -0.031680 32 2.868 + 0.03183 -0.027500 0.013190 + 56 2.872 + 0.03189 -0.023050 + + 12 2.903 + 0.02732 0.015680 72 2.876 + 0.03191 0.062680 -0.0085490 96 2.814 + 0.03695 0.083940 0.010070 + -0.0101000 120 2.815 + 0.03720 0.090320 + + -0.0104900 40 2.914 + 0.02796 -0.020520 + 16 2.915 + 0.02774 -0.030510 0.013730 64 2.867 + 0.03180 -0.023070 0.012560 + + 248 2.867 + 0.03238 -0.012500 + + -0.0009757 + 104 2.874 + 0.03172 0.064900 + -0.0078930 80 2.875 + 0.03151 0.056010 0.011330 -0.0078570 48 2.909 + 0.02787 -0.020550 0.012320 + 128 2.814 + 0.03685 0.084300 0.009818 + + -0.0099380 256 2.865 + 0.03207 -0.017730 0.009479 + + -0.0004940 + 3 2.870 0.02740 112 2.872 + 0.03137 0.058660 0.010280 + -0.0073190 7 2.879 0.02776 -0.027040 11 2.864 0.02733 0.014530 71 2.836 0.03168 0.063660 -0.0082080 15 2.873 0.02768 -0.025940 0.012880 79 2.835 0.03131 0.057410 0.010570 -0.0075600 2 3.211 + 10 3.200 + 0.023710 6 3.215 + -0.007902 14 3.203 + -0.006083 0.023330 38 3.213 + -0.004312 + 1 3.172 46 3.202 + -0.004641 0.023110 + 9 3.161 0.021130 5 3.170 0.003393 13 3.159 0.005086 0.021460 df logLik AICc delta weight 20 7 127.865 -240.6 0.00 0.214 24 8 128.590 -239.7 0.88 0.138 28 8 128.123 -238.8 1.82 0.086 88 9 129.268 -238.7 1.91 0.082 4 6 125.738 -238.6 1.97 0.080 8 7 126.590 -238.1 2.55 0.060 32 9 128.793 -237.7 2.86 0.051 56 9 128.649 -237.5 3.15 0.044 12 7 126.009 -236.9 3.71 0.033 72 8 127.004 -236.6 4.06 0.028 96 10 129.385 -236.5 4.11 0.027 120 10 129.283 -236.3 4.31 0.025 40 8 126.816 -236.2 4.43 0.023 16 8 126.800 -236.1 4.47 0.023 64 10 128.831 -235.4 5.22 0.016 248 11 130.021 -235.3 5.32 0.015 104 9 127.164 -234.5 6.12 0.010 80 9 127.144 -234.5 6.16 0.010 48 9 126.983 -234.1 6.48 0.008 128 11 129.394 -234.0 6.57 0.008 256 12 130.125 -233.0 7.64 0.005 3 5 121.539 -232.5 8.12 0.004 112 10 127.279 -232.3 8.32 0.003 7 6 122.145 -231.5 9.15 0.002 11 6 121.770 -230.7 9.90 0.002 71 7 122.523 -229.9 10.68 0.001 15 7 122.328 -229.5 11.07 0.001 79 8 122.645 -227.8 12.78 0.000 2 5 89.806 -169.0 71.59 0.000 10 6 90.071 -167.3 73.30 0.000 6 6 89.830 -166.8 73.78 0.000 14 7 90.086 -165.1 75.56 0.000 38 7 89.840 -164.6 76.05 0.000 1 4 85.606 -162.8 77.79 0.000 46 8 90.087 -162.7 77.89 0.000 9 5 85.813 -161.0 79.57 0.000 5 5 85.611 -160.6 79.98 0.000 13 6 85.823 -158.8 81.80 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 6.26 0.39 9.14