Conservativism? [Regulatives / Guidelines]

posted by Helmut Homepage – Vienna, Austria, 2011-11-03 22:12 (4930 d 21:38 ago) – Posting: # 7598
Views: 9,160

Hi to all simulants!

I modified your code according to Martin's suggestion. I tested three scenarios (10 000 sims each):In all simulations T/R1=95%, T/R2=100/0.95≈105.27%. I’m not sure whether the setup of CVs is correct – seems to be CVtotal.


require(nlme)
set.seed(12041958) # keep this line to compare results only
sims   <- 10000    # <- no of sims here

# T/R1 = 95%, T/R2 = 105.26%
mean1 <- 1.00;   cv1 <- mean1/100*30 # <- means & CVs here
mean2 <- 0.95;   cv2 <- mean2/100*30 # <-
mean3 <- 1/0.95; cv3 <- mean3/100*30 # <-

seq1 <- as.factor(rep(rep(1:6, each = 3), 2))
sub1 <- as.factor(rep(1:12, each = 3))
per1 <- as.factor(rep(1:3, 12))
trt1 <- as.factor(rep(c(1,2,3, 2,3,1, 3,1,2, 1,3,2, 2,1,3, 3,2,1), 2))

# massacrating out everything related to R2
# means that when T was before R1 we now have a seq 1 otherwise a seq 2
sub2 <- as.factor(rep(1:12, each = 2))
per2 <- as.factor(rep(1:2, 12))
trt2 <- as.factor(rep(c(1,2, 2,1, 1,2, 1,2, 2,1, 2,1), 2))
seq2 <- as.factor(rep(c(1,1, 2,2, 1,1, 1,1, 2,2, 2,2), 2))

# see Martin's post: http://forum.bebac.at/mix_entry.php?id=5272
meanl1 <- log(mean1)-0.5*log(cv1^2+1)
meanl2 <- log(mean2)-0.5*log(cv2^2+1)
meanl3 <- log(mean3)-0.5*log(cv3^2+1)
sdl1   <- sqrt(log(cv1^2+1))
sdl2   <- sqrt(log(cv2^2+1))
sdl3   <- sqrt(log(cv3^2+1))

nConservative <- 0; nAntiConservative <- 0
for (iter in 1:sims) # T is 1, R1 is 2 and R2 is 3
  {
  y1 = rlnorm(n=36, meanlog=meanl1, sdlog=sdl1)
  for (i in 1:36) if (trt1[i]==2) y1[i]=rlnorm(n=1, meanlog=meanl2, sdlog=sdl2)
  for (i in 1:36) if (trt1[i]==3) y1[i]=rlnorm(n=1, meanlog=meanl3, sdlog=sdl3)
  ElMaestrosMixedModel <- lme(y1 ~ 0 + seq1 + per1 + trt1, random = ~1|sub1)
  Smm <-ElMaestrosMixedModel$sigma
  # do the pruning!
  y2 <- y1
  length(y2) <- 24
  j <- 0
  for (i in 1:36) if (trt1[i] != 3)
    { j     <- j+1;
      y2[j] <- y1[i]     }
  HSLinearModel <- lm(y2 ~ 0 + seq2 + sub2 %in% seq2 + per2 + trt2) # EMA?!
  Slm <- summary(HSLinearModel)$sigma
  if (Slm<Smm) nAntiConservative <- nAntiConservative + 1
  if (Slm>=Smm) nConservative    <- nConservative + 1
  }

cat(" Conservative = ", 100*nConservative/sims, "%\n","Anticonservative = ", 100*nAntiConservative/sims, "%\n Based on",sims,"simulated BE studies; n=12 each.","\n")



Is this correct – or did I bungle the code? :confused:

       T  R1  R2   Cons.   Anticons.
Sc.1  30  30  30   44.05%   55.95%
Sc.2  30  50  30   63.42%   36.58%
Sc.3  30  30  50   14.11%   85.89%

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,424 posts in 4,927 threads, 1,666 registered users;
79 visitors (0 registered, 79 guests [including 8 identified bots]).
Forum time: 20:50 CEST (Europe/Vienna)

Patients may recover in spite of drugs or because of them.    John Gaddum

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