Learn R Programming

StratifiedMedicine (version 0.2.3)

filter_train: Filter: Train Filter Model

Description

Wrapper function to train a filter model. Options include elastic net (glmnet) and random forest based variable importance (ranger). Used directly in PRISM.

Usage

filter_train(Y, A, X, family = "gaussian", filter, hyper = NULL, ...)

Arguments

Y

The outcome variable. Must be numeric or survival (ex; Surv(time,cens) )

A

Treatment variable. (a=1,...A)

X

Covariate space.

family

Outcome type ("gaussian", "binomial", "survival"). Default is "gaussian".

filter

Filter function. Potentially reduces covariate space, (Y, A, X) ==> (Y, A, Xstar).

hyper

Hyper-parameters for the filter model (must be list). Default is NULL.

...

Any additional parameters, not currently passed through.

Value

Trained filter model and vector of variable names that pass the filter.

  • mod - trained model

  • filter.vars - Variables that remain after filtering (could be all)

See Also

PRISM

Examples

Run this code
# NOT RUN {
library(StratifiedMedicine)
## Continuous ##
dat_ctns = generate_subgrp_data(family="gaussian")
Y = dat_ctns$Y
X = dat_ctns$X
A = dat_ctns$A

# Fit ple_ranger directly (treatment-specific ranger models) #
mod1 = filter_train(Y, A, X, filter="filter_glmnet")
mod1$filter.vars

mod2 = filter_train(Y, A, X, filter="filter_ranger")
mod2$filter.vars

# }
# NOT RUN {

# }

Run the code above in your browser using DataLab