Title: | Evaluating Individualized Treatment Rules |
---|---|
Description: | Provides various statistical methods for evaluating Individualized Treatment Rules under randomized data. The provided metrics include Population Average Value (PAV), Population Average Prescription Effect (PAPE), Area Under Prescription Effect Curve (AUPEC). It also provides the tools to analyze Individualized Treatment Rules under budget constraints. Detailed reference in Imai and Li (2019) <arXiv:1905.05389>. |
Authors: | Michael Lingzhi Li [aut, cre], Kosuke Imai [aut], Jialu Li [ctb], Xiaolong Yang [ctb] |
Maintainer: | Michael Lingzhi Li <[email protected]> |
License: | GPL (>=2) |
Version: | 1.0.0 |
Built: | 2025-02-07 04:30:34 UTC |
Source: | https://github.com/michaellli/evalitr |
This function estimates AUPEC. The details of the methods for this design are given in Imai and Li (2019).
AUPEC(T, tau, Y, centered = TRUE)
AUPEC(T, tau, Y, centered = TRUE)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
tau |
A vector of the unit-level continuous score for treatment assignment. We assume those that have tau<0 should not have treatment. Conditional Average Treatment Effect is one possible measure. |
Y |
A vector of the outcome variable of interest for each sample. |
centered |
If |
A list that contains the following items:
aupec |
The estimated Area Under Prescription Evaluation Curve |
sd |
The estimated standard deviation of AUPEC. |
vec |
A vector of points outlining the AUPEC curve across each possible budget point for the dataset. Each step increases the budget by 1/n where n is the number of data points. |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2019). “Experimental Evaluation of Individualized Treatment Rules”,
T = c(1,0,1,0,1,0,1,0) tau = c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7) Y = c(4,5,0,2,4,1,-4,3) aupeclist <- AUPEC(T,tau,Y) aupeclist$aupec aupeclist$sd aupeclist$vec
T = c(1,0,1,0,1,0,1,0) tau = c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7) Y = c(4,5,0,2,4,1,-4,3) aupeclist <- AUPEC(T,tau,Y) aupeclist$aupec aupeclist$sd aupeclist$vec
This function estimates AUPEC. The details of the methods for this design are given in Imai and Li (2019).
AUPECcv(T, tau, Y, ind, centered = TRUE)
AUPECcv(T, tau, Y, ind, centered = TRUE)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
tau |
A matrix where the |
Y |
The outcome variable of interest. |
ind |
A vector of integers (between 1 and number of folds inclusive) indicating which testing set does each sample belong to. |
centered |
If |
A list that contains the following items:
aupec |
The estimated AUPEC. |
sd |
The estimated standard deviation of AUPEC. |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2019). “Experimental Evaluation of Individualized Treatment Rules”,
T = c(1,0,1,0,1,0,1,0) tau = matrix(c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9),nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) aupeclist <- AUPECcv(T, tau, Y, ind) aupeclist$aupec aupeclist$sd
T = c(1,0,1,0,1,0,1,0) tau = matrix(c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9),nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) aupeclist <- AUPECcv(T, tau, Y, ind) aupeclist$aupec aupeclist$sd
Compute Quantities of Interest (PAPE, PAPEp, PAPDp, AUPEC, GATE, GATEcv)
compute_qoi(fit_obj, algorithms)
compute_qoi(fit_obj, algorithms)
fit_obj |
An output object from |
algorithms |
Machine learning algorithms |
Compute Quantities of Interest (PAPE, PAPEp, PAPDp, AUPEC, GATE, GATEcv) with user defined functions
compute_qoi_user(user_itr, Tcv, Ycv, data, ngates, budget, ...)
compute_qoi_user(user_itr, Tcv, Ycv, data, ngates, budget, ...)
user_itr |
A user-defined function to create an ITR. The function should take the data as input and return an unit-level continuous score for treatment assignment. We assume those that have score less than 0 should not have treatment. The default is |
Tcv |
A vector of the unit-level binary treatment. |
Ycv |
A vector of the unit-level continuous outcome. |
data |
A data frame containing the variables of interest. |
ngates |
The number of gates to be used in the GATE function. |
budget |
The maximum percentage of population that can be treated under the budget constraint. |
... |
Additional arguments to be passed to the user-defined function. |
This function calculates statistics related to the test of treatment effect consistency across groups.
consist.test(T, tau, Y, ngates = 5, nsim = 10000)
consist.test(T, tau, Y, ngates = 5, nsim = 10000)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
tau |
A vector of the unit-level continuous score. Conditional Average Treatment Effect is one possible measure. |
Y |
A vector of the outcome variable of interest for each sample. |
ngates |
The number of groups to separate the data into. The groups are determined by |
nsim |
Number of Monte Carlo simulations used to simulate the null distributions. Default is 10000. |
The details of the methods for this design are given in Imai and Li (2022).
A list that contains the following items:
stat |
The estimated statistic for the test of consistency |
pval |
The p-value of the null hypothesis (that the treatment effects are consistent) |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2022). “Statistical Inference for Heterogeneous Treatment Effects Discovered by Generic Machine Learning in Randomized Experiments”,
T = c(1,0,1,0,1,0,1,0) tau = c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7) Y = c(4,5,0,2,4,1,-4,3) consisttestlist <- consist.test(T,tau,Y,ngates=5) consisttestlist$stat consisttestlist$pval
T = c(1,0,1,0,1,0,1,0) tau = c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7) Y = c(4,5,0,2,4,1,-4,3) consisttestlist <- consist.test(T,tau,Y,ngates=5) consisttestlist$stat consisttestlist$pval
This function calculates statistics related to the test of treatment effect consistency across groups under cross-validation.
consistcv.test(T, tau, Y, ind, ngates = 5, nsim = 10000)
consistcv.test(T, tau, Y, ind, ngates = 5, nsim = 10000)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
tau |
A vector of the unit-level continuous score. Conditional Average Treatment Effect is one possible measure. |
Y |
A vector of the outcome variable of interest for each sample. |
ind |
A vector of integers (between 1 and number of folds inclusive) indicating which testing set does each sample belong to. |
ngates |
The number of groups to separate the data into. The groups are determined by |
nsim |
Number of Monte Carlo simulations used to simulate the null distributions. Default is 10000. |
The details of the methods for this design are given in Imai and Li (2022).
A list that contains the following items:
stat |
The estimated statistic for the test of consistency under cross-validation. |
pval |
The p-value of the null hypothesis (that the treatment effects are consistent) |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2022). “Statistical Inference for Heterogeneous Treatment Effects Discovered by Generic Machine Learning in Randomized Experiments”,
T = c(1,0,1,0,1,0,1,0) tau = matrix(c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9),nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) consisttestlist <- consistcv.test(T,tau,Y,ind,ngates=2) consisttestlist$stat consisttestlist$pval
T = c(1,0,1,0,1,0,1,0) tau = matrix(c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9),nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) consisttestlist <- consistcv.test(T,tau,Y,ind,ngates=2) consisttestlist$stat consisttestlist$pval
Create general arguments
create_ml_args(data)
create_ml_args(data)
data |
A dataset |
Create arguments for bartMachine
create_ml_args_bart(data)
create_ml_args_bart(data)
data |
A dataset |
Create arguments for bartCause
create_ml_args_bartc(data)
create_ml_args_bartc(data)
data |
A dataset |
Create arguments for causal forest
create_ml_args_causalforest(data)
create_ml_args_causalforest(data)
data |
A dataset |
Create arguments for LASSO
create_ml_args_lasso(data)
create_ml_args_lasso(data)
data |
A dataset |
Create arguments for super learner
create_ml_args_superLearner(data)
create_ml_args_superLearner(data)
data |
A dataset |
Create arguments for SVM
create_ml_args_svm(data)
create_ml_args_svm(data)
data |
A dataset |
Create arguments for SVM classification
create_ml_args_svm_cls(data)
create_ml_args_svm_cls(data)
data |
A dataset |
Create arguments for ML algorithms
create_ml_arguments(outcome, treatment, data)
create_ml_arguments(outcome, treatment, data)
outcome |
Outcome of interests |
treatment |
Treatment variable |
data |
A dataset |
Estimate individual treatment rules (ITR)
estimate_itr( treatment, form, data, algorithms, budget, n_folds = 5, split_ratio = 0, ngates = 5, preProcess = NULL, weights = NULL, trControl = caret::trainControl(method = "none"), tuneGrid = NULL, tuneLength = ifelse(trControl$method == "none", 1, 3), user_model = NULL, SL_library = NULL, ... )
estimate_itr( treatment, form, data, algorithms, budget, n_folds = 5, split_ratio = 0, ngates = 5, preProcess = NULL, weights = NULL, trControl = caret::trainControl(method = "none"), tuneGrid = NULL, tuneLength = ifelse(trControl$method == "none", 1, 3), user_model = NULL, SL_library = NULL, ... )
treatment |
Treatment variable |
form |
a formula object that takes the form |
data |
A data frame that contains the outcome |
algorithms |
List of machine learning algorithms to be used. |
budget |
The maximum percentage of population that can be treated under the budget constraint. |
n_folds |
Number of cross-validation folds. Default is 5. |
split_ratio |
Split ratio between train and test set under sample splitting. Default is 0. |
ngates |
The number of groups to separate the data into. The groups are determined by tau. Default is 5. |
preProcess |
caret parameter |
weights |
caret parameter |
trControl |
caret parameter |
tuneGrid |
caret parameter |
tuneLength |
caret parameter |
user_model |
A user-defined function to create an ITR. The function should take the data as input and return a model to estimate the ITR. |
SL_library |
A list of machine learning algorithms to be used in the super learner. |
... |
Additional arguments passed to |
An object of itr
class
Evaluate ITR
evaluate_itr( fit = NULL, user_itr = NULL, outcome = c(), treatment = c(), data = list(), budget = 1, ngates = 5, ... )
evaluate_itr( fit = NULL, user_itr = NULL, outcome = c(), treatment = c(), data = list(), budget = 1, ngates = 5, ... )
fit |
Fitted model. Usually an output from |
user_itr |
A user-defined function to create an ITR. The function should take the data as input and return an unit-level continuous score for treatment assignment. We assume those that have score less than 0 should not have treatment. The default is |
outcome |
A character string of the outcome variable name. |
treatment |
A character string of the treatment variable name. |
data |
A data frame containing the variables specified in |
budget |
The maximum percentage of population that can be treated under the budget constraint. |
ngates |
The number of gates to use for the ITR. The default is 5.
A user-defined function to create an ITR. The function should take the data as input and return an ITR. The output is a vector of the unit-level binary treatment that would have been assigned by the individualized treatment rule. The default is |
... |
Further arguments passed to the function. |
An object of itr
class
Estimate ITR for Single Outcome
fit_itr(data, algorithms, params, folds, budget, user_model, ...)
fit_itr(data, algorithms, params, folds, budget, user_model, ...)
data |
A dataset. |
algorithms |
Machine learning algorithms. |
params |
A list of parameters. |
folds |
Number of folds. |
budget |
The maximum percentage of population that can be treated under the budget constraint. |
user_model |
User's own function to estimated the ITR. |
... |
Additional arguments passed to |
A list of estimates.
This function estimates the Grouped Average Treatment Effects (GATEs) where the groups are determined by a continuous score. The details of the methods for this design are given in Imai and Li (2022).
GATE(T, tau, Y, ngates = 5)
GATE(T, tau, Y, ngates = 5)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
tau |
A vector of the unit-level continuous score. Conditional Average Treatment Effect is one possible measure. |
Y |
A vector of the outcome variable of interest for each sample. |
ngates |
The number of groups to separate the data into. The groups are determined by |
A list that contains the following items:
gate |
The estimated
vector of GATEs of length |
sd |
The estimated vector of standard deviation of GATEs. |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2022). “Statistical Inference for Heterogeneous Treatment Effects Discovered by Generic Machine Learning in Randomized Experiments”,
T = c(1,0,1,0,1,0,1,0) tau = c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7) Y = c(4,5,0,2,4,1,-4,3) gatelist <- GATE(T,tau,Y,ngates=5) gatelist$gate gatelist$sd
T = c(1,0,1,0,1,0,1,0) tau = c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7) Y = c(4,5,0,2,4,1,-4,3) gatelist <- GATE(T,tau,Y,ngates=5) gatelist$gate gatelist$sd
This function estimates the Grouped Average Treatment Effects (GATEs) under cross-validation where the groups are determined by a continuous score. The details of the methods for this design are given in Imai and Li (2022).
GATEcv(T, tau, Y, ind, ngates = 5)
GATEcv(T, tau, Y, ind, ngates = 5)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
tau |
A matrix where the |
Y |
A vector of the outcome variable of interest for each sample. |
ind |
A vector of integers (between 1 and number of folds inclusive) indicating which testing set does each sample belong to. |
ngates |
The number of groups to separate the data into. The groups are determined by |
A list that contains the following items:
gate |
The estimated
vector of GATEs under cross-validation of length |
sd |
The estimated vector of standard deviation of GATEs under cross-validation. |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2022). “Statistical Inference for Heterogeneous Treatment Effects Discovered by Generic Machine Learning in Randomized Experiments”,
T = c(1,0,1,0,1,0,1,0) tau = matrix(c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9),nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) gatelist <- GATEcv(T, tau, Y, ind, ngates = 2) gatelist$gate gatelist$sd
T = c(1,0,1,0,1,0,1,0) tau = matrix(c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9),nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) gatelist <- GATEcv(T, tau, Y, ind, ngates = 2) gatelist$gate gatelist$sd
This function calculates statistics related to the test of heterogeneous treatment effects across groups.
het.test(T, tau, Y, ngates = 5)
het.test(T, tau, Y, ngates = 5)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
tau |
A vector of the unit-level continuous score. Conditional Average Treatment Effect is one possible measure. |
Y |
A vector of the outcome variable of interest for each sample. |
ngates |
The number of groups to separate the data into. The groups are determined by |
The details of the methods for this design are given in Imai and Li (2022).
A list that contains the following items:
stat |
The estimated statistic for the test of heterogeneity. |
pval |
The p-value of the null hypothesis (that the treatment effects are homogeneous) |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2022). “Statistical Inference for Heterogeneous Treatment Effects Discovered by Generic Machine Learning in Randomized Experiments”,
T = c(1,0,1,0,1,0,1,0) tau = c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7) Y = c(4,5,0,2,4,1,-4,3) hettestlist <- het.test(T,tau,Y,ngates=5) hettestlist$stat hettestlist$pval
T = c(1,0,1,0,1,0,1,0) tau = c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7) Y = c(4,5,0,2,4,1,-4,3) hettestlist <- het.test(T,tau,Y,ngates=5) hettestlist$stat hettestlist$pval
This function calculates statistics related to the test of heterogeneous treatment effects across groups under cross-validation.
hetcv.test(T, tau, Y, ind, ngates = 5)
hetcv.test(T, tau, Y, ind, ngates = 5)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
tau |
A vector of the unit-level continuous score. Conditional Average Treatment Effect is one possible measure. |
Y |
A vector of the outcome variable of interest for each sample. |
ind |
A vector of integers (between 1 and number of folds inclusive) indicating which testing set does each sample belong to. |
ngates |
The number of groups to separate the data into. The groups are determined by |
The details of the methods for this design are given in Imai and Li (2022).
A list that contains the following items:
stat |
The estimated statistic for the test of heterogeneity under cross-validation. |
pval |
The p-value of the null hypothesis (that the treatment effects are homogeneous) |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2022). “Statistical Inference for Heterogeneous Treatment Effects Discovered by Generic Machine Learning in Randomized Experiments”,
T = c(1,0,1,0,1,0,1,0) tau = matrix(c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9),nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) hettestlist <- hetcv.test(T,tau,Y,ind,ngates=2) hettestlist$stat hettestlist$pval
T = c(1,0,1,0,1,0,1,0) tau = matrix(c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9),nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) hettestlist <- hetcv.test(T,tau,Y,ind,ngates=2) hettestlist$stat hettestlist$pval
This function estimates the Population Average Prescription Difference with a budget constraint. The details of the methods for this design are given in Imai and Li (2019).
PAPD(T, Thatfp, Thatgp, Y, budget, centered = TRUE)
PAPD(T, Thatfp, Thatgp, Y, budget, centered = TRUE)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
Thatfp |
A vector of the unit-level binary treatment that would have been assigned by the first individualized treatment rule. Please ensure that the percentage of treatment units of That is lower than the budget constraint. |
Thatgp |
A vector of the unit-level binary treatment that would have been assigned by the second individualized treatment rule. Please ensure that the percentage of treatment units of That is lower than the budget constraint. |
Y |
A vector of the outcome variable of interest for each sample. |
budget |
The maximum percentage of population that can be treated under the budget constraint. Should be a decimal between 0 and 1. |
centered |
If |
A list that contains the following items:
papd |
The estimated Population Average Prescription Difference |
sd |
The estimated standard deviation of PAPD. |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2019). “Experimental Evaluation of Individualized Treatment Rules”,
T = c(1,0,1,0,1,0,1,0) That = c(0,1,1,0,0,1,1,0) That2 = c(1,0,0,1,1,0,0,1) Y = c(4,5,0,2,4,1,-4,3) papdlist <- PAPD(T,That,That2,Y,budget = 0.5) papdlist$papd papdlist$sd
T = c(1,0,1,0,1,0,1,0) That = c(0,1,1,0,0,1,1,0) That2 = c(1,0,0,1,1,0,0,1) Y = c(4,5,0,2,4,1,-4,3) papdlist <- PAPD(T,That,That2,Y,budget = 0.5) papdlist$papd papdlist$sd
This function estimates the Population Average Prescription Difference with a budget constaint under cross validation. The details of the methods for this design are given in Imai and Li (2019).
PAPDcv(T, Thatfp, Thatgp, Y, ind, budget, centered = TRUE)
PAPDcv(T, Thatfp, Thatgp, Y, ind, budget, centered = TRUE)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
Thatfp |
A matrix where the |
Thatgp |
A matrix where the |
Y |
The outcome variable of interest. |
ind |
A vector of integers (between 1 and number of folds inclusive) indicating which testing set does each sample belong to. |
budget |
The maximum percentage of population that can be treated under the budget constraint. Should be a decimal between 0 and 1. |
centered |
If |
A list that contains the following items:
papd |
The estimated Population Average Prescription Difference. |
sd |
The estimated standard deviation of PAPD. |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2019). “Experimental Evaluation of Individualized Treatment Rules”,
T = c(1,0,1,0,1,0,1,0) That = matrix(c(0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1), nrow = 8, ncol = 2) That2 = matrix(c(0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0), nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) papdlist <- PAPDcv(T, That, That2, Y, ind, budget = 0.5) papdlist$papd papdlist$sd
T = c(1,0,1,0,1,0,1,0) That = matrix(c(0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1), nrow = 8, ncol = 2) That2 = matrix(c(0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0), nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) papdlist <- PAPDcv(T, That, That2, Y, ind, budget = 0.5) papdlist$papd papdlist$sd
This function estimates the Population Average Prescription Effect with and without a budget constraint. The details of the methods for this design are given in Imai and Li (2019).
PAPE(T, That, Y, budget = NA, centered = TRUE)
PAPE(T, That, Y, budget = NA, centered = TRUE)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
That |
A vector of the unit-level binary treatment that would have been assigned by the
individualized treatment rule. If |
Y |
A vector of the outcome variable of interest for each sample. |
budget |
The maximum percentage of population that can be treated under the budget constraint. Should be a decimal between 0 and 1. Default is NA which assumes no budget constraint. |
centered |
If |
A list that contains the following items:
pape |
The estimated Population Average Prescription Effect. |
sd |
The estimated standard deviation of PAPE. |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2019). “Experimental Evaluation of Individualized Treatment Rules”,
T = c(1,0,1,0,1,0,1,0) That = c(0,1,1,0,0,1,1,0) Y = c(4,5,0,2,4,1,-4,3) papelist <- PAPE(T,That,Y) papelist$pape papelist$sd
T = c(1,0,1,0,1,0,1,0) That = c(0,1,1,0,0,1,1,0) Y = c(4,5,0,2,4,1,-4,3) papelist <- PAPE(T,That,Y) papelist$pape papelist$sd
This function estimates the Population Average Prescription Effect with and without a budget constraint. The details of the methods for this design are given in Imai and Li (2019).
PAPEcv(T, That, Y, ind, budget = NA, centered = TRUE)
PAPEcv(T, That, Y, ind, budget = NA, centered = TRUE)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
That |
A matrix where the |
Y |
The outcome variable of interest. |
ind |
A vector of integers (between 1 and number of folds inclusive) indicating which testing set does each sample belong to. |
budget |
The maximum percentage of population that can be treated under the budget constraint. Should be a decimal between 0 and 1. Default is NA which assumes no budget constraint. |
centered |
If |
A list that contains the following items:
pape |
The estimated Population Average Prescription Effect. |
sd |
The estimated standard deviation of PAPE. |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2019). “Experimental Evaluation of Individualized Treatment Rules”,
T = c(1,0,1,0,1,0,1,0) That = matrix(c(0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1), nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) papelist <- PAPEcv(T, That, Y, ind) papelist$pape papelist$sd
T = c(1,0,1,0,1,0,1,0) That = matrix(c(0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1), nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) papelist <- PAPEcv(T, That, Y, ind) papelist$pape papelist$sd
This function estimates the Population Average Value. The details of the methods for this design are given in Imai and Li (2019).
PAV(T, That, Y, centered = TRUE)
PAV(T, That, Y, centered = TRUE)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
That |
A vector of the unit-level binary treatment that would have been assigned by the
individualized treatment rule. If |
Y |
A vector of the outcome variable of interest for each sample. |
centered |
If |
A list that contains the following items:
pav |
The estimated Population Average Value. |
sd |
The estimated standard deviation of PAV. |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2019). “Experimental Evaluation of Individualized Treatment Rules”,
T = c(1,0,1,0,1,0,1,0) That = c(0,1,1,0,0,1,1,0) Y = c(4,5,0,2,4,1,-4,3) pavlist <- PAV(T,That,Y) pavlist$pav pavlist$sd
T = c(1,0,1,0,1,0,1,0) That = c(0,1,1,0,0,1,1,0) Y = c(4,5,0,2,4,1,-4,3) pavlist <- PAV(T,That,Y) pavlist$pav pavlist$sd
This function estimates the Population Average Value. The details of the methods for this design are given in Imai and Li (2019).
PAVcv(T, That, Y, ind, centered = TRUE)
PAVcv(T, That, Y, ind, centered = TRUE)
T |
A vector of the unit-level binary treatment receipt variable for each sample. |
That |
A matrix where the |
Y |
The outcome variable of interest. |
ind |
A vector of integers (between 1 and number of folds inclusive) indicating which testing set does each sample belong to. |
centered |
If |
A list that contains the following items:
pav |
The estimated Population Average Value. |
sd |
The estimated standard deviation of PAV. |
Michael Lingzhi Li, Technology and Operations Management, Harvard Business School [email protected], https://www.michaellz.com/;
Imai and Li (2019). “Experimental Evaluation of Individualized Treatment Rules”,
T = c(1,0,1,0,1,0,1,0) That = matrix(c(0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1), nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) pavlist <- PAVcv(T, That, Y, ind) pavlist$pav pavlist$sd
T = c(1,0,1,0,1,0,1,0) That = matrix(c(0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1), nrow = 8, ncol = 2) Y = c(4,5,0,2,4,1,-4,3) ind = c(rep(1,4),rep(2,4)) pavlist <- PAVcv(T, That, Y, ind) pavlist$pav pavlist$sd
Plot the GATE estimate
plot_estimate(x, type, ...)
plot_estimate(x, type, ...)
x |
An table object. This is typically an output of |
type |
The metric that you wish to plot. One of GATE, PAPE, PAPEp, or PAPDp. |
... |
Further arguments passed to the function. |
A plot of ggplot2 object.
Plot the AUPEC curve
## S3 method for class 'itr' plot(x, ...)
## S3 method for class 'itr' plot(x, ...)
x |
An object of |
... |
Further arguments passed to the function. |
A plot of ggplot2 object.
## S3 method for class 'summary.itr' print(x, ...)
## S3 method for class 'summary.itr' print(x, ...)
x |
An object of |
... |
Other parameters. Currently not supported. |
## S3 method for class 'summary.test_itr' print(x, ...)
## S3 method for class 'summary.test_itr' print(x, ...)
x |
An object of |
... |
Other parameters. |
A longitudinal study experimentally evaluating the impacts of class size in early education on various outcomes (Mosteller, 1995)
star
star
A data frame with 1911 observations and 14 variables:
A binary treatment indicating whether a student is assigned to small class and regular class without an aid
A continous variable measuring student's writing scores
A continous variable measuring student's reading scores
A continous variable measuring student's math scores
Students' gender
Students' race
Students' birth month
Students' birth year
Urban or rural
Enrollment size
Grade range
Number of students on free lunch
Number of students on school buses
Percentage of white students
Summarize estimate_itr output
## S3 method for class 'itr' summary(object, ...)
## S3 method for class 'itr' summary(object, ...)
object |
An object of |
... |
Other parameters. |
Summarize test_itr output
## S3 method for class 'test_itr' summary(object, ...)
## S3 method for class 'test_itr' summary(object, ...)
object |
An object of |
... |
Other parameters. |
Conduct hypothesis tests
test_itr(fit, nsim = 1000, ...)
test_itr(fit, nsim = 1000, ...)
fit |
Fitted model. Usually an output from |
nsim |
Number of Monte Carlo simulations used to simulate the null distributions. Default is 1000. |
... |
Further arguments passed to the function. |
An object of test_itr
class