Learn R Programming

StratifiedMedicine (version 0.2.3)

ple_glmnet: Patient-level Estimates: Elastic Net (glmnet)

Description

Uses the elastic net (glmnet R package) to obtain patient-level estimates. Usable for continuous, binary, or survival outcomes.

Usage

ple_glmnet(Y, A, X, Xtest, lambda = "lambda.min", family, ...)

Arguments

Y

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

A

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

X

Covariate space.

Xtest

Test set

lambda

Lambda for elastic-net (default = "lambda.min"). Other options include "lambda.1se" or fixed values

family

Outcome type ("gaussian", "binomial", "survival"), default is "gaussian"

...

Any additional parameters, not currently passed through.

Value

Trained glmnet model(s).

  • mod - trained model(s)

  • lambda - Lambda used for elastic-net (passes to prediction function)

  • X - Covariate Space (in model matrix form)

References

Friedman, J., Hastie, T. and Tibshirani, R. (2008) Regularization Paths for Generalized Linear Models via Coordinate Descent, https://web.stanford.edu/~hastie/Papers/glmnet.pdf Journal of Statistical Software, Vol. 33(1), 1-22 Feb 2010 Vol. 33(1), 1-22 Feb 2010.

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

mod1 = ple_glmnet(Y, A, X, Xtest=X, family="gaussian")

# }

Run the code above in your browser using DataLab