Group effect: the endless river [General Sta­tis­tics]

posted by Astea – Russia, 2019-12-22 21:23 (278 d 19:02 ago) – Posting: # 21018
Views: 3,386

Dear Breathtakingly Smart People!

» I agree with PharmCat. Doable in R.

Please check my solution...
Below is my R-code:
library(readxl)
library(lmerTest)
options(contrasts=c("contr.treatment","contr.poly"))
Dataset<-read_excel("DS_01_group.xlsx", sheet = 1)
Model2 <- function(Dataset){
Dataset$Formulation<-factor(Dataset$Formulation, levels = c("R","T"))
Dataset$Sequence<-factor(Dataset$Sequence, levels = c("TRTR", "RTRT"))
Dataset$Period<-factor(Dataset$Period)
Dataset$Group<-factor(Dataset$Group)
mod.lmer <- (lmer(log(Data)~Sequence+Period/Group+Formulation+Group+Group*Sequence+(1|Subject/(Sequence)), data=Dataset))
FormulationEffect.lmer <- summary(mod.lmer)$coefficients["FormulationT","Estimate"] cat("\n", "PE is", round(exp(as.numeric(FormulationEffect.lmer))*100, digits = 8), "\n")
FormulationT<-summary(mod.lmer)$coefficients["FormulationT",] 
CI_Lr<-round(exp(FormulationT[1]+FormulationT[2]*qt(0.05, FormulationT[3]))*100, 4)
CI_Ur<-round(exp(FormulationT[1]-FormulationT[2]*qt(0.05, FormulationT[3]))*100, 4)
cat("\n", "CI is", CI_Lr, "-", CI_Ur,"\n")}
Model2(Dataset)
 

In order to check whether it works properly I used Data set 1 from Q&A and added group-factor: first 30 subjects - group #1, and the last - group #2.

To compare the results I used the following SAS-code:
proc mixed data=SASuser.Dataset;
class Formulation Subject Period Sequence Group;
model PKlog= Sequence Formulation Period(Group) Group Sequence*Group;
random Subject(Sequence*Group);
estimate "test-ref" Formulation -1 1 / CL alpha=0.10;
run;

Cause I wasn't sure that my code works well I used the step-by-step approach and compared different models (they all may be meaningless by nature but whatever):
1). Sequence Formulation Period as Fixed, Subject(Sequence) as Random
2). Sequence Formulation Period Group as Fixed, Subject(Sequence) as Random
3). Sequence Formulation Period(Group) Group as Fixed, Subject(Sequence) as Random
4). Sequence Formulation Period(Group) Group Sequence*Group as Fixed, Subject(Sequence) as Random
5). Sequence Formulation Period(Group) Group Sequence*Group as Fixed, Subject(Sequence*Group) as Random


The results are as follows:
      SAS         SAS         SAS         R         R            R
#   PE         90%CI, L   90%CI, U   PE         90%CI, L   90%CI, U
1   115,7298   107,1707   124,9725   115,7298   107,1707   124,9725
2   115,7279   107,1680   124,9716   115,7279   107,1679   124,9716
3   115,7208   107,1080   125,0262   115,7208   107,1080   125,0262
4   115,7275   107,1136   125,0340   115,7275   107,1136   125,0340
5   115,7275   107,1136   125,0340   NA         NA         NA


And now, attention, the questions:
1). Looking the same is not proving to be the same, isn't it?
2). By the way, this is exactly an example where the design changes the decision of BE (of course if scaling was not stated in protocol). BE or not BE?
3). When I try to use Subject(Sequence*Group) as Random in R, it throws an error: "couldn't evaluate grouping factor (Sequence * Group):Subject within model frame: try adding grouping factor to data frame explicitly if possible". Is it right that we can simply neglect the structure of this term as we can do in standard models with Subject instead of Subject(Sequence)?

"Being in minority, even a minority of one, did not make you mad"

Complete thread:

Activity
 Admin contact
21,076 posts in 4,394 threads, 1,469 registered users;
online 5 (2 registered, 3 guests [including 3 identified bots]).
Forum time: Saturday 17:25 CEST (Europe/Vienna)

For every fact
there is an infinity of hypotheses.    Robert M. Pirsig

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