as.data.frame.gapclosing: Coerce to a Data Frame

Description Usage Arguments Value References Examples

View source: R/as.data.frame.gapclosing.R

Description

This function converts a gapclosing object into a data frame. The gapclosing class contains results within a named list, thus simplifying things for manual user interaction with the results. In some programming settings (e.g. a bootstrap), it is easier to work with a rectangular data frame of results. This function produces that data frame.

Usage

1
2
## S3 method for class 'gapclosing'
as.data.frame(x, ...)

Arguments

x

Object of class gapclosing, produced by a call to gapclosing().

...

Additional arguments to be passed to or from methods.

Value

A data frame containing estimates.

References

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/.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# 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)

gapclosing documentation built on Oct. 11, 2021, 9:07 a.m.