Skip to contents

Tidy diagnosis

Usage

# S3 method for 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.10000000 0.00000000
#> 2  design     ATE   adjusted       Y    Z mean_estimate  0.08784819 0.01965011
#> 3  design     ATE   adjusted       Y    Z          bias -0.01215181 0.01965011
#> 4  design     ATE   adjusted       Y    Z   sd_estimate  0.19344932 0.01023594
#> 5  design     ATE   adjusted       Y    Z          rmse  0.19286285 0.01028401
#> 6  design     ATE   adjusted       Y    Z         power  0.04000000 0.01715379
#> 7  design     ATE   adjusted       Y    Z      coverage  0.98000000 0.01462114
#> 8  design     ATE unadjusted       Y    Z mean_estimand  0.10000000 0.00000000
#> 9  design     ATE unadjusted       Y    Z mean_estimate  0.11383758 0.02750359
#> 10 design     ATE unadjusted       Y    Z          bias  0.01383758 0.02750359
#> 11 design     ATE unadjusted       Y    Z   sd_estimate  0.26628644 0.01822501
#> 12 design     ATE unadjusted       Y    Z          rmse  0.26531276 0.01783680
#> 13 design     ATE unadjusted       Y    Z         power  0.05000000 0.01845989
#> 14 design     ATE unadjusted       Y    Z      coverage  0.97000000 0.01520068
#>       conf.low  conf.high
#> 1   0.10000000 0.10000000
#> 2   0.05727377 0.12455532
#> 3  -0.04272623 0.02455532
#> 4   0.17300388 0.21154875
#> 5   0.17296243 0.21213197
#> 6   0.00475000 0.07000000
#> 7   0.94475000 1.00000000
#> 8   0.10000000 0.10000000
#> 9   0.06096946 0.16917737
#> 10 -0.03903054 0.06917737
#> 11  0.23108192 0.29944747
#> 12  0.22999362 0.29959583
#> 13  0.02000000 0.08525000
#> 14  0.94000000 1.00000000