R version 4.5.0 beta (2025-03-31 r88079 ucrt) -- "How About a Twenty-Six" Copyright (C) 2025 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.52 0.03 1.55 Fixed term is "(Intercept)" user system elapsed 0.03 0.00 1.97 Fixed term is "(Intercept)" user system elapsed 1.46 0.04 1.48 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.873 + 0.03199 -0.026380 + 87 2.788 + 0.03982 0.130700 + -0.014300 27 2.850 + 0.03214 0.014750 + 3 2.910 + 0.02740 55 2.865 + 0.03178 -0.007080 + + 119 2.782 + 0.03947 0.146200 + + -0.014030 31 2.862 + 0.03241 -0.026150 0.014300 + 247 2.720 + 0.04516 0.259400 + + -0.024400 + 95 2.782 + 0.03984 0.124600 0.011120 + -0.013730 7 2.921 + 0.02734 -0.019540 63 2.853 + 0.03221 -0.006748 0.014500 + + 11 2.902 + 0.02763 0.010920 127 2.776 + 0.03949 0.140100 0.011390 + + -0.013450 39 2.916 + 0.02701 -0.003048 + 15 2.913 + 0.02756 -0.019250 0.010340 71 2.897 + 0.02946 0.030620 -0.004521 255 2.716 + 0.04508 0.252100 0.010030 + + -0.023720 + 47 2.908 + 0.02723 -0.002736 0.010380 + 103 2.895 + 0.02893 0.041670 + -0.004071 79 2.893 + 0.02941 0.025000 0.009181 -0.003991 2 2.870 0.02740 111 2.890 + 0.02887 0.036020 0.009358 + -0.003531 6 2.877 0.02736 -0.013720 10 2.863 0.02761 0.009897 14 2.870 0.02756 -0.013450 0.009483 70 2.857 0.02920 0.029650 -0.003912 78 2.853 0.02914 0.024300 0.008460 -0.003407 37 3.199 + 0.021720 + 1 3.211 + 5 3.228 + -0.031660 9 3.223 + -0.023750 45 3.211 + 0.020450 -0.023430 + 13 3.241 + -0.032330 -0.024760 0 3.172 8 3.185 -0.026700 4 3.180 -0.018070 12 3.194 -0.019040 -0.027390 df logLik AICc delta weight 19 7 127.865 -240.6 0.00 0.193 23 8 128.625 -239.8 0.81 0.129 87 9 129.612 -239.4 1.22 0.105 27 8 128.100 -238.7 1.86 0.076 3 6 125.738 -238.6 1.97 0.072 55 9 129.207 -238.6 2.03 0.070 119 10 130.161 -238.1 2.56 0.054 31 9 128.849 -237.9 2.75 0.049 247 11 131.012 -237.3 3.34 0.036 95 10 129.749 -237.2 3.38 0.036 7 7 126.141 -237.2 3.45 0.034 63 10 129.438 -236.6 4.00 0.026 11 7 125.861 -236.6 4.01 0.026 127 11 130.306 -235.9 4.75 0.018 39 8 126.533 -235.6 5.00 0.016 15 8 126.252 -235.0 5.56 0.012 71 8 126.247 -235.0 5.57 0.012 255 12 131.128 -235.0 5.64 0.012 47 9 126.645 -233.5 7.16 0.005 103 9 126.619 -233.4 7.21 0.005 79 9 126.333 -232.8 7.78 0.004 2 5 121.539 -232.5 8.12 0.003 111 10 126.709 -231.1 9.46 0.002 6 6 121.737 -230.6 9.97 0.001 10 6 121.639 -230.4 10.16 0.001 14 7 121.830 -228.5 12.07 0.000 70 7 121.816 -228.5 12.10 0.000 78 8 121.888 -226.3 14.29 0.000 37 7 92.074 -169.0 71.58 0.000 1 5 89.806 -169.0 71.59 0.000 5 6 90.259 -167.7 72.92 0.000 9 6 90.064 -167.3 73.31 0.000 45 8 92.333 -167.2 73.40 0.000 13 7 90.541 -166.0 74.65 0.000 0 4 85.606 -162.8 77.79 0.000 8 5 85.927 -161.3 79.34 0.000 4 5 85.754 -160.9 79.69 0.000 12 6 86.093 -159.4 81.26 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.873 + 0.03199 -0.026380 + 88 2.788 + 0.03982 0.130700 + -0.014300 28 2.850 + 0.03214 0.014750 + 4 2.910 + 0.02740 56 2.865 + 0.03178 -0.007080 + + 120 2.782 + 0.03947 0.146200 + + -0.014030 32 2.862 + 0.03241 -0.026150 0.014300 + 248 2.720 + 0.04516 0.259400 + + -0.024400 + 96 2.782 + 0.03984 0.124600 0.011120 + -0.013730 8 2.921 + 0.02734 -0.019540 64 2.853 + 0.03221 -0.006748 0.014500 + + 12 2.902 + 0.02763 0.010920 128 2.776 + 0.03949 0.140100 0.011390 + + -0.013450 40 2.916 + 0.02701 -0.003048 + 16 2.913 + 0.02756 -0.019250 0.010340 72 2.897 + 0.02946 0.030620 -0.004521 256 2.716 + 0.04508 0.252100 0.010030 + + -0.023720 + 48 2.908 + 0.02723 -0.002736 0.010380 + 104 2.895 + 0.02893 0.041670 + -0.004071 80 2.893 + 0.02941 0.025000 0.009181 -0.003991 3 2.870 0.02740 112 2.890 + 0.02887 0.036020 0.009358 + -0.003531 7 2.877 0.02736 -0.013720 11 2.863 0.02761 0.009897 15 2.870 0.02756 -0.013450 0.009483 71 2.857 0.02920 0.029650 -0.003912 79 2.853 0.02914 0.024300 0.008460 -0.003407 38 3.199 + 0.021720 + 2 3.211 + 6 3.228 + -0.031660 10 3.223 + -0.023750 46 3.211 + 0.020450 -0.023430 + 14 3.241 + -0.032330 -0.024760 1 3.172 9 3.185 -0.026700 5 3.180 -0.018070 13 3.194 -0.019040 -0.027390 df logLik AICc delta weight 20 7 127.865 -240.6 0.00 0.193 24 8 128.625 -239.8 0.81 0.129 88 9 129.612 -239.4 1.22 0.105 28 8 128.100 -238.7 1.86 0.076 4 6 125.738 -238.6 1.97 0.072 56 9 129.207 -238.6 2.03 0.070 120 10 130.161 -238.1 2.56 0.054 32 9 128.849 -237.9 2.75 0.049 248 11 131.012 -237.3 3.34 0.036 96 10 129.749 -237.2 3.38 0.036 8 7 126.141 -237.2 3.45 0.034 64 10 129.438 -236.6 4.00 0.026 12 7 125.861 -236.6 4.01 0.026 128 11 130.306 -235.9 4.75 0.018 40 8 126.533 -235.6 5.00 0.016 16 8 126.252 -235.0 5.56 0.012 72 8 126.247 -235.0 5.57 0.012 256 12 131.128 -235.0 5.64 0.012 48 9 126.645 -233.5 7.16 0.005 104 9 126.619 -233.4 7.21 0.005 80 9 126.333 -232.8 7.78 0.004 3 5 121.539 -232.5 8.12 0.003 112 10 126.709 -231.1 9.46 0.002 7 6 121.737 -230.6 9.97 0.001 11 6 121.639 -230.4 10.16 0.001 15 7 121.830 -228.5 12.07 0.000 71 7 121.816 -228.5 12.10 0.000 79 8 121.888 -226.3 14.29 0.000 38 7 92.074 -169.0 71.58 0.000 2 5 89.806 -169.0 71.59 0.000 6 6 90.259 -167.7 72.92 0.000 10 6 90.064 -167.3 73.31 0.000 46 8 92.333 -167.2 73.40 0.000 14 7 90.541 -166.0 74.65 0.000 1 4 85.606 -162.8 77.79 0.000 9 5 85.927 -161.3 79.34 0.000 5 5 85.754 -160.9 79.69 0.000 13 6 86.093 -159.4 81.26 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.873 + 0.03199 -0.026380 + 88 2.788 + 0.03982 0.130700 + -0.014300 28 2.850 + 0.03214 0.014750 + 4 2.910 + 0.02740 56 2.865 + 0.03178 -0.007080 + + 120 2.782 + 0.03947 0.146200 + + -0.014030 32 2.862 + 0.03241 -0.026150 0.014300 + 248 2.720 + 0.04516 0.259400 + + -0.024400 + 96 2.782 + 0.03984 0.124600 0.011120 + -0.013730 8 2.921 + 0.02734 -0.019540 64 2.853 + 0.03221 -0.006748 0.014500 + + 12 2.902 + 0.02763 0.010920 128 2.776 + 0.03949 0.140100 0.011390 + + -0.013450 40 2.916 + 0.02701 -0.003048 + 16 2.913 + 0.02756 -0.019250 0.010340 72 2.897 + 0.02946 0.030620 -0.004521 256 2.716 + 0.04508 0.252100 0.010030 + + -0.023720 + 48 2.908 + 0.02723 -0.002736 0.010380 + 104 2.895 + 0.02893 0.041670 + -0.004071 80 2.893 + 0.02941 0.025000 0.009181 -0.003991 3 2.870 0.02740 112 2.890 + 0.02887 0.036020 0.009358 + -0.003531 7 2.877 0.02736 -0.013720 11 2.863 0.02761 0.009897 15 2.870 0.02756 -0.013450 0.009483 71 2.857 0.02920 0.029650 -0.003912 79 2.853 0.02914 0.024300 0.008460 -0.003407 38 3.199 + 0.021720 + 2 3.211 + 6 3.228 + -0.031660 10 3.223 + -0.023750 46 3.211 + 0.020450 -0.023430 + 14 3.241 + -0.032330 -0.024760 1 3.172 9 3.185 -0.026700 5 3.180 -0.018070 13 3.194 -0.019040 -0.027390 df logLik AICc delta weight 20 7 127.865 -240.6 0.00 0.193 24 8 128.625 -239.8 0.81 0.129 88 9 129.612 -239.4 1.22 0.105 28 8 128.100 -238.7 1.86 0.076 4 6 125.738 -238.6 1.97 0.072 56 9 129.207 -238.6 2.03 0.070 120 10 130.161 -238.1 2.56 0.054 32 9 128.849 -237.9 2.75 0.049 248 11 131.012 -237.3 3.34 0.036 96 10 129.749 -237.2 3.38 0.036 8 7 126.141 -237.2 3.45 0.034 64 10 129.438 -236.6 4.00 0.026 12 7 125.861 -236.6 4.01 0.026 128 11 130.306 -235.9 4.75 0.018 40 8 126.533 -235.6 5.00 0.016 16 8 126.252 -235.0 5.56 0.012 72 8 126.247 -235.0 5.57 0.012 256 12 131.128 -235.0 5.64 0.012 48 9 126.645 -233.5 7.16 0.005 104 9 126.619 -233.4 7.21 0.005 80 9 126.333 -232.8 7.78 0.004 3 5 121.539 -232.5 8.12 0.003 112 10 126.709 -231.1 9.46 0.002 7 6 121.737 -230.6 9.97 0.001 11 6 121.639 -230.4 10.16 0.001 15 7 121.830 -228.5 12.07 0.000 71 7 121.816 -228.5 12.10 0.000 79 8 121.888 -226.3 14.29 0.000 38 7 92.074 -169.0 71.58 0.000 2 5 89.806 -169.0 71.59 0.000 6 6 90.259 -167.7 72.92 0.000 10 6 90.064 -167.3 73.31 0.000 46 8 92.333 -167.2 73.40 0.000 14 7 90.541 -166.0 74.65 0.000 1 4 85.606 -162.8 77.79 0.000 9 5 85.927 -161.3 79.34 0.000 5 5 85.754 -160.9 79.69 0.000 13 6 86.093 -159.4 81.26 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.28 0.34 8.93