Learn R Programming

StratifiedMedicine (version 0.1.3)

predict.ple_causal_forest: Predict Patient-level Estimates: Causal Forest

Description

Get estimates of (E(Y|X,A=1), E(Y|X,A=0), E(Y|X,A=1)-E(Y|X,A=0)) using trained regression_forest and causal_forest model(s).

Usage

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

Arguments

object

Trained random forest (ranger) 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,1), E(Y|X,0), E(Y|X,1)-E(Y|X,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

# }
# NOT RUN {
mod1 = ple_causal_forest(Y, A, X, Xtest=X)
summary(mod1$mu_train)
summary(predict(mod1)) # Training set predictions (oob) #
summary(predict(mod1, newdata=X)) # Test data, no oob #
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab