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
#> 1  design     ATE   adjusted       Y    Z mean_estimand  0.100000000
#> 2  design     ATE   adjusted       Y    Z mean_estimate  0.101733047
#> 3  design     ATE   adjusted       Y    Z          bias  0.001733047
#> 4  design     ATE   adjusted       Y    Z   sd_estimate  0.186361104
#> 5  design     ATE   adjusted       Y    Z          rmse  0.185435055
#> 6  design     ATE   adjusted       Y    Z         power  0.050000000
#> 7  design     ATE   adjusted       Y    Z      coverage  1.000000000
#> 8  design     ATE unadjusted       Y    Z mean_estimand  0.100000000
#> 9  design     ATE unadjusted       Y    Z mean_estimate  0.090097200
#> 10 design     ATE unadjusted       Y    Z          bias -0.009902800
#> 11 design     ATE unadjusted       Y    Z   sd_estimate  0.263237190
#> 12 design     ATE unadjusted       Y    Z          rmse  0.262104837
#> 13 design     ATE unadjusted       Y    Z         power  0.050000000
#> 14 design     ATE unadjusted       Y    Z      coverage  0.980000000
#>      std.error    conf.low  conf.high
#> 1  0.000000000  0.10000000 0.10000000
#> 2  0.018086283  0.07023091 0.13998336
#> 3  0.018086283 -0.02976909 0.03998336
#> 4  0.010255730  0.16576485 0.20527442
#> 5  0.009964692  0.16717757 0.20447557
#> 6  0.021508749  0.01475000 0.09000000
#> 7  0.000000000  1.00000000 1.00000000
#> 8  0.000000000  0.10000000 0.10000000
#> 9  0.025323990  0.03600417 0.13608792
#> 10 0.025323990 -0.06399583 0.03608792
#> 11 0.013593547  0.24039327 0.29207338
#> 12 0.013468443  0.24001494 0.29073641
#> 13 0.019928154  0.02000000 0.09525000
#> 14 0.012872333  0.95000000 1.00000000