Learn R Programming

StratifiedMedicine (version 0.1.3)

ple_train: Patient-level Estimates: Train Model

Description

Wrapper function to train a patient-level estimate (ple) model. Used directly in PRISM and can be used to directly fit a ple model by name.

Usage

ple_train(Y, A, X, Xtest, family = "gaussian", ple, 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.

Xtest

Test set

family

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

ple

PLE (Patient-Level Estimate) function. Maps the observed data to PLEs. (Y,A,X) ==> PLE(X).

hyper

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

...

Any additional parameters, not currently passed through.

Value

Trained ple models and patient-level estimates for train/test sets. For 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)).

  • mods - trained model(s)

  • mu_train - Patient-level estimates (training set)

  • mu_test - Patient-level estimates (test set)

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 = ple_ranger(Y, A, X, Xtest=X)
summary(mod1$mu_train)

# Fit through ple_train wrapper #
mod2 = ple_train(Y=Y, A=A, X=X, Xtest=X, ple="ple_ranger" )
summary(mod2$mu_train)
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab