R Under development (unstable) (2024-06-18 r86781 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.56 0.11 1.67 Fixed term is "(Intercept)" user system elapsed 0.02 0.00 2.17 Fixed term is "(Intercept)" user system elapsed 1.48 0.00 1.49 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 23 2.875 + 0.03190 -0.03508 + 8 19 2.862 + 0.03170 + 7 87 2.814 + 0.03745 0.10960 + -0.01299 9 31 2.868 + 0.03155 -0.03516 0.01990 + 9 95 2.800 + 0.03747 0.12110 0.02409 + -0.01404 10 27 2.855 + 0.03135 0.01975 + 8 55 2.880 + 0.03198 -0.04799 + + 9 71 2.843 + 0.03457 0.14610 -0.01583 8 3 2.910 + 0.02740 6 119 2.818 + 0.03757 0.09743 + + -0.01310 10 7 2.924 + 0.02726 -0.02946 7 79 2.822 + 0.03491 0.15730 0.03156 -0.01690 9 11 2.896 + 0.02728 0.02698 7 63 2.873 + 0.03163 -0.04817 0.02001 + + 10 127 2.804 + 0.03759 0.10890 0.02424 + + -0.01415 11 103 2.848 + 0.03483 0.12980 + -0.01586 9 15 2.910 + 0.02713 -0.02999 0.02765 8 247 2.781 + 0.04095 0.18540 + + -0.02102 + 11 39 2.928 + 0.02751 -0.04605 + 8 111 2.826 + 0.03517 0.14110 0.03143 + -0.01692 10 255 2.762 + 0.04133 0.20710 0.02638 + + -0.02300 + 12 47 2.914 + 0.02738 -0.04644 0.02751 + 9 2 2.870 0.02740 5 6 2.887 0.02725 -0.03236 6 78 2.789 0.03451 0.14520 0.03182 -0.01606 8 10 2.856 0.02728 0.02730 6 14 2.873 0.02712 -0.03295 0.02816 7 1 3.211 + 5 5 3.229 + -0.04193 6 9 3.189 + 0.03960 6 13 3.207 + -0.04202 0.03973 7 37 3.227 + -0.03802 + 7 45 3.205 + -0.03784 0.03977 + 8 0 3.172 4 4 3.195 -0.04898 5 8 3.149 0.04085 5 12 3.172 -0.04925 0.04133 6 logLik AICc delta weight 23 129.105 -240.8 0.00 0.135 19 127.865 -240.6 0.15 0.126 87 130.138 -240.4 0.32 0.115 31 129.452 -239.1 1.69 0.058 95 130.653 -239.0 1.72 0.057 27 128.198 -238.9 1.81 0.055 55 129.352 -238.9 1.89 0.053 71 128.065 -238.7 2.08 0.048 3 125.738 -238.6 2.11 0.047 119 130.408 -238.5 2.21 0.045 7 126.577 -238.0 2.72 0.035 79 128.934 -238.0 2.72 0.035 11 126.346 -237.6 3.18 0.027 63 129.705 -237.1 3.61 0.022 127 130.932 -237.1 3.64 0.022 103 128.462 -237.1 3.67 0.022 15 127.225 -237.0 3.76 0.021 247 130.853 -237.0 3.80 0.020 39 126.957 -236.5 4.30 0.016 111 129.331 -236.4 4.36 0.015 255 131.476 -235.7 5.09 0.011 47 127.604 -235.4 5.38 0.009 2 121.539 -232.5 8.27 0.002 6 122.538 -232.2 8.51 0.002 78 124.729 -232.0 8.75 0.002 10 122.150 -231.5 9.29 0.001 14 123.200 -231.3 9.48 0.001 1 89.806 -169.0 71.73 0.000 5 90.557 -168.3 72.47 0.000 9 90.396 -168.0 72.79 0.000 13 91.159 -167.2 73.56 0.000 37 90.566 -166.0 74.74 0.000 45 91.170 -164.9 75.87 0.000 0 85.606 -162.8 77.93 0.000 4 86.602 -162.6 78.14 0.000 8 86.210 -161.8 78.92 0.000 12 87.230 -161.6 79.13 0.000 Models ranked by AICc(x) Random terms (all models): 1 | Subject, 1 | Sex %in% Subject Warning message: In solve.default(-val) : Lapack routine dgesv: system is exactly singular: U[2,2] = 0 (model 70 skipped) 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 24 2.875 + 0.03190 -0.03508 + 8 20 2.862 + 0.03170 + 7 88 2.814 + 0.03745 0.10960 + -0.01299 9 32 2.868 + 0.03155 -0.03516 0.01990 + 9 96 2.800 + 0.03747 0.12110 0.02409 + -0.01404 10 28 2.855 + 0.03135 0.01975 + 8 56 2.880 + 0.03198 -0.04799 + + 9 72 2.843 + 0.03457 0.14610 -0.01583 8 4 2.910 + 0.02740 6 120 2.818 + 0.03757 0.09743 + + -0.01310 10 8 2.924 + 0.02726 -0.02946 7 80 2.822 + 0.03491 0.15730 0.03156 -0.01690 9 12 2.896 + 0.02728 0.02698 7 64 2.873 + 0.03163 -0.04817 0.02001 + + 10 128 2.804 + 0.03759 0.10890 0.02424 + + -0.01415 11 104 2.848 + 0.03483 0.12980 + -0.01586 9 16 2.910 + 0.02713 -0.02999 0.02765 8 248 2.781 + 0.04095 0.18540 + + -0.02102 + 11 40 2.928 + 0.02751 -0.04605 + 8 112 2.826 + 0.03517 0.14110 0.03143 + -0.01692 10 256 2.762 + 0.04133 0.20710 0.02638 + + -0.02300 + 12 48 2.914 + 0.02738 -0.04644 0.02751 + 9 3 2.870 0.02740 5 7 2.887 0.02725 -0.03236 6 79 2.789 0.03451 0.14520 0.03182 -0.01606 8 11 2.856 0.02728 0.02730 6 15 2.873 0.02712 -0.03295 0.02816 7 2 3.211 + 5 6 3.229 + -0.04193 6 10 3.189 + 0.03960 6 14 3.207 + -0.04202 0.03973 7 38 3.227 + -0.03802 + 7 46 3.205 + -0.03784 0.03977 + 8 1 3.172 4 5 3.195 -0.04898 5 9 3.149 0.04085 5 13 3.172 -0.04925 0.04133 6 logLik AICc delta weight 24 129.105 -240.8 0.00 0.135 20 127.865 -240.6 0.15 0.126 88 130.138 -240.4 0.32 0.115 32 129.452 -239.1 1.69 0.058 96 130.653 -239.0 1.72 0.057 28 128.198 -238.9 1.81 0.055 56 129.352 -238.9 1.89 0.053 72 128.065 -238.7 2.08 0.048 4 125.738 -238.6 2.11 0.047 120 130.408 -238.5 2.21 0.045 8 126.577 -238.0 2.72 0.035 80 128.934 -238.0 2.72 0.035 12 126.346 -237.6 3.18 0.027 64 129.705 -237.1 3.61 0.022 128 130.932 -237.1 3.64 0.022 104 128.462 -237.1 3.67 0.022 16 127.225 -237.0 3.76 0.021 248 130.853 -237.0 3.80 0.020 40 126.957 -236.5 4.30 0.016 112 129.331 -236.4 4.36 0.015 256 131.476 -235.7 5.09 0.011 48 127.604 -235.4 5.38 0.009 3 121.539 -232.5 8.27 0.002 7 122.538 -232.2 8.51 0.002 79 124.729 -232.0 8.75 0.002 11 122.150 -231.5 9.29 0.001 15 123.200 -231.3 9.48 0.001 2 89.806 -169.0 71.73 0.000 6 90.557 -168.3 72.47 0.000 10 90.396 -168.0 72.79 0.000 14 91.159 -167.2 73.56 0.000 38 90.566 -166.0 74.74 0.000 46 91.170 -164.9 75.87 0.000 1 85.606 -162.8 77.93 0.000 5 86.602 -162.6 78.14 0.000 9 86.210 -161.8 78.92 0.000 13 87.230 -161.6 79.13 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 24 2.875 + 0.03190 -0.03508 + 8 20 2.862 + 0.03170 + 7 88 2.814 + 0.03745 0.10960 + -0.01299 9 32 2.868 + 0.03155 -0.03516 0.01990 + 9 96 2.800 + 0.03747 0.12110 0.02409 + -0.01404 10 28 2.855 + 0.03135 0.01975 + 8 56 2.880 + 0.03198 -0.04799 + + 9 72 2.843 + 0.03457 0.14610 -0.01583 8 4 2.910 + 0.02740 6 120 2.818 + 0.03757 0.09743 + + -0.01310 10 8 2.924 + 0.02726 -0.02946 7 80 2.822 + 0.03491 0.15730 0.03156 -0.01690 9 12 2.896 + 0.02728 0.02698 7 64 2.873 + 0.03163 -0.04817 0.02001 + + 10 128 2.804 + 0.03759 0.10890 0.02424 + + -0.01415 11 104 2.848 + 0.03483 0.12980 + -0.01586 9 16 2.910 + 0.02713 -0.02999 0.02765 8 248 2.781 + 0.04095 0.18540 + + -0.02102 + 11 40 2.928 + 0.02751 -0.04605 + 8 112 2.826 + 0.03517 0.14110 0.03143 + -0.01692 10 256 2.762 + 0.04133 0.20710 0.02638 + + -0.02300 + 12 48 2.914 + 0.02738 -0.04644 0.02751 + 9 3 2.870 0.02740 5 7 2.887 0.02725 -0.03236 6 79 2.789 0.03451 0.14520 0.03182 -0.01606 8 11 2.856 0.02728 0.02730 6 15 2.873 0.02712 -0.03295 0.02816 7 2 3.211 + 5 6 3.229 + -0.04193 6 10 3.189 + 0.03960 6 14 3.207 + -0.04202 0.03973 7 38 3.227 + -0.03802 + 7 46 3.205 + -0.03784 0.03977 + 8 1 3.172 4 5 3.195 -0.04898 5 9 3.149 0.04085 5 13 3.172 -0.04925 0.04133 6 logLik AICc delta weight 24 129.105 -240.8 0.00 0.135 20 127.865 -240.6 0.15 0.126 88 130.138 -240.4 0.32 0.115 32 129.452 -239.1 1.69 0.058 96 130.653 -239.0 1.72 0.057 28 128.198 -238.9 1.81 0.055 56 129.352 -238.9 1.89 0.053 72 128.065 -238.7 2.08 0.048 4 125.738 -238.6 2.11 0.047 120 130.408 -238.5 2.21 0.045 8 126.577 -238.0 2.72 0.035 80 128.934 -238.0 2.72 0.035 12 126.346 -237.6 3.18 0.027 64 129.705 -237.1 3.61 0.022 128 130.932 -237.1 3.64 0.022 104 128.462 -237.1 3.67 0.022 16 127.225 -237.0 3.76 0.021 248 130.853 -237.0 3.80 0.020 40 126.957 -236.5 4.30 0.016 112 129.331 -236.4 4.36 0.015 256 131.476 -235.7 5.09 0.011 48 127.604 -235.4 5.38 0.009 3 121.539 -232.5 8.27 0.002 7 122.538 -232.2 8.51 0.002 79 124.729 -232.0 8.75 0.002 11 122.150 -231.5 9.29 0.001 15 123.200 -231.3 9.48 0.001 2 89.806 -169.0 71.73 0.000 6 90.557 -168.3 72.47 0.000 10 90.396 -168.0 72.79 0.000 14 91.159 -167.2 73.56 0.000 38 90.566 -166.0 74.74 0.000 46 91.170 -164.9 75.87 0.000 1 85.606 -162.8 77.93 0.000 5 86.602 -162.6 78.14 0.000 9 86.210 -161.8 78.92 0.000 13 87.230 -161.6 79.13 0.000 Models ranked by AICc(x) Random terms (all models): 1 | Subject, 1 | Sex %in% Subject Warning messages: 1: In solve.default(-val) : Lapack routine dgesv: system is exactly singular: U[2,2] = 0 (model 70 skipped) 2: In solve.default(-val) : Lapack routine dgesv: system is exactly singular: U[2,2] = 0 (model 70 skipped) > > #system.time(pdredge(fm2, cluster = clust)) > #system.time(pdredge(fm2, cluster = F)) > #system.time(dredge(fm2)) > > proc.time() user system elapsed 6.57 0.26 9.37