Helmut
★★★
avatar
Homepage
Vienna, Austria,
2013-05-04 23:05
(4792 d 23:37 ago)

Posting: # 10539
Views: 5,886
 

 Simulating center and group effects [General Sta­tis­tics]

Dear simulators,

a speaker from the BfArM was announced to give a presentation entitled “Biostatistical issues and equivalence testing in patient populations”. Content of the talk:
  • single- and/or multi-centre studies
  • continuous recruitment
  • group and centre effects
  • inter- and intra-individual variabilities in the context of crossover and/or parallel group design(s)
  • adequate and prospectively planned handling of missing values for PK-evaluation
Since he cannot present (he has a meeting at the EMA) the organizers asked me whether I could do something. Luckily I can’t (I’ll be giving a presentation in Budapest the same day). However, interesting idea. Whenever an amateur doesn’t understand anything he starts simulations.
My assumptions were: A cancer drug in a two-arm parallel design. I set the maximum group sizes to 16 (large centers) and the minimum to 2. Recruitment starts at large centers and smaller ones are added until the estimated total sample size is reached. Groups within centers are not necessarily balanced. This is what I have so far:

#set.seed(12345)# uncomment to compare runs
require(PowerTOST)
#require(truncnorm)# not yet
GMR <- 0.95    # T/R in parallel design
pwr <- 0.8     # target power
CV1 <- 0.5     # total CV within groups
CV2 <- 0.2     # CV between groups (in the same center)
GE  <- 0       # additive group effect (not implemented yet)
CV3 <- 0.4     # CV between centers
CE  <- 0       # additive center effect (not implemented yet)
total <- as.numeric(sampleN.TOST(CV=CV1, theta0=GMR, targetpower=pwr,
                    design="parallel", print=F)[7])
               # estimate total required subjects
size.min <- 2  # minimum group size
size.max <- 16 # maximum group size
centers.min <- ceiling(total/size.max/2) # optimistic
centers.max <- ceiling(total/size.min/2) # pessimistic
sims <- 10000  # no of simulations
ifelse(sims <= 5, debug <- TRUE, debug <- FALSE)
sizes <- NULL  # actual sample sizes / study
pass <- 0
Ueq.var <-0
for(i in 1:sims){
  size <- size.max # start with optimistic study size (large center)
  recruited <- 0
  T <- NULL; R <- NULL
  centers <- 0
  subj.center <- NULL # subjects / center
  while(recruited <= total){
    centers <- centers + 1 # add centers until ≥ the required sample size is reached
    group1 <- as.integer(runif(1, min=size.min, max=size)) # group sizes don't have to be
    group2 <- as.integer(runif(1, min=size.min, max=size)) # of equal size (aka real world)
    T <- c(T, rlnorm(group1, meanlog=log(GMR)-0.5*log(CV1^2+1),
                sdlog=sqrt(log(CV1^2+1))))
    R <- c(R, rlnorm(group2, meanlog=log(1)-0.5*log(CV1^2+1),
                sdlog=sqrt(log(CV1^2+1))))
    recruited <- recruited + (group1+group2)             # add completed center
    subj.center <- c(subj.center, (group1+group2))
    ifelse(size > 2, size <- size - 1, size <- size.min) # decrease center size
  }
  sizes <- c(sizes, recruited)
  result <- t.test(x=R, y=T, conf.level=0.90)
  if(round(exp(-result$conf.int[2]), 4) >= 0.8 & round(exp(-result$conf.int[1]), 4) <= 1.25){
    pass <- pass + 1
  }
  if(var.test(T, R)[3] <0.05) Ueq.var <- Ueq.var + 1     # exploratory only
  if(debug){
    cat("\n PE    ", "90% CI\n",
    round(100*exp(diff(result$estimate)), 2),
    round(100*exp(-result$conf.int[2]), 2),
    round(100*exp(-result$conf.int[1]), 2),"\n",
    "\nExpected number of centers:", centers.min, "–", centers.max,
    "\nOptimistic :", size.max, "/ group (", 2*size.max, "/ center )",
    "\nPessimistic:", size.min, "/ group (", 2*size.min, "/ center )",
    "\nRecruitment started in large centers and continued in increasingly smaller ones.",
    "\nActual centers:", centers,
    "\nSubjects per center:", subj.center,
    "\nTotal sample size:", sum(subj.center), "(", length(T), "T,", length(R), "R )",
    "allocation ratio 1:")
    cat(round(max(length(T), length(R))/min(length(T), length(R)), 2), "\n\n")
  }
}
cat("\nExpected GMR:", GMR, "– total CV", 100*CV1, "%.",
  "\nTotal sample size for \u2265", 100*pwr, "% power:", total,
  "\nAverage study size:", round(mean(sizes), 0), "(", min(sizes), "–", max(sizes), ")",
  "\nIn", round(100*pass/sims, 2), "% of", sims, "simulated studies BE was demonstrated.",
  "\nNote: Unequal variances of T and R (F-test p <0.05) in", round(100*Ueq.var/sims, 2), "% of studies.\n\n")


