Task object for meta-learners in the point-treatment setting.
Source:R/hte3_Task_tx.R
make_hte3_Task_tx.RdConstructs a hte3_Task object for meta-learners in the point-treatment setting containing relevant data and nuisance function estimators.
Usage
make_hte3_Task_tx(
data,
modifiers,
confounders,
treatment,
outcome,
id = NULL,
weights = NULL,
treatment_type = c("default", "binomial", "categorical", "continuous"),
pi.hat = NULL,
mu.hat = NULL,
m.hat = NULL,
learner_pi = get_autoML(),
learner_mu = get_autoML(),
learner_m = NULL,
multinomial_learner = Lrnr_independent_binomial,
cross_fit_and_cv = TRUE,
folds = 10,
warn = TRUE,
for_prediction = FALSE,
...
)Arguments
- data
A named data frame or data.table containing treatment effect modifiers, potential confounders, treatment, and outcome. Optionally, the dataset can contain weights and subject IDs. See the
dataargument ofsl3_Taskfor further options.- modifiers
A character vector of variable names in
colnames(data)for treatment effect moderators.- confounders
A character vector of variable names in
colnames(data)for potential confoundersWfor which to adjust.- treatment
A character specifying the variable name in
colnames(data)for the numeric treatment assignmentA.- outcome
A character specifying the variable name in
colnames(data)for the outcome variableY.- id
An (optional) character specifying the variable name in
colnames(data)for observation IDs.- weights
An (optional) character specifying the variable name in
colnames(data)for observation weights.- pi.hat
An (optional) numeric matrix of dimension
n by nlevels(A)containing estimates of the propensity scorea -> pi(a | W_i)at each treatment level, where columnjcorresponds to treatment levelsort(unique(A))[j]. This argument can be used by DR-type learners. Alternatively, the estimates can be learned internally by passing ansl3_Learnerto thelearner_piargument.- mu.hat
An (optional) numeric matrix of dimension
n by nlevels(A)containing estimates of the outcome regressiona -> mu(a, W_i)at each treatment level, where columnjcorresponds to treatment levelsort(unique(A))[j]. This argument can be used by DR-type learners. Alternatively, the estimates can be learned internally by passing ansl3_Learnerto thelearner_margument.- m.hat
An (optional) numeric vector of size
ncontaining estimates of the conditional mean outcomeE[Y | W_i]. This argument can be used by R-type learners. Alternatively, the estimates can be learned internally by passing ansl3_Learnerto thelearner_margument.- learner_pi
A binomial
sl3_LearnerorStackobject specifying the learning algorithm to estimate the propensity scorew -> pi(a_star | w)at a given treatment levela_star. During training, this learner is passed ansl3_Taskobjecttaskthat contains a feature matrixtask$Xofconfoundersand an outcome vectortask$Ycorresponding to the binary treatment indicator1(A = a_star). By default,cross_fit_and_cv = TRUE, andlearner_mis fit with 10-fold cross-fitting usingmake_cross_fitted. If aStackobject, the best model is selected using cross-validation.- learner_mu
A
sl3_Learnerorsl3_Taskobject specifying the learning algorithm to estimate the outcome regressionw -> mu(a_star, w)at a given treatment levela_star. The outcome regression is estimated via a treatment-stratified regression. During training, this learner is passed ansl3_Taskobjecttaskthat is subsetted to variables with treatmentA = a_star, and contains a feature matrixtask$Xofconfoundersand an outcome vectortask$Ycorresponding tooutcome. By default,cross_fit_and_cv = TRUE, andlearner_mis fit with 10-fold cross-fitting usingmake_cross_fitted. If aStackobject, the best model is selected using cross-validation.- learner_m
A
sl3_Learnerorsl3_Taskobject specifying the learning algorithm to estimate the conditional mean outcomem. During training, this learner is passed ansl3_Taskobjecttaskthat contains a feature matrixtask$Xofconfoundersand an outcome vectortask$Ycorresponding tooutcome. By default,cross_fit_and_cv = TRUE, andlearner_mis fit with 10-fold cross-fitting usingmake_cross_fitted. If aStackobject, the best model is selected using cross-validation.- multinomial_learner
A
multinomialLrnr_baseobject to convertlearner_pifrom abinomiallearner to amultinomiallearner.- cross_fit_and_cv
Whether to cross-fit the specified nuisance learners by applying
learner <- make_cross_fitted(learner).- for_prediction
A
booleanof whether to return an hte3_Task without the nuisance training and estimates. This can be useful when you wish to construct a task for predicting on a new dataset.- ...
Additional arguments to pass to the
sl3_Taskandtmle_Taskconstructors.