Skip to contents

Given several variations of weights generated from a single Design, combine into a single weight.

Usage

# S4 method for class 'WeightedDesign'
c(x, ..., warn_dichotomy_not_equal = FALSE)

Arguments

x,

.. a WeightedDesign object, typically created from ate() or ett()

...

any number of additional WeightedDesign objects with equivalent Design to x and eachother

warn_dichotomy_not_equal

if FALSE (default), WeightedDesigns are considered equivalent even if their dichotomy differs. If TRUE, a warning is produced.

Value

A numeric vector with the weights concatenated in the input order.

Details

Concatenating WeightedDesign objects with c() requires both individual WeightedDesign objects to come from the same Design and have the same target (e.g all created with ate() or all created with ett(), no mixing-and-matching). All arguments to c() must be WeightedDesign.

WeightedDesign objects may be concatenated together even without having the same @dichotomy slot. This procedure only prompts a warning for differing dichotomies if the argument warn_dichotomy_not_equal is set to TRUE.

Examples

data(simdata)
des <- rct_design(z ~ unit_of_assignment(uoa1, uoa2), data = simdata)
w1 <- ate(des, data = simdata[1:30,])
w2 <- ate(des, data = simdata[31:40,])
w3 <- ate(des, data = simdata[41:50,])
c_w <- c(w1, w2, w3)
c(length(w1), length(w2), length(w3), length(c_w))
#> [1] 30 10 10 50

des <- rct_design(dose ~ unit_of_assignment(uoa1, uoa2), data = simdata)
w1 <- ate(des, data = simdata[1:10, ], dichotomy = dose >= 300 ~ .)
w2 <- ate(des, data = simdata[11:30, ], dichotomy = dose >= 200 ~ .)
w3 <- ate(des, data = simdata[31:50, ], dichotomy = dose >= 100 ~ .)
c_w <- c(w1, w2, w3)