post_design: Explore your design

Description Usage Arguments Examples

Description

Explore your design

Print code to recreate a design

Usage

1
2
3
4
5
6
7
print_code(design)

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

## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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), legacy = FALSE) +
  declare_inquiry(ATE = mean(Y_Z_1 - Y_Z_0)) +
  declare_assignment(Z = complete_ra(N, m = 25), legacy = FALSE) +
  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_inquiries(design)

print_code(design)


my_population <- declare_model(N = 100)

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

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), legacy = FALSE)

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

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 Feb. 15, 2021, 1:07 a.m.