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

posted by Astea – Russia, 2019-12-22 22:23 (1608 d 10:32 ago) – Posting: # 21018
Views: 7,112

Dear Breathtakingly Smart People!

❝ I agree with PharmCat. Doable in R.

Please check my solution...
Below is my R-code:
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"))
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")
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")}

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;

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:

UA Flag
 Admin contact
23,029 posts in 4,834 threads, 1,641 registered users;
30 visitors (0 registered, 30 guests [including 5 identified bots]).
Forum time: 09:56 CEST (Europe/Vienna)

The most erroneous stories are those we think we know best–
and therefore never scrutinize or question.    Stephen Jay Gould

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