If the user has used
as.data.frame(x) to convert a
gapclosing object to a data frame of estimates, this function will invert back to the original list format. This function does not fully reinstate the original gapclosing object because some elements are lost when
as.data.frame() is called. This function is most useful as a check on
as.data.frame() and as a helper in settings like bootstrapping where a data frame is easier to work with but we want to return to the original format before returning an object to the user.
A data frame produced by
A list containing a subset of the elements in a
Lundberg I (2021). "The gap-closing estimand: A causal approach to study interventions that close disparities across social categories." Sociological Methods and Research. Available at https://osf.io/gx4y3/.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# Simulate example data simulated_data <- generate_simulated_data(n = 100) # Fit by outcome modeling estimate <- gapclosing( data = simulated_data, outcome_formula = formula(outcome ~ treatment * category + confounder), treatment_name = "treatment", category_name = "category", counterfactual_assignments = 1 ) summary(estimate) # Convert to a data frame estimate.df <- as.data.frame(estimate) # Convert back to a list estimate.df <- df_to_gapclosing_list(estimate.df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.