srtAddIntervention {epts} | R Documentation |
Add a New Intervention Group to Simple Randomized Trial (SRT) Data
Description
This function adds a new intervention group to an existing SRT dataset by generating new participant-level data.
Usage
srtAddIntervention(
existing_data,
np,
es,
attritionrate,
outcome,
interventions,
id,
continuous_covariates,
categorical_covariates
)
Arguments
existing_data |
A data frame containing the variables including outcome, predictors, the clustering variable, and the intervention for CRT design. |
np |
The number of new participants to generate for the new intervention group. |
es |
The standardized effect size for the new intervention group. |
attritionrate |
The proportion of pupils in the new group to drop due to attrition. |
outcome |
A string specifying the name of the column containing outcome variable (post-test scores). |
interventions |
A string specifying the name of the intervention assignment column. |
id |
A string specifying the name of the participant ID column. |
continuous_covariates |
A character vector specifying the names of continuous covariates. |
categorical_covariates |
A character vector specifying the names of categorical covariates (converted to factors). |
Value
A data.frame
combining the original dataset with the newly simulated intervention group.
Examples
data(srt4armSimData)
new_srt5armData <- srtAddIntervention(existing_data = srt4armSimData, np = 100,
es = 0.3, attritionrate = 0.1, outcome = "posttest", interventions = "interventions",
id = "ID", continuous_covariates = c("pretest"), categorical_covariates = c("gender", "ethnicity"))
head(new_srt5armData)