|
Shuanghe ★★ Spain, 2025-12-14 18:35 (171 d 10:16 ago) Posting: # 24532 Views: 2,498 |
|
|
Hi all, I have several questions regarding the simulation of the inter-subject variability in the 2x2x4 replicate study. It's a long post, so let's use concrete example so it's easier to discuss. Imagine I need to simulate a 2x2x4 study with n = 24 subjects (so 12 for TRTR and 12 for RTRT). The mean Cmax of test and reference is 100 ng/mL, intra-subject variability for test is sd.t = 0.2 and for reference is sd.r = 0.1. Here the variability is expressed as standard deviation (SD), not CV. cmax.r <- rnorm(48, mean = log(100), sd = 0.1)This will simulate 48 Cmax values for T and R. With a bit coding, we can generate TRTR/RTRT sequences and randomly assign 24 subjects to those sequences with corresponding period and Cmax values. We can back-calculate the within-subject variability of T and R either using EMA's method (e.g., using only reference data for within-subject variability of reference as described in Clinical pharmacology and pharmacokinetics: questions and answers.) or FDA's method (e.g., described in the appendix C of the BE guidance). Easy enough, so far so good. Q1: In this case, based on those population parameters described above, what is the expected inter-subject variability? Is there mathematical formula to get the between-subject SD of T and R? or pooled SD? Q2: If there's no mathematical derivation for between-subject SD, I think that we can estimate them using R. But how? One way that I am thinking is to use EMA's method, removing test product from the data set and do ANOVA as described in EMA's Q&A. m.ref <- anova(lm(log(cmax) ~ sequence + subject %in% sequence + period, data = d.ref))The code above should give us the within and between-subject SD of reference with swr = sqrt(MSResidual) and sbr = sqrt((MSSubject(seq) - MSResidual)/2), where swr and sbr are within-and between-SD of reference, respectively. Similarly we can do it for the test. And in case MSSubject(seq) < MSResidual, we can try what Detlew described in another post to avoid negative variance.Q3: Is this a correct approach? If not, what's the correct one? Now comes to simulation. Imagine in addition to what I described above for simulating Cmax of T and R with mean value of 100 ng/mL, sd.t = 0.2 and sd.r = 0.1, I also want to introduce between-subject SD for T and R, say sd.bt = 0.4 and sd.br = 0.2, where sd.bt and sd.br are between-subject SD for T and R. Q4: How do we do it? I saw that Helmut did it as follows in one of his articles (Helmut, it's Simulations 101 but the link causes Error 406 .) for simulating the 2x2x2 crossover study.T <- rnorm(n = n, mean = log(theta0), sd = sd)where sd.b is the between-subject SD if I understood it correctly. However, when I tried to do it similarly for 2x2x4 as follows and back-calculate the within and between SD, the results doesn't match expectation at all because the between-subject SD fromANOVA is extremely small, instead of around the expected values of 0.2 or 0.4. cmax.r <- rnorm(48, mean = log(100), sd = 0.1)Q5: What went wrong? Should the mean value for between-subject SD of T and R always 0 instead of using the same value as T and R? Edit: Category changed. [Helmut] — All the best, Shuanghe |
|
mittyri ★★ Russia, 2025-12-18 15:07 (167 d 13:44 ago) @ Shuanghe Posting: # 24534 Views: 2,003 |
|
|
Dear Shuanghe! I started to write my answer, then pasted your question to ChatGPT... I realized that its detailed answer is much better than anything I can do . But I don't want to spread AI here.So I just retain the correct code for simulation. It is based on genius Detlew's code. Just for your 1st question - betweensubject variability is (theoretically) 0.
library(PowerTOST)— Kind regards, Mittyri |
|
Shuanghe ★★ Spain, 2025-12-30 11:22 (155 d 17:28 ago) @ mittyri Posting: # 24543 Views: 1,803 |
|
|
Dear mittyri! Many thanks! I've been using PowerTOST for quite long time but haven't noticed the simulation functions. I must've been You are right, the between subject variability is effectively zero in my original code. And I also asked chatGPT, it did provide quite detailed answer. It seems that AI is getting better every day. Your mention of chatGPT reminds me that we still haven't been able to reproduce the FDA's unscaled ABE using the following SAS code, which was also summarised in one of Helmut's post. Maybe we can ask chatGPT to come up with R code to reproduce the result from SAS? I'll play it when I got some time and report back here.
PROC MIXED; — All the best, Shuanghe |
|
Helmut ★★★ ![]() Vienna, Austria, 2025-12-30 12:11 (155 d 16:40 ago) @ Shuanghe Posting: # 24544 Views: 1,808 |
|
|
Hi Shuanghe, ❝ I must've been ❝ Your mention of chatGPT reminds me that we still haven't been able to reproduce the FDA's unscaled ABE using the […] SAS code, which was also summarised in one of Helmut's post. https://github.com/camontefusco/pumas-bioequivalence-course-project-reference-scaling-and-narrow-therapeutic-index-drugs Pumas is free for Academic Research & Training. Don’t know the costs of a commercial license. ❝ Maybe we can ask chatGPT to come up with R code to reproduce the result from SAS? I'll play it when I got some time and report back here.
— Dif-tor heh smusma 🖖🏼 Довге життя Україна! ![]() Helmut Schütz ![]() The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
|
Nirali ★ India, 2026-02-18 13:04 (105 d 15:47 ago) (edited on 2026-02-19 04:57) @ Helmut Posting: # 24576 Views: 1,065 |
|
|
Hello Helmut, Have you got a chance to work on it later? Have a great Day ![]() — Nirali Mehta (PHARMA-STATS) |
.) for simulating the 2x2x2 crossover study.
. But I don't want to spread AI here.

![[image]](https://static.bebac.at/pics/Blue_and_yellow_ribbon_UA.png)
![[image]](https://static.bebac.at/img/CC by.png)

