Learn R Programming

StratifiedMedicine (version 0.1.3)

predict.ple_glmnet: Predict Patient-level Estimates: glmnet

Description

For continuous/binary (family="gaussian" or "binomial"), output estimates of (E(Y|X,A=1), E(Y|X,A=0), E(Y|X,A=1)-E(Y|X,A=0)). For survival, output estimates of (HR(X,A=1), HR(X,A=0), HR(X, A=1)-HR(X, A=0)).

Usage

# S3 method for ple_glmnet
predict(object, newdata = NULL, ...)

Arguments

object

Trained glmnet model(s).

newdata

Data-set to make predictions at (Default=NULL, predictions correspond to training data).

...

Any additional parameters, not currently passed through.

Value

Data-frame with predictions of (E(Y|X,A=1), E(Y|X,A=0), E(Y|X,A=1)-E(Y|X,A=0)) for continuous/binary outcomes. For survival, returns (HR(X,A=1), HR(X,A=0), HR(X, A=1)-HR(X, A=0)).

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")
summary(mod1$mu_train)
summary(predict(mod1)) # Training set predictions, newdata=NULL
summary(predict(mod1, newdata=X)) # Test set predictions

# }

Run the code above in your browser using DataLab