Group effects EMA [Two-Stage / GS Designs]

posted by mittyri – Russia, 2016-10-07 17:06 (2729 d 19:01 ago) – Posting: # 16706
Views: 35,556

Hi VStus & ElMaestro!

This is really funny, we had 2 last days discussions with Helmut regarding Group effect during the workshop

Yes, in case of just adding a Group you do not see any changes (Fixed: sequence, period, treatment, group, subject(sequence))
But in case of Period %in% Group the situation is not the same!!

a little code for discussion:
# the original code is from this perfect paper:
# http://link.springer.com/article/10.1208/s12248-014-9661-0
Analyse222BE <- function (data, alpha=0.05, Group = FALSE) {
 
  data$Subj <- factor(data$Subj) # Subject
  data$Per  <- factor(data$Per)  # Period
  data$Seq  <- factor(data$Seq)  # Sequence
  data$Trt  <- factor(data$Trt)  # Treatment
  # be explicite
  ow <- options()
  options(contrasts=c("contr.treatment","contr.poly"))
 
  if(!Group) {
    muddle <- lm(log(Var)~Trt+Per+Seq+Subj, data=data)
  }  else {
    muddle <- lm(log(Var)~Trt+Per+Seq+Subj+
                          Group+Per:Group, data=data)
  }
  # in the standard contrasts option "contr.treatment"
  # the coefficient TrtT is the difference T-R since TrtR is set to zero
  lnPE     <- coef(muddle)["TrtT"]
  lnCI     <- confint(muddle,c("TrtT"), level=1-2*alpha)
  typeI    <- anova(muddle)
  names(typeI)[5]   <- "Pr(>F)"

  # no need for the next
  mse      <- summary(muddle)$sigma^2
  # another possibility:
  #mse <- typeI["Residuals","Mean Sq]
  #df       <- df.residual(muddle)
 
  # back transformation to the original domain
  CV <- 100*sqrt(exp(mse)-1)
  PE <- exp(lnPE)
  CI <- exp(lnCI)
  # output
 
  cat(sep,"\n")
  options(digits=8)
  cat("Type I sum of squares: ")
  print(typeI)

  cat("\nBack-transformed PE and ",100*(1-2*alpha))
  cat("% confidence interval\n")
  cat("CV (%) ..................................:",
      formatC(CV, format="f", digits=2),"\n")
  cat("Point estimate (GMR).(%).................:",
      formatC(100*PE, format="f", digits=2),"\n")
  cat("Lower confidence limit.(%)...............:",
      formatC(100*CI[1], format="f", digits=2) ,"\n")
  cat("Upper confidence limit.(%)...............:",
      formatC(100*CI[2],format="f", digits=2) ,"\n")
  cat(sep,"\n\n")
 
  #reset options
  options(ow)
}

data <- read.delim("https://static-content.springer.com/esm/art%3A10.1208%2Fs12248-014-9661-0/MediaObjects/12248_2014_9661_MOESM1_ESM.txt")
Group1 <- subset(data, Subj <= 9)
Group1$Group <- 1
Group2 <- subset(data, Subj > 9)
Group2$Group <- 2
data<-rbind(Group1, Group2)

Analyse222BE(data, alpha=0.05, Group = FALSE)
Analyse222BE(data, alpha=0.05, Group = TRUE)


> Analyse222BE(data, alpha=0.05, Group = FALSE)
_______________________________________________________________________________
_______________________________________________________________________________
Type I sum of squares: Analysis of Variance Table

Response: log(Var)
          Df  Sum Sq   Mean Sq  F value     Pr(>F)   
Trt        1 0.02285 0.0228494  3.57254   0.076998 . 
Per        1 0.04535 0.0453497  7.09049   0.017019 * 
Seq        1 0.21836 0.2183553 34.14018 2.4964e-05 ***
Subj      16 4.24539 0.2653366 41.48578 5.2285e-10 ***
Residuals 16 0.10233 0.0063958                       
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Back-transformed PE and  90% confidence interval
CV (%) ..................................: 8.01
Point estimate (GMR).(%).................: 95.09
Lower confidence limit.(%)...............: 90.76
Upper confidence limit.(%)...............: 99.62
_______________________________________________________________________________

> Analyse222BE(data, alpha=0.05, Group = TRUE)
_______________________________________________________________________________
_______________________________________________________________________________
Type I sum of squares: Analysis of Variance Table

Response: log(Var)
          Df  Sum Sq   Mean Sq  F value     Pr(>F)   
Trt        1 0.02285 0.0228494  3.42473   0.084021 . 
Per        1 0.04535 0.0453497  6.79711   0.019816 * 
Seq        1 0.21836 0.2183553 32.72757 4.0497e-05 ***
Subj      16 4.24539 0.2653366 39.76923 2.1387e-09 ***
Per:Group  1 0.00225 0.0022549  0.33797   0.569635   
Residuals 15 0.10008 0.0066719                       
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Back-transformed PE and  90% confidence interval
CV (%) ..................................: 8.18
Point estimate (GMR).(%).................: 94.92
Lower confidence limit.(%)...............: 90.47
Upper confidence limit.(%)...............: 99.59
_______________________________________________________________________________

Even PE differs!
What the heck?? Where am I wrong? I need to take some Schützomycin!
PS: I see now, the model with Period:Group is wrong

Kind regards,
Mittyri

Complete thread:

UA Flag
Activity
 Admin contact
22,957 posts in 4,819 threads, 1,636 registered users;
112 visitors (0 registered, 112 guests [including 10 identified bots]).
Forum time: 11:08 CET (Europe/Vienna)

With four parameters I can fit an elephant,
and with five I can make him wiggle his trunk.    John von Neumann

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