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.103982049 0.01877121
#> 3  design     ATE   adjusted       Y    Z          bias 0.003982049 0.01877121
#> 4  design     ATE   adjusted       Y    Z   sd_estimate 0.199804329 0.01289401
#> 5  design     ATE   adjusted       Y    Z          rmse 0.198842674 0.01279584
#> 6  design     ATE   adjusted       Y    Z         power 0.090000000 0.03034798
#> 7  design     ATE   adjusted       Y    Z      coverage 0.950000000 0.02326483
#> 8  design     ATE unadjusted       Y    Z mean_estimand 0.100000000 0.00000000
#> 9  design     ATE unadjusted       Y    Z mean_estimate 0.150848272 0.02447191
#> 10 design     ATE unadjusted       Y    Z          bias 0.050848272 0.02447191
#> 11 design     ATE unadjusted       Y    Z   sd_estimate 0.268687220 0.01491275
#> 12 design     ATE unadjusted       Y    Z          rmse 0.272133130 0.01501576
#> 13 design     ATE unadjusted       Y    Z         power 0.100000000 0.02927473
#> 14 design     ATE unadjusted       Y    Z      coverage 0.970000000 0.01567472
#>         conf.low  conf.high
#> 1   0.1000000000 0.10000000
#> 2   0.0669666790 0.14072546
#> 3  -0.0330333210 0.04072546
#> 4   0.1749610721 0.22205651
#> 5   0.1746681345 0.22243013
#> 6   0.0400000000 0.16000000
#> 7   0.8947500000 0.98000000
#> 8   0.1000000000 0.10000000
#> 9   0.1006271142 0.19493708
#> 10  0.0006271142 0.09493708
#> 11  0.2377792115 0.29307036
#> 12  0.2405725992 0.29616441
#> 13  0.0400000000 0.15525000
#> 14  0.9347500000 1.00000000