cptest: Clustered permutation test for cluster randomized trials

View source: R/cptest.R

cptestR Documentation

Clustered permutation test for cluster randomized trials

Description

cptest performs a clustered permutation test on the individual-level outcome data for cluster randomized trials (CRTs). The type of the outcome can be specified by the user to be "continuous" or "binary".

Linear regression (for outcome type "continuous") or logistic regression (for outcome type "binary") is applied to the outcome regressed on covariates specified. Cluster residual means are computed. Within the constrained space, the contrast statistic between the treatment and control arms is created from the randomization schemes and the cluster residual means. The permutation test is then conducted by comparing the contrast statistic for the scheme actually utilized to all other schemes in the constrained space.

Usage

cptest(
  outcome,
  clustername,
  z = NULL,
  cspacedatname,
  outcometype,
  categorical = NULL
)

Arguments

outcome

a vector specifying the individual-level outcome.

clustername

a vector specifying the identification variable of the cluster.

z

a data frame of covariates to be adjusted for in the permutation analysis.

cspacedatname

gives the path of the csv dataset containing the saved randomization space. This dataset contains the permutation matrix, as well as an indicator variable in the first column indicating which row of the permutation matrix was selected as the final scheme to be implemented in practice.

outcometype

the type of regression model that should be run. Options are "continuous" for linear regression and "binary" for logistic regression.

categorical

a vector specifying categorical (including binary) variables. This can be names of the columns or number indexes of columns, but cannot be both. Suppose there are p categories for a categorical variable, cptest function creates (p-1) dummy variables and drops the reference level if the variable is specified as a factor. Otherwise, the first level in the alphanumerical order will be dropped. If the user wants to specify a different level to drop for a p-level categorical variable, the user can create p-1 dummy variables and these can instead be supplied as covariates to the cptest function. Then, the user needs to specify the dummy variables created themselves to be categorical when running cptest. In addition, the user could also set the variable as a factor with the specific reference level. The user must ensure that the same level of the categorical variable is excluded as was excluded when running cvrall, by coding the variables the same way as in the design phase. This is the only optional argument of the cptest function. All others are required.

Value

FinalScheme the final scheme in the permutation matrix

pvalue the p-value of the intervention effect from the clustered permutation test

pvalue_statement the statement about the p-value of the intervention effect from the clustered permutation test

Author(s)

Hengshi Yu <hengshi@umich.edu>, Fan Li <fan.f.li@yale.edu>, John A. Gallis <john.gallis@duke.edu>, Elizabeth L. Turner <liz.turner@duke.edu>

References

Gail, M.H., Mark, S.D., Carroll, R.J., Green, S.B. and Pee, D., 1996. On design considerations and randomization based inference for community intervention trials. Statistics in medicine, 15(11), pp.1069-1092.

Li, F., Lokhnygina, Y., Murray, D.M., Heagerty, P.J. and DeLong, E.R., 2016. An evaluation of constrained randomization for the design and analysis of group randomized trials. Statistics in medicine, 35(10), pp.1565-1579.

Li, F., Turner, E. L., Heagerty, P. J., Murray, D. M., Vollmer, W. M., & DeLong, E. R. (2017). An evaluation of constrained randomization for the design and analysis of group randomized trials with binary outcomes. Statistics in medicine, 36(24), 3791-3806.

Gallis, J. A., Li, F., Yu, H., Turner, E. L. (In Press). cvcrand and cptest: Efficient design and analysis of cluster randomized trials. Stata Journal.

Gallis, J. A., Li, Fl. Yu, H., Turner, E. L. (2017). cvcrand and cptest: Efficient design and analysis of cluster randomized trials. Stata Conference. https://www.stata.com/meeting/baltimore17/slides/Baltimore17_Gallis.pdf.

Dickinson, L. M., Beaty, B., Fox, C., Pace, W., Dickinson, W. P., Emsermann, C., & Kempe, A. (2015). Pragmatic cluster randomized trials using covariate constrained randomization: A method for practice-based research networks (PBRNs). The Journal of the American Board of Family Medicine, 28(5), 663-672.

Examples

## Not run: 
Analysis_result <- cptest(outcome = Dickinson_outcome$outcome,
                          clustername = Dickinson_outcome$county,
                          z = data.frame(Dickinson_outcome[ , c("location", "inciis",
                              "uptodateonimmunizations", "hispanic", "incomecat")]),
                          cspacedatname = "dickinson_constrained.csv",
                          outcometype = "binary",
                          categorical = c("location","incomecat"))

## End(Not run)


cvcrand documentation built on Sept. 17, 2023, 9:06 a.m.