With set.seed(12345) I got:
Expected GMR: 0.95 – total CV 50 %.
Total sample size for ≥ 80 % power: 194
Average study size: 196 ( 195 – 198 )
In 77.63 % of 10000 simulated studies BE was demonstrated.
Note: Unequal variances of T and R (F-test p <0.05) in 27.64 % of studies.


Now I’m stuck. I want to add group and center effects (together with some CVs). In order to assess their impacts I guess I have to run some kind of a mixed-effects model. OK, but how to implement that in R? I don’t want to abandon the Welch-test if ever possible (although right now I simulate equal variances, the groups are imbalanced).
Any suggestions welcome. :-D

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
ElMaestro
★★★

Denmark,
2013-05-05 02:31
(4792 d 20:10 ago)

@ Helmut
Posting: # 10540
Views: 4,951
 

 Simulating center and group effects

Hi Helmut,

❝ Now I’m stuck. I want to add group and center effects (together with some CVs). In order to assess their impacts I guess I have to run some kind of a mixed-effects model. OK, but how to implement that in R? I don’t want to abandon the Welch-test if ever possible (although right now I simulate equal variances, the groups are imbalanced).

❝ Any suggestions welcome. :-D


I don't think there is a case for xover. Since the PK workgroup defines all effects -even subject- as mandatorily fixed, group and center must be fixed as well. A model for xover is Y~Subj+Per+Trt+Group+Center - depending on your coding in the dataframe you may wish to specify Subj%in%Group, Subject%in%Group%in%Center or whatever complexity you aim for. Since all effects are fixed and we are only interested in the treatment effect estimates and the residual variation, just simulate with everything other than Trt as a round 0 or any other constant for a given level of a term.

In the parallel case, if you desire to stick with WS correction you are effectively just using a variation of Y~Trt, otherwise Y~Trt+Center (group must be Trt for parallel right?); but again since they are fixed there is no reason to set all those non-Trt levels to anyhting other than zero. No reason to simulation variation for them.

As I see it - and I could very well have misunderstood you due to my walnut-sized brain - there is only a need for a Mixed muddle if or when you for some reason decide to involve Group or Center or something else as another random term, and in that case yes, you can simulate that variation. I see a world of trouble with that though: It is probably not in accordance with EU regulator's wishes, and there is no R package available which allows ddfm=Satterthwaite like e.g. Proc Mixed does in SAS so validation could prove complicated unless you work with balanced scenarios. And finally, is it really relevant or otherwise necessary in practice to assume center or group being random?

Pass or fail!
ElMaestro
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2013-05-05 16:34
(4792 d 06:08 ago)

@ ElMaestro
Posting: # 10541
Views: 4,907
 

 Naïve pooling?

Hi ElMaestro,

THX for your elaborate answer. :pirate:

❝ […] and I could very well have misunderstood you due to my walnut-sized brain […]



For sure my confusion is caused by my peanut-sized brain. The GL states

The statistical analysis should take into account sources of variation that can be reasonably [sic] assumed to have an effect on the response variable.

