Declare a Reveal Outcomes step

declare_reveal(..., handler = reveal_outcomes, label = NULL)

reveal_outcomes(data = NULL, outcome_variables = Y,
  assignment_variables = Z, attrition_variables = NULL)

Arguments

...

arguments for the handler

handler

a handler function

label

a step label

data

A data.frame containing columns of potential outcomes and an assignment variable

outcome_variables

The outcome prefix(es) of the potential outcomes

assignment_variables

The bare (unquote) name(s) of the assignment variable

attrition_variables

The bare (unquote) name of the attrition variable

Details

Typically, a design includes a potential outcomes declaration and an assignment declaration. Reveal outcomes uses the random assignment to pluck out the correct potential outcomes. This is analogous to the "switching equation" (Gerber and Green 2012, Chapter 2).

Examples

my_population <- declare_population(N = 100, 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(m = 50) design <- declare_design(my_population, my_potential_outcomes, my_assignment, reveal_outcomes) design
#> #> Design Summary #> #> Step 1 (population): declare_population(N = 100, noise = rnorm(N)) ------------- #> #> N = 100 #> #> Added variable: ID #> N_missing N_unique class #> 0 100 character #> #> Added variable: noise #> min median mean max sd N_missing N_unique #> -2.09 0.09 -0.03 2.43 0.93 0 100 #> #> Step 2 (potential outcomes): declare_potential_outcomes(Y_Z_0 = noise, Y_Z_1 = noise + rnorm(N, mean = 2, sd = 2)) #> #> Added variable: Y_Z_0 #> min median mean max sd N_missing N_unique #> -2.09 0.09 -0.03 2.43 0.93 0 100 #> #> Added variable: Y_Z_1 #> min median mean max sd N_missing N_unique #> -3.46 1.94 2.01 8.27 2.26 0 100 #> #> Step 3 (assignment): declare_assignment(m = 50) -------------------------------- #> #> Added variable: Z #> 0 1 #> 50 50 #> 0.50 0.50 #> #> Added variable: Z_cond_prob #> 0.5 #> 100 #> 1.00 #> #> Step 4 (reveal outcomes): reveal_outcomes() ------------------------------------ #> #> Added variable: Y #> min median mean max sd N_missing N_unique #> -3.46 0.43 0.95 6.89 2.09 0 100 #>