gem_fit: GEM Fit

Description Usage Arguments Details Value Examples

View source: R/gem_fit.R


The main algorithm in pirate package for calculating the coefficients of the linear combination of the covariates to generate a GEM. This function can be applied to data sets with more than two treatment groups. See more detail in E Petkova, T Tarpey, Z Su, and RT Ogden. Generated effect modifiers (GEMs) in randomized clinical trials. Biostatistics, (First published online: July 27, 2016). doi: 10.1093/biostatistics/kxw035.


gem_fit(dat, method = "F")



Data frame with first column as the treatment index, second column as the outcome, and the remaining columns as the covariates design matrix. The elements of the treatment index take K distinct values, where K is the number of treatment groups. The outcome has to be a continuous variable.


Choice of the criterion that the generated effect modifier optimizes. This is a string in c("nu","de","F"), which corresponde to the numerator, denominator and F-statistics criteria respectively. The default method is the F-statistics method.


gemObject is a list of three elements. The first element is the calculated weight α for combining the predictors X. The second element contains the K vectors of coefficients (γ_{j0},γ_{j1}) from

y_j = γ_{j0} + (Xα)γ_{j1} + ε, j = 1,...,K,

for the K treatment groups respectively. The third element contains the K vectors of coefficients from the unconstraint linear regression models

y_j = β_{j0} + Xβ_{j1} + ε, j = 1,...,K,

for the K treatment groups respectively.


  1. method The criterion used to generate the GEM

  2. gemObject Fitted result for the GEM model, see more in Details

  3. p_value The p-value for the interaction term in model Y = a + trt + Z + trt*Z + ε, where Z is the GEM

  4. Augmented_Data The input data argumented with the GEM as the last column

  5. effect.size The effect size of the GEM if there are only two treatment groups

  6. plot A scatter plot of Y versus the GEM with fitted lines and grouped by treatment


#constructing the covariance matrix
co <- matrix(0.2, 10, 10)
diag(co) <- 1
dataEx <- data_generator1(d = 0.3, R2 = 0.5, v2 = 1, n = 300,
                        co = co, beta1 = rep(1,10),inter = c(0,0))
#fit the GEM
dat <- dataEx[[1]]
model_nu <- gem_fit(dat = dat, method = "nu")
model_de <- gem_fit(dat = dat, method = "de")
model_F <- gem_fit(dat = dat, method = "F")

suzhesuzhe/GEM documentation built on May 26, 2017, 11 p.m.