Convert a Design
between a observational study, a
randomized control trial, and a regression discontinuity (created from
obs_design()
, rct_design()
and rd_design()
respectively).
Usage
as_rct_design(Design, ..., loseforcing = FALSE)
as_obs_design(Design, ..., loseforcing = FALSE)
as_rd_design(Design, data, ..., forcing)
Arguments
- Design
a
Design
to convert- ...
Ignored.
- loseforcing
converting from RD to another
Design
type will error to avoid losing the forcing variable. Settingloseforcing = TRUE
allows the conversion to automatically drop the forcing variable. DefaultFALSE
.- data
converting to an RD requires adding a
forcing
variable, which requires access to the original data.- forcing
converting to an RD requires adding a
forcing
variable. This should be entered as a formula which would be passed toupdate()
, e.g.forcing = . ~ . + forcing(forcevar)
.
Examples
des <- rct_design(z ~ unit_of_assignment(uoa1, uoa2), data = simdata)
des
#> Randomized Control Trial
#>
#> Structure Variables
#> --------- ---------
#> Treatment z
#> Unit of Assignment uoa1, uoa2
#>
as_obs_design(des)
#> Observational Study
#>
#> Structure Variables
#> --------- ---------
#> Treatment z
#> Unit of Assignment uoa1, uoa2
#>
as_rd_design(des, simdata, forcing = ~ . + forcing(force))
#> Regression Discontinuity Design
#>
#> Structure Variables
#> --------- ---------
#> Treatment z
#> Unit of Assignment uoa1, uoa2
#> Forcing force
#>
des2 <- rd_design(o ~ uoa(uoa1, uoa2) + forcing(force), data = simdata)
des2
#> Regression Discontinuity Design
#>
#> Structure Variables
#> --------- ---------
#> Treatment o
#> Unit of Assignment uoa1, uoa2
#> Forcing force
#>
# as_rct_design(des2) # this will produce an error
as_rct_design(des2, loseforcing = TRUE)
#> Randomized Control Trial
#>
#> Structure Variables
#> --------- ---------
#> Treatment o
#> Unit of Assignment uoa1, uoa2
#>