reshape_diagnosis: Clean up a diagnosis object for printing

View source: R/diagnosis_helper_functions.R

reshape_diagnosisR Documentation

Clean up a diagnosis object for printing

Description

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.

Usage

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)

reshape_diagnosis(diagnosis, select = c("Bias", "Power"))

DeclareDesign documentation built on June 21, 2022, 1:05 a.m.