Skip to contents

Tidy diagnosis

Usage

# S3 method for class 'diagnosis'
tidy(x, conf.int = TRUE, conf.level = 0.95, ...)

Arguments

x

A diagnosis object generated by diagnose_design.

conf.int

Logical indicating whether or not to include a confidence interval in the tidied output. Defaults to ‘TRUE’.

conf.level

The confidence level to use for the confidence interval if ‘conf.int = TRUE’. Must be strictly greater than 0 and less than 1. Defaults to 0.95, which corresponds to a 95 percent confidence interval.

...

extra arguments (not used)

Value

A data.frame with columns for diagnosand names, estimated diagnosand values, bootstrapped standard errors and confidence intervals

Examples


effect_size <- 0.1
design <-
  declare_model(
    N = 100,
    U = rnorm(N),
    X = rnorm(N),
    potential_outcomes(Y ~ effect_size * Z + X + U)
  ) +
  declare_inquiry(ATE = mean(Y_Z_1 - Y_Z_0)) +
  declare_assignment(Z = complete_ra(N)) +
  declare_measurement(Y = reveal_outcomes(Y ~ Z)) +
  declare_estimator(Y ~ Z, inquiry = "ATE", label = "unadjusted") + 
  declare_estimator(Y ~ Z + X, inquiry = "ATE", label = "adjusted")

diagnosis <- diagnose_design(design, sims = 100)

tidy(diagnosis)
#>    design inquiry  estimator outcome term    diagnosand    estimate  std.error
#> 1  design     ATE   adjusted       Y    Z mean_estimand 0.100000000 0.00000000
#> 2  design     ATE   adjusted       Y    Z mean_estimate 0.106847268 0.02032314
#> 3  design     ATE   adjusted       Y    Z          bias 0.006847268 0.02032314
#> 4  design     ATE   adjusted       Y    Z   sd_estimate 0.192082695 0.01165459
#> 5  design     ATE   adjusted       Y    Z          rmse 0.191242488 0.01166300
#> 6  design     ATE   adjusted       Y    Z         power 0.080000000 0.02402356
#> 7  design     ATE   adjusted       Y    Z      coverage 0.980000000 0.01383014
#> 8  design     ATE unadjusted       Y    Z mean_estimand 0.100000000 0.00000000
#> 9  design     ATE unadjusted       Y    Z mean_estimate 0.123325022 0.02402709
#> 10 design     ATE unadjusted       Y    Z          bias 0.023325022 0.02402709
#> 11 design     ATE unadjusted       Y    Z   sd_estimate 0.246169931 0.01727510
#> 12 design     ATE unadjusted       Y    Z          rmse 0.246044092 0.01748903
#> 13 design     ATE unadjusted       Y    Z         power 0.040000000 0.01695955
#> 14 design     ATE unadjusted       Y    Z      coverage 0.960000000 0.01735081
#>       conf.low  conf.high
#> 1   0.10000000 0.10000000
#> 2   0.06332808 0.13999793
#> 3  -0.03667192 0.03999793
#> 4   0.17005939 0.21190144
#> 5   0.17022372 0.21499107
#> 6   0.04000000 0.13000000
#> 7   0.95000000 1.00000000
#> 8   0.10000000 0.10000000
#> 9   0.07724880 0.16584713
#> 10 -0.02275120 0.06584713
#> 11  0.20996366 0.27563946
#> 12  0.20948968 0.27517201
#> 13  0.01000000 0.07000000
#> 14  0.93000000 0.99000000