runSlopes {SPCDAnalyze} | R Documentation |
Runs a random slopes model for use with SPCDcontinuous
Description
The function SPCDFcontinuous
requires an analysis function which estimates the treatment effect and it's standard error for each phase of the study. This function uses the random slopes model to analyze the data.This is a random effects model with a random slope and intercept for each patient. The treatment effect is the difference in the mean slopes which modeled as the time-treatment interaction. This function can either be used as is or be used as a model for a user supplied function.
Usage
runSlopes(combData, times = "time")
Arguments
combData |
This is the input file data file, it needs to have fields |
times |
This is the time variable.The observation time can be different for each patient. If they are the same then the |
Details
This fits the random slopes model
y_{t}=\mu+\beta_1 t+ \beta_2 t*I(rx=1)+u+b t+\sigma \epsilon
,
where u,b,\epsilon
are random variables. Note that a treatment main effect is not included in the model by default, because in a randomized study the treatments should be the same at the baseline visit. This practice may vary.
Value
A numerical vector of length 3 which gives the treatment effect, it's standard are and the z-score which is the ratio of the treatment effect to it's standard error. The function SPCDcontinuous
will use the number of patients as the degrees of freedom to compute p-values.
Author(s)
David A. Schoenfeld dschoenfeld@mgh.harvard.edu
References
Laird, N. M., & Ware, J. H. (1982). Random-effects models for longitudinal data. Biometrics, 963-974.
See Also
Examples
data1=createTestData(times=0:11,n=c(50,50,50),transition=5,rx1=0,rx2=0)
data1=placeboNonResponder(data1,k=0)
#Example of use of function outside of SPCDcontinous
data1$trt=ifelse(data1$rx==3,'Active','Placebo')
runSlopes(data1,time='time')