R version 4.5.0 beta (2025-03-29 r88074 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.40 0.18 1.57 Fixed term is "(Intercept)" user system elapsed 0.04 0.00 2.15 Fixed term is "(Intercept)" user system elapsed 1.53 0.06 1.60 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 19 2.862 + 0.03170 + 3 2.910 + 0.02740 23 2.861 + 0.03169 3.260e-03 + 27 2.863 + 0.03173 -0.001311 + 55 2.851 + 0.03162 2.535e-02 + + 11 2.904 + 0.02739 0.010140 7 2.909 + 0.02739 1.099e-03 39 2.895 + 0.02757 2.652e-02 + 87 2.845 + 0.03313 3.731e-02 + -0.003086 31 2.861 + 0.03173 3.473e-03 -0.001812 + 119 2.840 + 0.03263 4.896e-02 + + -0.002168 63 2.852 + 0.03174 2.637e-02 -0.005068 + + 71 2.883 + 0.02979 5.553e-02 -0.004928 15 2.904 + 0.02739 3.091e-05 0.010140 103 2.875 + 0.02941 6.779e-02 + -0.003790 47 2.892 + 0.02756 2.527e-02 0.006095 + 95 2.845 + 0.03323 3.864e-02 -0.002500 + -0.003180 247 2.827 + 0.03388 7.798e-02 + + -0.004832 127 2.840 + 0.03285 5.213e-02 -0.005533 + + -0.002357 2 2.870 0.02740 79 2.880 + 0.02958 4.991e-02 0.008979 -0.004505 111 2.874 + 0.02929 6.426e-02 0.005259 + -0.003566 10 2.865 0.02739 0.009052 255 2.827 + 0.03404 8.001e-02 -0.005224 + + -0.004923 6 2.870 0.02741 -4.566e-04 70 2.840 0.03014 6.155e-02 -0.005615 14 2.866 0.02740 -1.444e-03 0.009231 78 2.838 0.02995 5.651e-02 0.007856 -0.005235 1 3.211 + 5 3.203 + 1.693e-02 9 3.201 + 0.017060 37 3.193 + 3.882e-02 + 13 3.195 + 1.541e-02 0.015270 45 3.187 + 3.640e-02 0.011920 + 0 3.172 8 3.163 0.014670 4 3.165 1.362e-02 12 3.158 1.225e-02 0.013190 Sex:age:rn1 df logLik AICc delta weight 19 7 127.865 -240.6 0.00 0.315 3 6 125.738 -238.6 1.97 0.118 23 8 127.878 -238.3 2.31 0.099 27 8 127.867 -238.3 2.33 0.098 55 9 128.678 -237.5 3.09 0.067 11 7 125.839 -236.6 4.05 0.042 7 7 125.739 -236.4 4.25 0.038 39 8 126.746 -236.0 4.57 0.032 87 9 127.930 -236.0 4.59 0.032 31 9 127.881 -235.9 4.69 0.030 119 10 128.704 -235.1 5.47 0.020 63 10 128.703 -235.1 5.47 0.020 71 8 125.867 -234.3 6.33 0.013 15 8 125.839 -234.2 6.39 0.013 103 9 126.822 -233.8 6.80 0.010 47 9 126.782 -233.7 6.88 0.010 95 10 127.935 -233.6 7.01 0.009 247 + 11 128.752 -232.8 7.86 0.006 127 11 128.733 -232.7 7.89 0.006 2 5 121.539 -232.5 8.12 0.005 79 9 125.944 -232.1 8.56 0.004 111 10 126.849 -231.4 9.18 0.003 10 6 121.618 -230.4 10.21 0.002 255 + 12 128.778 -230.3 10.34 0.002 6 6 121.539 -230.2 10.36 0.002 70 7 121.702 -228.3 12.33 0.001 14 7 121.620 -228.1 12.49 0.001 78 8 121.760 -226.1 14.54 0.000 1 5 89.806 -169.0 71.59 0.000 5 6 89.946 -167.1 73.55 0.000 9 6 89.929 -167.0 73.58 0.000 37 7 90.264 -165.4 75.20 0.000 13 7 90.044 -165.0 75.64 0.000 45 8 90.323 -163.2 77.42 0.000 0 4 85.606 -162.8 77.79 0.000 8 5 85.696 -160.8 79.81 0.000 4 5 85.695 -160.8 79.81 0.000 12 6 85.767 -158.7 81.91 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 20 2.862 + 0.03170 + 4 2.910 + 0.02740 24 2.861 + 0.03169 3.260e-03 + 28 2.863 + 0.03173 -0.001311 + 56 2.851 + 0.03162 2.535e-02 + + 12 2.904 + 0.02739 0.010140 8 2.909 + 0.02739 1.099e-03 40 2.895 + 0.02757 2.652e-02 + 88 2.845 + 0.03313 3.731e-02 + -0.003086 32 2.861 + 0.03173 3.473e-03 -0.001812 + 120 2.840 + 0.03263 4.896e-02 + + -0.002168 64 2.852 + 0.03174 2.637e-02 -0.005068 + + 72 2.883 + 0.02979 5.553e-02 -0.004928 16 2.904 + 0.02739 3.091e-05 0.010140 104 2.875 + 0.02941 6.779e-02 + -0.003790 48 2.892 + 0.02756 2.527e-02 0.006095 + 96 2.845 + 0.03323 3.864e-02 -0.002500 + -0.003180 248 2.827 + 0.03388 7.798e-02 + + -0.004832 128 2.840 + 0.03285 5.213e-02 -0.005533 + + -0.002357 3 2.870 0.02740 80 2.880 + 0.02958 4.991e-02 0.008979 -0.004505 112 2.874 + 0.02929 6.426e-02 0.005259 + -0.003566 11 2.865 0.02739 0.009052 256 2.827 + 0.03404 8.001e-02 -0.005224 + + -0.004923 7 2.870 0.02741 -4.566e-04 71 2.840 0.03014 6.155e-02 -0.005615 15 2.866 0.02740 -1.444e-03 0.009231 79 2.838 0.02995 5.651e-02 0.007856 -0.005235 2 3.211 + 6 3.203 + 1.693e-02 10 3.201 + 0.017060 38 3.193 + 3.882e-02 + 14 3.195 + 1.541e-02 0.015270 46 3.187 + 3.640e-02 0.011920 + 1 3.172 9 3.163 0.014670 5 3.165 1.362e-02 13 3.158 1.225e-02 0.013190 Sex:age:rn1 df logLik AICc delta weight 20 7 127.865 -240.6 0.00 0.315 4 6 125.738 -238.6 1.97 0.118 24 8 127.878 -238.3 2.31 0.099 28 8 127.867 -238.3 2.33 0.098 56 9 128.678 -237.5 3.09 0.067 12 7 125.839 -236.6 4.05 0.042 8 7 125.739 -236.4 4.25 0.038 40 8 126.746 -236.0 4.57 0.032 88 9 127.930 -236.0 4.59 0.032 32 9 127.881 -235.9 4.69 0.030 120 10 128.704 -235.1 5.47 0.020 64 10 128.703 -235.1 5.47 0.020 72 8 125.867 -234.3 6.33 0.013 16 8 125.839 -234.2 6.39 0.013 104 9 126.822 -233.8 6.80 0.010 48 9 126.782 -233.7 6.88 0.010 96 10 127.935 -233.6 7.01 0.009 248 + 11 128.752 -232.8 7.86 0.006 128 11 128.733 -232.7 7.89 0.006 3 5 121.539 -232.5 8.12 0.005 80 9 125.944 -232.1 8.56 0.004 112 10 126.849 -231.4 9.18 0.003 11 6 121.618 -230.4 10.21 0.002 256 + 12 128.778 -230.3 10.34 0.002 7 6 121.539 -230.2 10.36 0.002 71 7 121.702 -228.3 12.33 0.001 15 7 121.620 -228.1 12.49 0.001 79 8 121.760 -226.1 14.54 0.000 2 5 89.806 -169.0 71.59 0.000 6 6 89.946 -167.1 73.55 0.000 10 6 89.929 -167.0 73.58 0.000 38 7 90.264 -165.4 75.20 0.000 14 7 90.044 -165.0 75.64 0.000 46 8 90.323 -163.2 77.42 0.000 1 4 85.606 -162.8 77.79 0.000 9 5 85.696 -160.8 79.81 0.000 5 5 85.695 -160.8 79.81 0.000 13 6 85.767 -158.7 81.91 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 20 2.862 + 0.03170 + 4 2.910 + 0.02740 24 2.861 + 0.03169 3.260e-03 + 28 2.863 + 0.03173 -0.001311 + 56 2.851 + 0.03162 2.535e-02 + + 12 2.904 + 0.02739 0.010140 8 2.909 + 0.02739 1.099e-03 40 2.895 + 0.02757 2.652e-02 + 88 2.845 + 0.03313 3.731e-02 + -0.003086 32 2.861 + 0.03173 3.473e-03 -0.001812 + 120 2.840 + 0.03263 4.896e-02 + + -0.002168 64 2.852 + 0.03174 2.637e-02 -0.005068 + + 72 2.883 + 0.02979 5.553e-02 -0.004928 16 2.904 + 0.02739 3.091e-05 0.010140 104 2.875 + 0.02941 6.779e-02 + -0.003790 48 2.892 + 0.02756 2.527e-02 0.006095 + 96 2.845 + 0.03323 3.864e-02 -0.002500 + -0.003180 248 2.827 + 0.03388 7.798e-02 + + -0.004832 128 2.840 + 0.03285 5.213e-02 -0.005533 + + -0.002357 3 2.870 0.02740 80 2.880 + 0.02958 4.991e-02 0.008979 -0.004505 112 2.874 + 0.02929 6.426e-02 0.005259 + -0.003566 11 2.865 0.02739 0.009052 256 2.827 + 0.03404 8.001e-02 -0.005224 + + -0.004923 7 2.870 0.02741 -4.566e-04 71 2.840 0.03014 6.155e-02 -0.005615 15 2.866 0.02740 -1.444e-03 0.009231 79 2.838 0.02995 5.651e-02 0.007856 -0.005235 2 3.211 + 6 3.203 + 1.693e-02 10 3.201 + 0.017060 38 3.193 + 3.882e-02 + 14 3.195 + 1.541e-02 0.015270 46 3.187 + 3.640e-02 0.011920 + 1 3.172 9 3.163 0.014670 5 3.165 1.362e-02 13 3.158 1.225e-02 0.013190 Sex:age:rn1 df logLik AICc delta weight 20 7 127.865 -240.6 0.00 0.315 4 6 125.738 -238.6 1.97 0.118 24 8 127.878 -238.3 2.31 0.099 28 8 127.867 -238.3 2.33 0.098 56 9 128.678 -237.5 3.09 0.067 12 7 125.839 -236.6 4.05 0.042 8 7 125.739 -236.4 4.25 0.038 40 8 126.746 -236.0 4.57 0.032 88 9 127.930 -236.0 4.59 0.032 32 9 127.881 -235.9 4.69 0.030 120 10 128.704 -235.1 5.47 0.020 64 10 128.703 -235.1 5.47 0.020 72 8 125.867 -234.3 6.33 0.013 16 8 125.839 -234.2 6.39 0.013 104 9 126.822 -233.8 6.80 0.010 48 9 126.782 -233.7 6.88 0.010 96 10 127.935 -233.6 7.01 0.009 248 + 11 128.752 -232.8 7.86 0.006 128 11 128.733 -232.7 7.89 0.006 3 5 121.539 -232.5 8.12 0.005 80 9 125.944 -232.1 8.56 0.004 112 10 126.849 -231.4 9.18 0.003 11 6 121.618 -230.4 10.21 0.002 256 + 12 128.778 -230.3 10.34 0.002 7 6 121.539 -230.2 10.36 0.002 71 7 121.702 -228.3 12.33 0.001 15 7 121.620 -228.1 12.49 0.001 79 8 121.760 -226.1 14.54 0.000 2 5 89.806 -169.0 71.59 0.000 6 6 89.946 -167.1 73.55 0.000 10 6 89.929 -167.0 73.58 0.000 38 7 90.264 -165.4 75.20 0.000 14 7 90.044 -165.0 75.64 0.000 46 8 90.323 -163.2 77.42 0.000 1 4 85.606 -162.8 77.79 0.000 9 5 85.696 -160.8 79.81 0.000 5 5 85.695 -160.8 79.81 0.000 13 6 85.767 -158.7 81.91 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.50 0.48 9.48