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

posted by Helmut Homepage – Vienna, Austria, 2019-03-24 02:23 (1822 d 09:19 ago) – Posting: # 20077
Views: 18,069

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 :cool:.


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)[4] <- "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.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes

Complete thread:

UA Flag
Activity
 Admin contact
22,940 posts in 4,812 threads, 1,639 registered users;
45 visitors (0 registered, 45 guests [including 8 identified bots]).
Forum time: 11:43 CET (Europe/Vienna)

Those people who think they know everything
are a great annoyance to those of us who do.    Isaac Asimov

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5