Take a diagnosis object and returns a pretty output table. If diagnosands are bootstrapped, se's are put in parentheses on a second line and rounded to digits.

reshape_diagnosis(diagnosis, digits = 2, select = NULL, exclude = NULL)

Arguments

diagnosis

A diagnosis object generated by diagnose_design.

digits

Number of digits.

select

List of columns to include in output. Defaults to all.

exclude

Set of columns to exclude from output. Defaults to none.

Value

A formatted text table with bootstrapped standard errors in parentheses.

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)

reshape_diagnosis(diagnosis)
#>   Design Inquiry  Estimator Term N Sims Mean Estimand Mean Estimate   Bias
#> 1 design     ATE   adjusted    Z    100          0.10          0.09  -0.01
#> 2                                              (0.00)        (0.02) (0.02)
#> 3 design     ATE unadjusted    Z    100          0.10          0.09  -0.01
#> 4                                              (0.00)        (0.03) (0.03)
#>   SD Estimate   RMSE  Power Coverage
#> 1        0.21   0.21   0.08     0.95
#> 2      (0.01) (0.01) (0.03)   (0.02)
#> 3        0.28   0.28   0.08     0.95
#> 4      (0.02) (0.02) (0.03)   (0.02)

reshape_diagnosis(diagnosis, select = c("Bias", "Power"))
#>   Design Inquiry  Estimator Term N Sims   Bias  Power
#> 1 design     ATE   adjusted    Z    100  -0.01   0.08
#> 2                                       (0.02) (0.03)
#> 3 design     ATE unadjusted    Z    100  -0.01   0.08
#> 4                                       (0.03) (0.03)