# \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