attach_config {tidyhte} | R Documentation |
Attach an HTE_cfg
to a dataframe
Description
This adds a configuration attribute to a dataframe for HTE estimation. This configuration details the full analysis of HTE that should be performed.
Usage
attach_config(data, .HTE_cfg)
Arguments
data |
dataframe |
.HTE_cfg |
|
Details
For information about how to set up an HTE_cfg
object, see the Recipe API
documentation basic_config()
.
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
basic_config()
, make_splits()
, produce_plugin_estimates()
,
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)
}
[Package tidyhte version 1.0.2 Index]