Speeed! [Two-Stage / GS Designs]

posted by Helmut Homepage – Vienna, Austria, 2015-02-20 16:38 (3324 d 10:09 ago) – Posting: # 14473
Views: 11,458

Hi to nowhere!

❝ ❝ I used the optimized values of 0.0303 and 0.0282. No significant inflation of the TIE (maxima 0.05015 and 0.05010).


❝ Clever! :-D


THX. Not new (see this thread).

❝ ❝ ...and running the simulations took me close to two months.


Last year some options were not implemented in Power2Stage and I had to write my own – clumsy – code…

❝ I heard that all the "for..." constructions are not so effective in R and better to use vectors for all "for ...to" and calculate them.


Yes. Sometimes the performance boost can by 100×.

runs  <- 1e5
run   <- 1:runs
ptm   <- proc.time()
v1    <- NULL
for(j in seq_along(run)) v1 <- c(v1, rnorm(1, mean=0, sd=1))
t1    <- proc.time()-ptm
ptm   <- proc.time()
v2    <- vector("numeric", length=runs)
for(j in seq_along(run)) v2[j] <- rnorm(1, mean=0, sd=1)
t2    <- proc.time()-ptm
ptm   <- proc.time()
v3    <- rnorm(number, mean=0, sd=1)
t3    <- proc.time()-ptm
cat("\n",
"increasing vector:", t1[3], "seconds\n",
"indexed vector   :", t2[3], "seconds\n",
"internal function:", t3[3], "seconds\n")


 increasing vector: 11.74 seconds
 indexed vector   : 0.29 seconds
 internal function: 0.02 seconds


❝ Have you any experience on this?


Functions in PowerTOST and Power2Stage are completely vectorized and pre-compiled. With my latest code finding a suitable adjusted α and validating for TIE and power generally takes less than 30 minutes on my machine. Example for my “type 2” at the location of the maximum TIE. Four seconds for 106 sim’s!

library(Power2Stage)
power.2stage(method="C", alpha=rep(0.0282, 2), CV=0.1, n1=16,
             theta0=1.25, nsims=1e6)

Total time consumed (secs):
   user  system elapsed
    3.9     0.1     4.0


Method C: alpha0 = 0.05, alpha (s1/s2) = 0.0282 0.0282
Target power in power monitoring and sample size est. = 0.8
BE margins = 0.8 ... 1.25
CV = 0.1; n(stage 1)= 16; GMR = 0.95
GMR = 0.95 and mse of stage 1 in sample size est. used
Futility criterion Nmax = Inf

1e+06 sims at theta0 = 1.25 (p(BE)='alpha').
p(BE)    = 0.0501
p(BE) s1 = 0.0501
Studies in stage 2 = 0%

Distribution of n(total)
- mean (range) = 16 (16 ... 22)
- percentiles
 5% 50% 95%
 16  16  16


❝ (Read the R developers are thinking about an API for distributed computing. so we can share all our machines for large simulations :-D)


Yes, that would be nice! It’s already possible to run R in a local cloud-computing environment. We tried that at the Uni Lancaster and the speed boost was 20–50. With a SETI-like approach we could even think about TSDs for RSABE…

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
22,957 posts in 4,819 threads, 1,636 registered users;
68 visitors (0 registered, 68 guests [including 9 identified bots]).
Forum time: 02:47 CET (Europe/Vienna)

With four parameters I can fit an elephant,
and with five I can make him wiggle his trunk.    John von Neumann

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