preselect {metaforest} | R Documentation |
Preselect variables for MetaForest analysis
Description
Takes a MetaForest
object, and applies different
algorithms for variable selection.
Usage
preselect(x, replications = 100L, algorithm = "replicate", ...)
Arguments
x |
Model to perform variable selection for. Accepts MetaForest objects. |
replications |
Integer. Number of replications to run for variable preselection. Default: 100. |
algorithm |
Character. Preselection method to apply. Currently, 'replicate', 'recursive', and 'bootstrap' are available. |
... |
Other arguments to be passed to and from functions. |
Details
Currently, available methods under algorithm
are:
- replicate
This simply replicates the analysis, which means the forest has access to the full data set, but the trees are grown on different bootstrap samples across replications (thereby varying monte carlo error).
- bootstrap
This replicates the analysis on bootstrapped samples, which means each replication has access to a different sub-sample of the full data set. When selecting this algorithm, cases are either bootstrap-sampled by
study
, or a newstudy
column is generated, and a clustered MetaForest is grown (because some of the rows in the data will be duplicated) , and this would lead to an under-estimation of the OOB error.- recursive
Starting with all moderators, the variable with the most negative variable importance is dropped from the model, and the analysis re-run. This is repeated until only variables with a positive variable importance are left, or no variables are left. The proportion of final models containing each variable reflects its importance.
Value
An object of class 'mf_preselect'
Examples
## Not run:
data <- get(data(dat.bourassa1996))
data <- escalc(measure = "OR", ai = lh.le, bi = lh.re, ci = rh.le, di= rh.re,
data = data, add = 1/2, to = "all")
data$mage[is.na(data$mage)] <- median(data$mage, na.rm = TRUE)
data[c(5:8)] <- lapply(data[c(5:8)], factor)
data$yi <- as.numeric(data$yi)
mf.model <- MetaForest(formula = yi~ selection + investigator + hand_assess + eye_assess +
mage +sex,
data, study = "sample",
whichweights = "unif", num.trees = 300)
preselect(mf.model,
replications = 10,
algorithm = "bootstrap")
## End(Not run)