expand_design: Declare a design via a designer

Description Usage Arguments Value Examples

View source: R/expand_design.R

Description

expand_design easily generates a set of design from a designer function.

Usage

1
expand_design(designer, ..., expand = TRUE, prefix = "design")

Arguments

designer

a function which yields a design

...

Options sent to the designer

expand

boolean - if true, form the crossproduct of the ..., otherwise recycle them

prefix

prefix for the names of the designs, i.e. if you create two designs they would be named prefix_1, prefix_2

Value

if set of designs is size one, the design, otherwise a 'by'-list of designs. Designs are given a parameters attribute with the values of parameters assigned by expand_design.

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
## Not run: 

# in conjunction with DesignLibrary

library(DesignLibrary)

designs <- expand_design(multi_arm_designer, outcome_means = list(c(3,2,4), c(1,4,1)))

# with a custom designer function

designer <- function(N) {
  pop <- declare_population(N = N, noise = rnorm(N))
  pos <- declare_potential_outcomes(Y ~ 0.20 * Z + noise)
  assgn <- declare_assignment(m = N / 2)
  mand <- declare_estimand(ATE = mean(Y_Z_1 - Y_Z_0))
  mator <- declare_estimator(Y ~ Z, estimand = mand)
  pop + pos + assgn + mand + mator
}

# returns list of eight designs
designs <- expand_design(designer, N = seq(30, 100, 10))

 # diagnose a list of designs created by expand_design or redesign
 diagnosis <- diagnose_design(designs, sims = 50)

# returns a single design
large_design <- expand_design(designer, N = 200)

 diagnose_large_design <- diagnose_design(large_design, sims = 50)

## End(Not run)

DeclareDesign/ddoldversion documentation built on Oct. 30, 2019, 5:17 p.m.