Declare Diagnosands

declare_diagnosands(...)

Arguments

...

A set of diagnosands, i.e. bias = mean(est - estimand). The diagnostic statistic (i.e., est - estimand) and its associated summary function (i.e., mean) are declared at the same time.

Value

a function that returns a data.frame

Details

Diagnosands summarize the simulations generated by diagnose_design. Typically, the columns of the resulting simulations data.frame include the following variables: est, se, p, ci_lower, ci_upper, and estimand. Most diagnosands will be some function of these variables.

If you do not specify a particular set of diagnosands, the following diagnosands will be reported by default:

bias = mean(est - estimand) rmse = sqrt(mean((est - estimand)^2)) power = mean(p < .05) coverage = mean(estimand <= ci_upper & estimand >= ci_lower) mean_estimate = mean(est) sd_estimate = sd(est) type_s_rate = mean((sign(est) != sign(estimand)) & p < .05) mean_estimand = mean(estimand)

Examples

my_population <- declare_population(N = 500, noise = rnorm(N)) my_potential_outcomes <- declare_potential_outcomes( Y_Z_0 = noise, Y_Z_1 = noise + rnorm(N, mean = 2, sd = 2)) my_assignment <- declare_assignment() my_estimand <- declare_estimand(ATE = mean(Y_Z_1 - Y_Z_0)) my_estimator <- declare_estimator(Y ~ Z, estimand = my_estimand) design <- declare_design(my_population, my_potential_outcomes, my_estimand, my_assignment, reveal_outcomes, my_estimator) # using built-in defaults: diagnosis <- diagnose_design(design) diagnosis
#> #> Research design diagnosis #> #> Estimand Label Estimator Label Bias Rmse Power Coverage #> ATE my_estimator 0.002997595 0.129554 1 0.978 #> Mean Estimate Sd Estimate Type S Rate Mean Estimand #> 2.005587 0.1583157 0 2.002589 #>
# using a user-defined diagnosand my_diagnosand <- declare_diagnosands(absolute_error = mean(abs(est - estimand))) diagnosis <- diagnose_design(design, diagnosands = my_diagnosand) diagnosis
#> #> Research design diagnosis #> #> Estimand Label Estimator Label Absolute Error #> ATE my_estimator 0.1062624 #>
# this is the code that makes the default diagnsoands. # Use these as a model when writing your own diagnosands. default_diagnosands <- declare_diagnosands( bias = mean(est - estimand), rmse = sqrt(mean((est - estimand)^2)), power = mean(p < .05), coverage = mean(estimand <= ci_upper & estimand >= ci_lower), mean_estimate = mean(est), sd_estimate = sd(est), type_s_rate = mean((sign(est) != sign(estimand)) & p < .05), mean_estimand = mean(estimand))