Learn R Programming

semEff (version 0.4.0)

avgEst: Weighted Average of Model Estimates

Description

Calculate a weighted average of model estimates (e.g. effects, fitted values, residuals) for a set of models.

Usage

avgEst(est, weights = "equal", est.names = NULL)

Arguments

est

A list or nested list of numeric vectors, comprising the model estimates. In the latter case, these should correspond to estimates for candidate models for each of a set of different response variables.

weights

An optional numeric vector of weights to use for model averaging, or a named list of such vectors. The former should be supplied when est is a list, and the latter when it is a nested list (with matching list names). If weights = "equal" (default), a simple average is calculated instead.

est.names

An optional vector of names used to extract and/or sort estimates from the output.

Value

A numeric vector of the model-averaged estimates, or a list of such vectors.

Details

This function can be used to calculate a weighted average of model estimates such as effects, fitted values, or residuals, where models are typically competing candidate models fit to the same response variable. Weights are typically a 'weight of evidence' type metric such as Akaike model weights (Burnham & Anderson 2002, Burnham et al. 2011), which can be conveniently calculated in R using packages such as MuMIn or AICcmodavg. However, numeric weights of any sort can be used. If none are supplied, the simple average is calculated instead.

Averaging is performed via the 'full'/'zero' rather than 'subset'/'conditional'/'natural' method, meaning that zero is substituted for estimates for any 'missing' parameters (e.g. effects) prior to calculations. This provides a form of shrinkage and thus reduces estimate bias (Burnham & Anderson 2002, Grueber et al. 2011).

References

Burnham, K. P., & Anderson, D. R. (2002). Model Selection and Multimodel Inference: A Practical Information-Theoretic Approach (2nd ed.). New York: Springer-Verlag. Retrieved from https://www.springer.com/gb/book/9780387953649

Burnham, K. P., Anderson, D. R., & Huyvaert, K. P. (2011). AIC model selection and multimodel inference in behavioral ecology: some background, observations, and comparisons. Behavioral Ecology and Sociobiology, 65(1), 23-35. https://doi.org/c4mrns

Dormann, C. F., Calabrese, J. M., Guillera-Arroita, G., Matechou, E., Bahn, V., Barton, K., ... Hartig, F. (2018). Model averaging in ecology: a review of Bayesian, information-theoretic, and tactical approaches for predictive inference. Ecological Monographs, 88(4), 485-504. https://doi.org/gfgwrv

Grueber, C. E., Nakagawa, S., Laws, R. J., & Jamieson, I. G. (2011). Multimodel inference in ecology and evolution: challenges and solutions. Journal of Evolutionary Biology, 24(4), 699-711. https://doi.org/b7b5d4

Walker, J. A. (2019). Model-averaged regression coefficients have a straightforward interpretation using causal conditioning. BioRxiv, 133785. https://doi.org/c8zt

See Also

weighted.mean

Examples

Run this code
# NOT RUN {
## Model-averaged effects (coefficients)
m <- Shipley.Growth  # candidate models
e <- lapply(m, function(i) coef(summary(i))[, 1])
avgEst(e)

## Using weights
w <- runif(length(e), 0, 1)
avgEst(e, w)

## Model-averaged predictions
f <- lapply(m, predict)
avgEst(f, w)
# }

Run the code above in your browser using DataLab