subset.metapred {metamisc} | R Documentation |
Subsetting metapred fits
Description
Return a model from the cross-validation procedure or the final 'global' model. Caution: This function is still under development.
Usage
## S3 method for class 'metapred'
subset(
x,
select = "cv",
step = NULL,
model = NULL,
stratum = NULL,
add = TRUE,
...
)
Arguments
x |
metapred object |
select |
Which type of model to select: "cv" (default), "global", or (experimental) "stratified", or "stratum". |
step |
Which step should be selected? Defaults to the best step. numeric is converted to name of the step: 0 for an unchanged model, 1 for the first change... |
model |
Which model change should be selected? NULL (default, best change) or character name of variable or (integer) index of model change. |
stratum |
Experimental. Stratum to return if select = "stratum". |
add |
Logical. Add data, options and functions to the resulting object? Defaults to |
... |
For compatibility only. |
Value
An object of class mp.cv
for select = "cv" and an object of class mp.global
for select = "global".
In both cases, additional data is added to the resulting object, thereby making it suitable for further methods.
Author(s)
Valentijn de Jong
Examples
data(DVTipd)
DVTipd$cluster <- letters[1:4] # Add a fictional clustering to the data.
mp <- metapred(DVTipd, strata = "cluster", formula = dvt ~ histdvt + ddimdich, family = binomial)
subset(mp) # best cross-validated model
subset(mp, select = "global") # Final model fitted on all strata.
subset(mp, step = 1) # The best model of step 1
subset(mp, step = 1, model = "histdvt") # The model in which histdvt was removed, in step 1.