Skip to contents

Tidy extractor for fuzzydid objects.

Usage

# S3 method for class 'fuzzydid'
tidy(x, ...)

Arguments

x

A fuzzydid object.

...

Unused.

Value

A data frame with class "data.frame" and one row per available estimate or contrast. component identifies whether the row comes from the LATE table, equality-test table, or LQTE table. model and term label the estimator or contrast. estimate is the point estimate, while std.error, conf.low, and conf.high contain bootstrap uncertainty summaries when available and NA otherwise. If no estimates are available, an empty data frame with the same columns is returned.

Examples

make_example_cell <- function(g, t, ones, n_cell = 20L) {
  data.frame(
    g = rep.int(g, n_cell),
    t = rep.int(t, n_cell),
    d = c(rep.int(1L, ones), rep.int(0L, n_cell - ones))
  )
}

df <- rbind(
  make_example_cell(0L, 0L, 4L),
  make_example_cell(0L, 1L, 8L),
  make_example_cell(1L, 0L, 6L),
  make_example_cell(1L, 1L, 16L)
)
df$id <- seq_len(nrow(df))
df$y <- 1 + 0.5 * df$g + 0.4 * df$t + 2 * df$d + sin(df$id / 7)

fit <- fuzzydid(
  data = df[, c("y", "g", "t", "d")],
  formula = y ~ d,
  group = "g",
  time = "t",
  did = TRUE,
  nose = TRUE
)

generics::tidy(fit)
#>   component model  term estimate std.error conf.low conf.high
#> 1      late W_DID W_DID 3.225827        NA       NA        NA