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:::testStart("nnet", "MASS")) { + + # Trimmed-down model from example(birthwt) + data(birthwt) + + bwt <- with(birthwt, data.frame( + low = low, + race = factor(race, labels = c("white", "black", "other")), + ptd = factor(ptl > 0), + smoke = (smoke > 0) + )) + + options(contrasts = c("contr.treatment", "contr.poly")) + bwt.mu <- multinom(low ~ ., data = bwt) + dd <- dredge(bwt.mu, trace=T) + + summary(model.avg(dd[1:5])) + gm <- get.models(dd, subset = 1:5) + ma <- model.avg(gm) + + summary(ma) + + # predict(ma) // Cannot average factors! + } Loading required package: MuMIn # weights: 6 (5 variable) initial value 131.004817 iter 10 value 105.451155 final value 105.451149 converged Fixed term is "(Intercept)" 0 : multinom(formula = low ~ 1, data = bwt) # weights: 2 (1 variable) initial value 131.004817 final value 117.335998 converged 1 : multinom(formula = low ~ ptd + 1, data = bwt) # weights: 3 (2 variable) initial value 131.004817 final value 110.948878 converged 2 : multinom(formula = low ~ race + 1, data = bwt) # weights: 4 (3 variable) initial value 131.004817 iter 10 value 114.830822 final value 114.830815 converged 3 : multinom(formula = low ~ ptd + race + 1, data = bwt) # weights: 5 (4 variable) initial value 131.004817 iter 10 value 108.511317 iter 10 value 108.511317 final value 108.511317 converged 4 : multinom(formula = low ~ smoke + 1, data = bwt) # weights: 3 (2 variable) initial value 131.004817 final value 114.902303 converged 5 : multinom(formula = low ~ ptd + smoke + 1, data = bwt) # weights: 4 (3 variable) initial value 131.004817 final value 109.664449 converged 6 : multinom(formula = low ~ race + smoke + 1, data = bwt) # weights: 5 (4 variable) initial value 131.004817 final value 109.987355 converged 7 : multinom(formula = low ~ ptd + race + smoke + 1, data = bwt) # weights: 6 (5 variable) initial value 131.004817 iter 10 value 105.451155 final value 105.451149 converged # weights: 6 (5 variable) initial value 131.004817 iter 10 value 105.451155 final value 105.451149 converged # weights: 5 (4 variable) initial value 131.004817 iter 10 value 108.511317 iter 10 value 108.511317 final value 108.511317 converged # weights: 4 (3 variable) initial value 131.004817 final value 109.664449 converged # weights: 3 (2 variable) initial value 131.004817 final value 110.948878 converged # weights: 5 (4 variable) initial value 131.004817 final value 109.987355 converged Call: model.avg(object = gm) Component model call: multinom(formula = low ~ <5 unique rhs>, data = bwt) Component models: df logLik AICc delta weight 123 5 -105.45 221.23 0.00 0.72 12 4 -108.51 225.24 4.01 0.10 13 3 -109.66 225.46 4.23 0.09 1 2 -110.95 225.96 4.73 0.07 23 4 -109.99 228.19 6.96 0.02 Term codes: ptd race smoke 1 2 3 Model-averaged coefficients: (full average) Estimate Std. Error z value Pr(>|z|) (Intercept) -1.7911 0.4598 3.896 9.79e-05 *** ptdTRUE 1.2927 0.4709 2.745 0.00605 ** raceblack 0.9028 0.6023 1.499 0.13390 raceother 0.8333 0.5307 1.570 0.11634 smokeTRUE 0.7477 0.4934 1.515 0.12966 (conditional average) Estimate Std. Error z value Pr(>|z|) (Intercept) -1.7911 0.4598 3.896 9.79e-05 *** ptdTRUE 1.3222 0.4334 3.051 0.00228 ** raceblack 1.0690 0.5019 2.130 0.03317 * raceother 0.9867 0.4267 2.313 0.02075 * smokeTRUE 0.8960 0.3984 2.249 0.02452 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > > proc.time() user system elapsed 1.76 0.21 1.96