OvaryICT: Ovary data from nlme modified for idiographic clinical trial...

OvaryICTR Documentation

Ovary data from nlme modified for idiographic clinical trial analysis

Description

Ovary data from nlme modified for idiographic clinical trial analysis

Author(s)

Stephen Tueller stueller@rti.org

The Ovary data set from the nlme package, modified as shown in the example.

  • Mare. The mare ID.

  • Time. The time variable.

  • follicles. See Ovary.

  • Phase. A faux phase variable created at Time > .5.

  • Time. Equal to sin(2*pi*Ovary$Time). See Pinheiro & Bates (2000).

References

Pinheiro, J., & Bates, D. (2000). Mixed-effects models in S and S-PLUS (statistics and computing).

Examples

# A simple mixed effects models using PersonAlytic and lme
t1 <- PersonAlytic(data=OvaryICT,
                   ids="Mare",
                   dvs="follicles",
                   phase="Phase",
                   time="Time",
                   package="nlme",
                   autoSelect=list(),
                   standardize = list(dvs=FALSE,ivs=FALSE,byids=FALSE),
                   alignPhase = 'none')
summary(t1)

# Verify the PersonAlytic results to a direct call to lme
t2 <- nlme::lme(follicles ~ Time * Phase,
          data = OvaryICT,
          random = ~Time | Mare,
          method = "REML",
          control = t1$call$control)
summary(t2)

# verification tests - are the results the same?
message( '\n\nAre fixed effects equal?\n', all.equal(summary(t1)$tTable, summary(t2)$tTable) )
message( '\n\nAre variance components equal?\n',all.equal(nlme::VarCorr(t1), nlme::VarCorr(t2)) )

# verify estimates against known values
message('\n\nAre stored values replicated?\n',
all.equal( summary(t1)$tTable[,1],
c(`(Intercept)`  = 10.6616306,
   Time          = -0.8689801,
   Phase         = 10.9720945,
   `Time:Phase`  = -8.6438502) ) )

# Illustrate a multiphase study, Phase alignment (To do: add visualization)
t3 <- PersonAlytic(data=OvaryICT,
                   ids="Mare",
                   dvs="follicles",
                   phase="Phase2",
                   time="Time",
                   package="nlme",
                   autoSelect=list(),
                   standardize = list(dvs=FALSE,ivs=FALSE,byids=FALSE),
                   alignPhase = 'align')
summary(t3)

# definition of OvaryICT
## Not run: 
OvaryICT <- as.data.frame(nlme::Ovary)
OvaryICT$Mare <- as.numeric(OvaryICT$Mare)
OvaryICT$Phase <- as.numeric(OvaryICT$Time > .5)
OvaryICT$Phase2 <- factor( cut(OvaryICT$Time,
                               breaks = c(-Inf, .2, .6, 1, Inf)),
                           labels = 1:4 )
#OvaryICT$Time <- sin(2*pi*OvaryICT$Time)
set.seed(1)
t1 <- matrix( sample(1:4, 3*nrow(OvaryICT), replace = TRUE), ncol = 3)
t1 <- data.frame(t1)
names(t1) <- paste('Target', 1:3, sep='')
set.seed(2)
t2 <- data.frame( matrix( rnorm(3*nrow(OvaryICT)), ncol = 3 ) )
names(t2) <- paste('Target', 4:6, sep='')
OvaryICT <- data.frame(OvaryICT, t1, t2)
OvaryICT <- OvaryICT[order(OvaryICT$Mare),]

## End(Not run)


ICTatRTI/PersonAlytics documentation built on Dec. 13, 2024, 11:06 p.m.