crtAddIntervention {epts}R Documentation

Add a New Intervention Group to Clustered Randomized Trial (CRT)

Description

This function adds a new intervention group to an existing CRT dataset. It models post-test outcomes using fixed and random effects estimated from the original data and incorporates user-specified effect size and attrition for the new intervention.

Usage

crtAddIntervention(
  originalData,
  ns,
  np,
  es,
  attritionrate,
  outcome,
  interventions,
  schoolsID,
  pupilsID,
  continuous_covariates,
  categorical_covariates
)

Arguments

originalData

A data frame containing the variables including outcome, predictors, the clustering variable, and the intervention for CRT design.

ns

The number of schools to assign to the new intervention group.

np

The number of pupils per new school.

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 (e.g., post-test scores).

interventions

A string specifying the name of the intervention assignment column.

schoolsID

A string specifying the name of the school ID column.

pupilsID

A string specifying the name of the pupil ID column.

continuous_covariates

A character vector specifying the names of continuous covariates in the model.

categorical_covariates

A character vector specifying the names of categorical covariates in the model (converted to factors).

Details

The function performs the following:

Value

A data.frame combining the original and new intervention group, including post-test outcomes simulated for the new intervention based on the estimated mixed model.

See Also

lmer from the lme4 package

Examples

data(crt4armSimData)
new_crt5armData <- crtAddIntervention(originalData = crt4armSimData, ns = 2,
np = 100, es = 0.3, attritionrate = 0.1, outcome = "posttest", interventions = "interventions", 
schoolsID = "schools", pupilsID = "pupils", 
continuous_covariates = c("pretest"), categorical_covariates = c("gender", "ethnicity"))
head(new_crt5armData)


[Package epts version 1.2.2 Index]