declare_measurement: Declare measurement procedure

Description Usage Arguments Details Value Examples

Description

This function adds measured data columns that can be functions of unmeasured data columns.

Usage

1
2
3

Arguments

...

arguments to be captured, and later passed to the handler

handler

a tidy-in, tidy-out function

label

a string describing the step

data

A data.frame.

Details

It is also possible to include measured variables in your declare_population call or to add variables using declare_step. However, putting latent variables in declare_population and variables-as-measured in declare_measurement helps communicate which parts of your research design are in M and which parts are in D.

Value

A function that returns a data.frame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
design <-
  declare_model(N = 6,
                U = rnorm(N),
                potential_outcomes(Y ~ Z + U)) +
  declare_assignment(Z = complete_ra(N), legacy = FALSE) + 
  declare_measurement(Y = reveal_outcomes(Y ~ Z))

draw_data(design)


design <-
  declare_model(
    N = 6,
    U = rnorm(N),
    potential_outcomes(Y ~ Z1 + Z2 + U, 
                       conditions = list(Z1 = c(0, 1), Z2 = c(0, 1)))) +
  declare_assignment(Z1 = complete_ra(N), 
                     Z2 = block_ra(blocks = Z1),
                     legacy = FALSE) + 
  declare_measurement(Y = reveal_outcomes(Y ~ Z1 + Z2))

draw_data(design)

DeclareDesign documentation built on Feb. 15, 2021, 1:07 a.m.