Explore your design

# S3 method for design
summary(object, ...)

draw_data(design)

get_estimates(design)

get_estimands(design)

Arguments

object

a design object created by declare_design

...

optional arguments to be sent to summary function

design

A design created by declare_design.

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_sampling <- declare_sampling(n = 250) my_assignment <- declare_assignment(m = 25) 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_sampling, my_estimand, dplyr::mutate(noise_sq = noise^2), my_assignment, reveal_outcomes, my_estimator) summary(design)
#> #> Design Summary #> #> Step 1 (population): declare_population(N = 500, noise = rnorm(N)) ------------- #> #> N = 500 #> #> Added variable: ID #> N_missing N_unique class #> 0 500 character #> #> Added variable: noise #> min median mean max sd N_missing N_unique #> -3.17 -0.04 -0.01 3.59 1 0 500 #> #> 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 #> -3.17 -0.04 -0.01 3.59 1 0 500 #> #> Added variable: Y_Z_1 #> min median mean max sd N_missing N_unique #> -4.87 1.79 1.79 8.95 2.22 0 500 #> #> Step 3 (sampling): declare_sampling(n = 250) ----------------------------------- #> #> N = 250 (250 subtracted) #> #> Added variable: S_inclusion_prob #> 0.5 #> 250 #> 1.00 #> #> Altered variable: ID #> Before: #> N_missing N_unique class #> 0 500 character #> #> After: #> N_missing N_unique class #> 0 250 character #> #> Altered variable: noise #> Before: #> min median mean max sd N_missing N_unique #> -3.17 -0.04 -0.01 3.59 1 0 500 #> #> After: #> min median mean max sd N_missing N_unique #> -2.62 -0.06 0.03 2.76 0.98 0 250 #> #> Altered variable: Y_Z_0 #> Before: #> min median mean max sd N_missing N_unique #> -3.17 -0.04 -0.01 3.59 1 0 500 #> #> After: #> min median mean max sd N_missing N_unique #> -2.62 -0.06 0.03 2.76 0.98 0 250 #> #> Altered variable: Y_Z_1 #> Before: #> min median mean max sd N_missing N_unique #> -4.87 1.79 1.79 8.95 2.22 0 500 #> #> After: #> min median mean max sd N_missing N_unique #> -4.87 1.92 1.79 8.46 2.22 0 250 #> #> Step 4 (estimand): declare_estimand(ATE = mean(Y_Z_1 - Y_Z_0)) ----------------- #> #> A single draw of the estimand: #> estimand_label estimand #> ATE 1.764987 #> #> Step 5 (wrapped): ~dplyr::mutate(noise_sq = noise^2) --------------------------- #> #> Added variable: noise_sq #> min median mean max sd N_missing N_unique #> 0 0.44 0.96 7.64 1.39 0 250 #> #> Step 6 (assignment): declare_assignment(m = 25) -------------------------------- #> #> Added variable: Z #> 0 1 #> 225 25 #> 0.90 0.10 #> #> Added variable: Z_cond_prob #> 0.1 0.9 #> 25 225 #> 0.10 0.90 #> #> Step 7 (reveal outcomes): reveal_outcomes() ------------------------------------ #> #> Added variable: Y #> min median mean max sd N_missing N_unique #> -3.85 -0.02 0.16 6.6 1.33 0 250 #> #> Step 8 (estimator): declare_estimator(Y ~ Z, estimand = my_estimand) ----------- #> #> Formula: Y ~ Z #> #> A single draw of the estimator: #> estimator_label coefficient_name est se p ci_lower #> my_estimator Z 1.481748 0.5438306 0.01164498 0.3610407 #> ci_upper estimand_label #> 2.602455 ATE #>
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_sampling <- declare_sampling(n = 250) my_assignment <- declare_assignment(m = 25) 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_sampling, my_estimand, dplyr::mutate(noise_sq = noise^2), my_assignment, reveal_outcomes, my_estimator) design
#> #> Design Summary #> #> Step 1 (population): declare_population(N = 500, noise = rnorm(N)) ------------- #> #> N = 500 #> #> Added variable: ID #> N_missing N_unique class #> 0 500 character #> #> Added variable: noise #> min median mean max sd N_missing N_unique #> -3.4 -0.02 0 3.13 0.99 0 500 #> #> 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 #> -3.4 -0.02 0 3.13 0.99 0 500 #> #> Added variable: Y_Z_1 #> min median mean max sd N_missing N_unique #> -4.38 2.06 2.03 7.88 2.14 0 500 #> #> Step 3 (sampling): declare_sampling(n = 250) ----------------------------------- #> #> N = 250 (250 subtracted) #> #> Added variable: S_inclusion_prob #> 0.5 #> 250 #> 1.00 #> #> Altered variable: ID #> Before: #> N_missing N_unique class #> 0 500 character #> #> After: #> N_missing N_unique class #> 0 250 character #> #> Altered variable: noise #> Before: #> min median mean max sd N_missing N_unique #> -3.4 -0.02 0 3.13 0.99 0 500 #> #> After: #> min median mean max sd N_missing N_unique #> -3.4 0 0.01 3.13 1.04 0 250 #> #> Altered variable: Y_Z_0 #> Before: #> min median mean max sd N_missing N_unique #> -3.4 -0.02 0 3.13 0.99 0 500 #> #> After: #> min median mean max sd N_missing N_unique #> -3.4 0 0.01 3.13 1.04 0 250 #> #> Altered variable: Y_Z_1 #> Before: #> min median mean max sd N_missing N_unique #> -4.38 2.06 2.03 7.88 2.14 0 500 #> #> After: #> min median mean max sd N_missing N_unique #> -3.3 2.15 2.15 7.88 2.11 0 250 #> #> Step 4 (estimand): declare_estimand(ATE = mean(Y_Z_1 - Y_Z_0)) ----------------- #> #> A single draw of the estimand: #> estimand_label estimand #> ATE 2.137114 #> #> Step 5 (wrapped): ~dplyr::mutate(noise_sq = noise^2) --------------------------- #> #> Added variable: noise_sq #> min median mean max sd N_missing N_unique #> 0 0.45 1.09 11.59 1.64 0 250 #> #> Step 6 (assignment): declare_assignment(m = 25) -------------------------------- #> #> Added variable: Z #> 0 1 #> 225 25 #> 0.90 0.10 #> #> Added variable: Z_cond_prob #> 0.1 0.9 #> 25 225 #> 0.10 0.90 #> #> Step 7 (reveal outcomes): reveal_outcomes() ------------------------------------ #> #> Added variable: Y #> min median mean max sd N_missing N_unique #> -3.4 0.13 0.24 5.73 1.37 0 250 #> #> Step 8 (estimator): declare_estimator(Y ~ Z, estimand = my_estimand) ----------- #> #> Formula: Y ~ Z #> #> A single draw of the estimator: #> estimator_label coefficient_name est se p ci_lower #> my_estimator Z 2.17774 0.4367293 3.746964e-05 1.27879 #> ci_upper estimand_label #> 3.07669 ATE #>
df <- draw_data(design) estimates <- get_estimates(design) estimands <- get_estimands(design)