## mixed in R (EMA B ≠ FDA) [Design Issues]

Hi mittyri,

» If I remember correctly we were struggling with FDA model where sophisticated 'repeated' statement exists.
» We successfully crosschecked EMA method B (simple mixed effects model with a Subject as random effect).

Are you reminding Detlew and me obout our TODO-list? » So linear mixed effects models are possible until FDA-style is required .

Yes, but that’s the point. However, recycled our code:

library(lmerTest) # (requires lme4, Matrix) dta           <- read.table("exam45.dat", header=TRUE, na.strings="99999",                             colClasses=c(rep("factor", 4), rep("numeric", 2))) names(dta) <- "treatment" TR.only       <- dta[dta$treatment != "S", ] ci <- data.frame(rep(NA, 2), rep(NA, 4)) res <- data.frame(method=c(rep("pooled", 2), rep("IBD", 2)), PE=NA, CL.lo=NA, CL.hi=NA, CV=NA, DFM=rep(c("Satterthwaite", "Kenward-Roger"), 2), DF=NA, stringsAsFactors=FALSE) for (j in 1:4) { if (j == 1) { # pooled (all at once) muddle <- lmer(log(AUC) ~ sequence + period + treatment + (1|subject), data=dta) } if (j == 3) { # IBD (S excluded) muddle <- lmer(log(AUC) ~ sequence + period + treatment + (1|subject), data=TR.only) } sum.muddle <- summary(muddle, ddf=res$DFM[j])   log.pe      <- sum.muddle$coefficients["treatmentT", "Estimate"] ci[j, 1:2] <- round(100*exp(log.pe + c(-1, +1) * qt(1-0.05, sum.muddle$coef["treatmentT", "df"]) *                            sum.muddle$coef["treatmentT", "Std. Error"]), 2) res$PE[j]   <- round(100*exp(log.pe), 2)   res$CL.lo[j] <- ci[j, 1]; res$CL.hi[j] <- ci[j, 2]   res$CV[j] <- round(100*sqrt(exp(sum.muddle$devcomp$cmp[["sigmaREML"]]^2)-1), 2) res$DF[j]   <- signif(sum.muddle\$coefficients["treatmentT", "df"], 5) } print(res, row.names=FALSE)

Gives:

Method     PE  CL.lo  CL.hi    CV           DFM      DF pooled 116.15 108.97 123.81 21.20 Satterthwaite 115.040 pooled 116.15 108.97 123.81 21.20 Kenward-Roger 114.630    IBD 116.05 108.92 123.65 20.84 Satterthwaite  56.823    IBD 116.05 108.91 123.65 20.84 Kenward-Roger  56.468

Similar same.

Though the DFs are slightly different, the CIs look only identical due to rounding.

Cheers,
Helmut Schütz The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes Ing. Helmut Schütz 