Skip to main content
. Author manuscript; available in PMC: 2020 Aug 26.
Published in final edited form as: Am Polit Sci Rev. 2019 May 31;113(3):838–859. doi: 10.1017/s0003055419000194

TABLE 3.

A Procedure for Declaring and Diagnosing Research Designs Using the Companion Software DeclareDesign (Blair et al. 2018)

Design declaration Code

M{DeclarebackgroundvariablesDeclarefunctionalrelations p_U <-declare_population (N = 200, u = rnorm(N))
f_Y <- declare potential outcomes(Y ~Z + u)
I Declare inquiry I <- declare_estimand (ATE=mean(Y_Z_1 − Y_Z_0))
D{DeclaresamplingDeclareassignmentDeclareoutcomerevelation
p_S <-declare_sampling (n = 100)
p_Z <- declare_assignment (m = 50)
R <- declare_reveal (Y, Z)
A Declare answer strategy A <- declare estimator (Y ~Z, estimand = “ATE”)
Declare design, (M, I, D, A) design <- p_U + f_Y + I + p_S + p_Z + R + A

Design simulation (1 draw) Code

1 Draw a population u using P(U) u <- p_U()
2 Generate potential outcomes using fY D <- f_Y(u)
3 Calculate estimand aM a_M <- I(D)
4 Draw data, d, given model assumptions and data strategies d <- R(p_Z(p_S(D)))
5 Calculate answers, aA using A and d a_A <- A(d)
6 Calculate a diagnostic statistic t using aA and aM e <- a_A[“estimate”] — a_M[“estimand”]

Design diagnosis (m draws) Code

Declare a diagnosand bias <- declare_diagnosands(bias = mean(estimate − estimand))
Calculate a diagnosand diagnose_design(design_diagnosands = bias, sims = m)

Note: The top panel includes each element of a design that can be declared along with code used to declare them. The middle panel describes steps to simulate that design. The bottom panel includes the procedure to diagnose the design.