dropout_manual: Manually specify dropout per time point

View source: R/missing_data.R

dropout_manualR Documentation

Manually specify dropout per time point

Description

Used as input to the dropout-argument in study_parameters.

Usage

dropout_manual(...)

Arguments

...

The proportion of dropout per time point, either as a vector of length n1, or n1 individual numeric arguments, see Details.

Details

Specifying dropout manually requires that the dropout is 0 at the first time point. Moreover, dropout can't decrease over time and can never be 1.

Value

A list of class plcp_dropout_manual

See Also

dropout_weibull, per_treatment

Examples

dropout <- dropout_manual(0, 0, 0, 0, 0.2, 0.2, 0.3, 0.3, 0.4, 0.4, 0.45)

p <- study_parameters(n1 = 11,
                      n2 = 5,
                      n3 = 6,
                      T_end = 10,
                      icc_pre_subject = 0.5,
                      icc_pre_cluster = 0,
                      var_ratio = 0.03,
                      icc_slope = 0.05,
                      dropout = dropout,
                      cohend = -0.8)
plot(p, plot = 2)
get_power(p)

# Can also use a vector as input
dropout <- dropout_manual(seq(0, 0.5, length.out = 11))
p <- study_parameters(n1 = 11,
                      n2 = 5,
                      n3 = 6,
                      T_end = 10,
                      icc_pre_subject = 0.5,
                      icc_pre_cluster = 0,
                      var_ratio = 0.03,
                      icc_slope = 0.05,
                      dropout = dropout,
                      cohend = -0.8)
plot(p, plot = 2)
get_power(p)

## Not run: 
# Decreasing dropout will throw an error
dropout_manual(0, 0.1, 0.1, 0.2, 0.1)

# Dropout at the first time point will throw an error
dropout_manual(0.1, 0.1, 0.1, 0.2, 0.2)

## End(Not run)

rpsychologist/powerlmm documentation built on May 11, 2023, 12:24 a.m.