produce_plugin_estimates {tidyhte} | R Documentation |
Estimate models of nuisance functions
Description
This takes a dataset with an identified outcome and treatment column along
with any number of covariates and appends three columns to the dataset corresponding
to an estimate of the conditional expectation of treatment (.pi_hat
), along with the
conditional expectation of the control and treatment potential outcome surfaces
(.mu0_hat
and .mu1_hat
respectively).
Usage
produce_plugin_estimates(data, outcome, treatment, ..., .weights = NULL)
Arguments
data |
dataframe (already prepared with |
outcome |
Unquoted name of the outcome variable. |
treatment |
Unquoted name of the treatment variable. |
... |
Unquoted names of covariates to include in the models of the nuisance functions. |
.weights |
Unquoted name of weights column. If NULL, all analysis will assume weights are all equal to one and sample-based quantities will be returned. |
Details
To see an example analysis, read vignette("experimental_analysis")
in the context
of an experiment, vignette("experimental_analysis")
for an observational study, or
vignette("methodological_details")
for a deeper dive under the hood.
See Also
attach_config()
, make_splits()
, construct_pseudo_outcomes()
, estimate_QoI()
Examples
library("dplyr")
if(require("palmerpenguins")) {
data(package = 'palmerpenguins')
penguins$unitid = seq_len(nrow(penguins))
penguins$propensity = rep(0.5, nrow(penguins))
penguins$treatment = rbinom(nrow(penguins), 1, penguins$propensity)
cfg <- basic_config() %>%
add_known_propensity_score("propensity") %>%
add_outcome_model("SL.glm.interaction") %>%
remove_vimp()
attach_config(penguins, cfg) %>%
make_splits(unitid, .num_splits = 4) %>%
produce_plugin_estimates(outcome = body_mass_g, treatment = treatment, species, sex) %>%
construct_pseudo_outcomes(body_mass_g, treatment) %>%
estimate_QoI(species, sex)
}