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

posted by Helmut Homepage – Vienna, Austria, 2013-05-04 23:05 (4795 d 01:20 ago) – Posting: # 10539
Views: 5,890

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

Complete thread:

UA Flag
Activity
 Admin contact
23,655 posts in 4,993 threads, 1,570 registered users;
146 visitors (0 registered, 146 guests [including 19 identified bots]).
Forum time: 00:25 CEST (Europe/Vienna)

I have finally come to the konklusion
that a good reliable set ov bowels
iz worth more to a man
than enny quantity of brains.    Josh Billings

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