Reveal Observed Outcomes

reveal_outcomes(data = NULL, outcome_variable_names = Y,
  assignment_variable_names = Z, attrition_variable_name = NULL,
  outcome_function = NULL)

Arguments

data

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

outcome_variable_names

The outcome prefix(es) of the potential outcomes

assignment_variable_names

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

attrition_variable_name

The bare (unquote) name of the attrition variable

outcome_function

If specified, reveal_outcomes draws outcomes using outcome_function rather than the switching equation.

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): my_population --------------------------------------------- #> #> N = 100 #> #> Added variable: ID #> N_missing N_unique #> 0 100 #> #> Added variable: noise #> min median mean max sd N_missing N_unique #> -3.36 0.07 0.00 3.36 1.11 0 100 #> #> Step 2 (potential outcomes): my_potential_outcomes ----------------------------- #> #> Added variable: Y_Z_0 #> min median mean max sd N_missing N_unique #> -3.36 0.07 0.00 3.36 1.11 0 100 #> #> Added variable: Y_Z_1 #> min median mean max sd N_missing N_unique #> -3.37 1.67 1.81 7.17 2.32 0 100 #> #> Step 3 (assignment): my_assignment --------------------------------------------- #> #> Added variable: Z #> 0 1 NA #> Frequency 50 50 0 #> Proportion 0.50 0.50 0.00 #> #> Added variable: Z_cond_prob #> 0.5 NA #> Frequency 100 0 #> Proportion 1.00 0.00 #> #> Step 4 (reveal outcomes): reveal_outcomes -------------------------------------- #> #> Added variable: Y #> min median mean max sd N_missing N_unique #> -3.37 0.45 0.97 7.17 2.02 0 100 #>