Simulating center and group effects [General Statistics]
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:
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:
With
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.
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
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.

—
Dif-tor heh smusma 🖖🏼 Довге життя Україна!![[image]](https://static.bebac.at/pics/Blue_and_yellow_ribbon_UA.png)
Helmut Schütz
![[image]](https://static.bebac.at/img/CC by.png)
The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Dif-tor heh smusma 🖖🏼 Довге життя Україна!
![[image]](https://static.bebac.at/pics/Blue_and_yellow_ribbon_UA.png)
Helmut Schütz
![[image]](https://static.bebac.at/img/CC by.png)
The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Complete thread:
- Simulating center and group effectsHelmut 2013-05-04 21:05
- Simulating center and group effects ElMaestro 2013-05-05 00:31
- Naïve pooling? Helmut 2013-05-05 14:34
- Naïve pooling? ElMaestro 2013-05-05 18:20
- Naïve distribution d_labes 2013-05-06 09:02
- Naïve distribution Helmut 2013-05-06 10:56
- Naïve pooling? Helmut 2013-05-05 14:34
- Simulating center and group effects ElMaestro 2013-05-05 00:31
