Combine all-subsets GLMs using the ARM algorithm. Calculate ARM weights for a set of models.

arm.glm(object, R = 250, weight.by = c("aic", "loglik"), trace = FALSE)

armWeights(object, ..., data, weight.by = c("aic", "loglik"), R = 1000)

Arguments

object

for arm.glm, a fitted “global” glm object. For armWeights, a fitted glm object, or a list of such, or an "averaging" object.

...

more fitted model objects.

R

number of permutations.

weight.by

indicates whether model weights should be calculated with AIC or log-likelihood.

trace

if TRUE, information is printed during the running of arm.glm.

data

a data frame in which to look for variables for use with prediction. If omitted, the fitted linear predictors are used.

Details

For each of all-subsets of the “global” model, parameters are estimated using randomly sampled half of the data. Log-likelihood given the remaining half of the data is used to calculate AIC weights. This is repeated R times and mean of the weights is used to average all-subsets parameters estimated using complete data.

Note

Number of parameters is limited to floor(nobs(object) / 2) - 1. All-subsets respect marginality constraints.

Value

arm.glm returns an object of class "averaging" contaning only “full” averaged coefficients. See model.avg for object description.

armWeights returns a numeric vector of model weights.

References

Yang, Y. 2001 Adaptive Regression by Mixing. Journal of the American Statistical Association 96, 574–588.

Yang, Y. 2003 Regression with multiple candidate models: selecting or mixing? Statistica Sinica 13, 783–810.

Author

Kamil Bartoń

See also

model.avg, par.avg

Weights for assigning new model weights to an "averaging" object.

Other implementation of ARM algorithm: arms in (archived) package MMIX.

Other kinds of model weights: BGWeights, bootWeights, cos2Weights, jackknifeWeights, stackingWeights.

Examples

fm <- glm(y ~ X1 + X2 + X3 + X4, data = Cement)

summary(am1 <- arm.glm(fm, R = 15))
#> 
#> Call:
#> arm.glm(object = fm, R = 15)
#> 
#> 
#> Component models: 
#>        df logLik    AIC delta weight ARM weight
#> 124     5 -26.93  63.87  0.00   0.27       0.11
#> 123     5 -26.95  63.90  0.04   0.27       0.10
#> 12      4 -28.16  64.31  0.45   0.22       0.50
#> 134     5 -27.31  64.62  0.75   0.19       0.05
#> 14      4 -29.82  67.63  3.77   0.04       0.17
#> 234     5 -29.73  69.47  5.60   0.02       0.03
#> 34      4 -35.37  78.74 14.88   0.00       0.02
#> 23      4 -40.96  89.93 26.06   0.00       0.01
#> 4       3 -45.87  97.74 33.88   0.00       0.00
#> 2       3 -46.04  98.07 34.20   0.00       0.00
#> 24      4 -45.76  99.52 35.66   0.00       0.00
#> 1       3 -48.21 102.41 38.55   0.00       0.00
#> 13      4 -48.00 104.01 40.14   0.00       0.00
#> 3       3 -50.98 107.96 44.09   0.00       0.00
#> (Null)  2 -53.17 110.34 46.47   0.00       0.00
#> 
#> Term codes: 
#> X1 X2 X3 X4 
#>  1  2  3  4 
#> 
#> Model-averaged coefficients:  
#> (ARM average) 
#>             Estimate Std. Error Adjusted SE z value Pr(>|z|)    
#> (Intercept) 72.67092   33.74451    33.94815   2.141 0.032303 *  
#> X1           1.37222    0.39686     0.40432   3.394 0.000689 ***
#> X2           0.42159    0.37543     0.37858   1.114 0.265441    
#> X3          -0.07417    0.34668     0.35027   0.212 0.832304    
#> X4          -0.23050    0.36170     0.36431   0.633 0.526918    
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 

mst <- dredge(fm)
#> Error in dredge(fm): 'global.model''s 'na.action' argument is not set and options('na.action') is "na.omit"

am2 <- model.avg(mst, fit = TRUE)
#> Error: object 'mst' not found

Weights(am2) <- armWeights(am2, data = Cement, R = 15)
#> Error: object 'am2' not found

# differences are due to small R:
coef(am1, full = TRUE)
#> (Intercept)          X1          X2          X3          X4 
#> 72.67092195  1.37222488  0.42159100 -0.07416965 -0.23050207 
coef(am2, full = TRUE)
#> Error: object 'am2' not found