post_design: Explore your design

post_designR Documentation

Explore your design

Description

Explore your design

Print code to recreate a design

Usage

print_code(design)

## S3 method for class 'design'
print(x, verbose = FALSE, ...)

## S3 method for class 'design'
summary(object, verbose = TRUE, ...)

Arguments

design

A design object, typically created using the + operator

x

a design object, typically created using the + operator

verbose

an indicator for printing a long summary of the design, defaults to TRUE

...

optional arguments to be sent to summary function

object

a design object created using the + operator

Examples


design <-
  declare_model(
    N = 500, 
    U = rnorm(N),
    potential_outcomes(Y ~ U + Z * rnorm(N, 2, 2))
  ) +
  declare_sampling(S = complete_rs(N, n = 250)) +
  declare_inquiry(ATE = mean(Y_Z_1 - Y_Z_0)) +
  declare_assignment(Z = complete_ra(N, m = 25)) +
  declare_measurement(Y = reveal_outcomes(Y ~ Z)) +
  declare_estimator(Y ~ Z, inquiry = "my_inquiry")

design

df <- draw_data(design)

estimates <- draw_estimates(design)
inquiries <- draw_estimands(design)

print_code(design)


my_population <- declare_model(N = 100)

my_assignment <- declare_assignment(Z = complete_ra(N, m = 50))

my_design <- my_population + my_assignment

print_code(my_design)


my_model <- 
  declare_model(
    N = 500, 
    noise = rnorm(N),
    Y_Z_0 = noise, 
    Y_Z_1 = noise + rnorm(N, mean = 2, sd = 2)
  )

my_sampling <- declare_sampling(S = complete_rs(N, n = 250))

my_assignment <- declare_assignment(Z = complete_ra(N, m = 25))

my_inquiry <- declare_inquiry(ATE = mean(Y_Z_1 - Y_Z_0))

my_estimator <- declare_estimator(Y ~ Z, inquiry = my_inquiry)

my_reveal <- declare_measurement(Y = reveal_outcomes(Y ~ Z))

design <- my_model +
  my_sampling +
  my_inquiry +
  my_assignment +
  my_reveal +
  my_estimator

summary(design)

DeclareDesign documentation built on June 21, 2022, 1:05 a.m.