get_stability_paths: Extract stability paths

Description Usage Arguments Details Value Examples

Description

Extract stability paths from refits of a model object on resampled or subsampled data.

Usage

1
2
get_stability_paths(model, data, reps = 100, method = "subsample",
  strata = NULL, fraction = 0.5)

Arguments

model

a fitted model object for which refit and get_selected methods are defined

data

the data used for the model fit, a data.frame or a list containing data.frames, vectors and/or matrices. See Details.

reps

how many refits of model on resampled data to perform

method

resampling method, either "subsample" (without replacement) or "bootstrap" (with replacement)

strata

for subsampling, a vector with length nrow(data) defining the strata

fraction

subsampling fraction

Details

List-shaped data arguments are necessary a) for models that use weights or offsets and/or b) for modeling functions that receive the design matrix and the response vector as arguments directly instead of a model formula and a corresponding dataset. In these cases data has to be a named list with names corresponding to the modelling function's respective arguments (for example, list(x = <design matrix>, y = <response>, weights = <model weights>, offset = <model offsets>) or list(data = <dataframe>, weights = <model weights>))

Value

a <max. subsetsize + 1> x <covariates> matrix of relative selection frequencies with class stabpath. First row is the null model (no covariates, i.e., all 0s)

Examples

1
2
3
4
5
6
7
8
9
library(ElemStatLearn)
library(leaps)
data(prostate)
data <- prostate
max_formula <- lpsa ~ (. - train)
model <- regsubsets(max_formula, data=data, nbest = 1, nvmax = 8,
  really.big = TRUE)
set.seed(20141020)
get_stability_paths(model, data, reps=10)

fabian-s/stabpath documentation built on May 16, 2019, 9:58 a.m.