as.data.frame.gapclosing {gapclosing}R Documentation

Coerce to a Data Frame

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

## 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

# 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)

[Package gapclosing version 1.0.2 Index]