Learn R Programming

MuMIn (version 1.47.5)

cos2Weights: Cos-squared model weights

Description

Calculates cos-squared model weights, following the algorithm outlined in the appendix of Garthwaite & Mubwandarikwa (2010).

Usage

cos2Weights(object, ..., data, eps = 1e-06, maxit = 100, predict.args = list())

Value

A numeric vector of model weights.

Arguments

object, ...

two or more fitted glm objects, or a list of such, or an "averaging" object. Currently only lm and glm objects are accepted.

data

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

eps

tolerance for determining convergence.

maxit

maximum number of iterations.

predict.args

optionally, a list of additional arguments to be passed to predict.

Author

Carsten Dormann, adapted by Kamil Bartoń

References

Garthwaite, P. H. and Mubwandarikwa, E. 2010 Selection of weights for weighted model averaging. Australian & New Zealand Journal of Statistics 52, 363–382.

Dormann, C. et al. 2018 Model averaging in ecology: a review of Bayesian, information-theoretic, and tactical approaches for predictive inference. Ecological Monographs 88, 485–504.

See Also

Weights, model.avg

Other model weights: BGWeights(), bootWeights(), jackknifeWeights(), stackingWeights()

Examples

Run this code
# \dontshow{
if(length(find.package("expm", quiet = TRUE)) == 1) {
# }
fm <- lm(y ~ X1 + X2 + X3 + X4, Cement, na.action = na.fail)
# most efficient way to produce a list of all-subsets models
models <- lapply(dredge(fm, evaluate = FALSE), eval)
ma <- model.avg(models)

test.data <- Cement
Weights(ma) <- cos2Weights(models, data = test.data)
predict(ma, data = test.data)
# \dontshow{
} else message("Need CRAN package 'expm' to run this example")
# }

Run the code above in your browser using DataLab