Think about my example (forget about Xovers now; see also this one). Even in large centers we might have more than one group per treatment due to difficult recruitment. What if one group shows only ⅛ of the ‘normal’ response? We know that handling and storage of samples in University hospitals might not be that well-controlled like in spezialised CROs… Can/should we pool the data in such a case? Not only the CV will be inflated, the treatment effect will be biased as well. Referring to the – canceled – presentation above it seems to me that the BfArM is concerned about “group and centre effects”.


P.S.: Any idea why I get unequal variances of T and R in ~28% of studies? I expect only ~5%…

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
ElMaestro
★★★

Denmark,
2013-05-05 20:20
(4792 d 02:22 ago)

@ Helmut
Posting: # 10542
Views: 4,894
 

 Naïve pooling?

Hi Helmut,

❝ For sure my confusion is caused by my peanut-sized brain. The GL states

The statistical analysis should take into account sources of variation that can be reasonably [sic] assumed to have an effect on the response variable.


Oh yes, but a fixed effect does not add to the (residual) variation or to the T/R.

❝ Think about my example (forget about Xovers now; see also this one). Even in large centers we might have more than one group per treatment due to difficult recruitment. What if one group shows only ⅛ of the ‘normal’ response? We know that handling and storage of samples in University hospitals might not be that well-controlled like in spezialised CROs… Can/should we pool the data in such a case? Not only the CV will be inflated, the treatment effect will be biased as well. Referring to the – canceled – presentation above it seems to me that the BfArM is concerned about “group and centre effects”.


Yes to pooling. This example would translate into a center effect (possibly center*group if you include such stuff in your muddle). At the end of the day you are interested in just the plain T and R estimates given the effect estimates from other terms in the muddle. I would consider the center effect a nuisance issue just like old-fashioned period effects. And bear in mind that center often comes out extremely significant even for innovator drugs.
The example serves well to illustrate a situation where the WS approach would spell trouble, even if the ideas of unequal variances is appealing. No way to decompose a variability into several factors however obvious they are, as far as I can tell.




P.S.: Any idea why I get unequal variances of T and R in ~28% of studies? I expect only ~5%…


No. Sorry I have not really tried to understand your code. Will do a transatlantic flight in a few days, perhaps it would be a way to kill time?

Pass or fail!
ElMaestro
d_labes
★★★

Berlin, Germany,
2013-05-06 11:02
(4791 d 11:40 ago)

@ Helmut
Posting: # 10543
Views: 4,742
 

 Naïve distribution

Dear Helmut,

❝ P.S.: Any idea why I get unequal variances of T and R in ~28% of studies? I expect only ~5%…


IMHO you are simulating the untransformed metrics (whatever it may be named: Cmax, AUC, ...) if you use rlnorm().
Thus change to:


# log-transformed data are normal distributed
T <- c(T, rnorm(group1, mean=log(GMR), sd=CV2se(CV1))
R <- c(R, rnorm(group2, mean=0, sd=CV2se(CV1))


and all is right with the world :cool::

Expected GMR: 0.95 – total CV 50 %.
Total sample size for = 80 % power: 194
Average study size: 196 ( 195 – 198 )
In 80.4 % of 10000 simulated studies BE was demonstrated.
Note: Unequal variances of T and R (F-test p <0.05) in 5.12 % of studies.

Regards,

Detlew
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2013-05-06 12:56
(4791 d 09:46 ago)

@ d_labes
Posting: # 10544
Views: 4,768
 

 Naïve distribution

Dear Detlew!

❝ IMHO you are simulating the untransformed metrics (whatever it may be named: Cmax, AUC, ...) if you use rlnorm().


Oh that sucks! THX (manchmal sieht man den Wald vor lauter Bäumen nicht)!

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
UA Flag
Activity
 Admin contact
23,654 posts in 4,992 threads, 1,570 registered users;
183 visitors (0 registered, 183 guests [including 22 identified bots]).
Forum time: 22:42 CEST (Europe/Vienna)

“Data! Data! Data!” he cried impatiently.
“I can’t make bricks without clay!”    Arthur Conan Doyle

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