Speeed! [Two-Stage / GS Designs]
❝ ❝ I used the optimized values of 0.0303 and 0.0282. No significant inflation of the TIE (maxima 0.05015 and 0.05010).
❝
❝ Clever!
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 )
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 🖖🏼 Довге життя Україна!
Helmut Schütz
The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Complete thread:
- Gimmick & survey Helmut 2015-02-20 01:47
- Gimmick & survey nobody 2015-02-20 08:25
- Gimmick & survey Helmut 2015-02-20 13:01
- Gimmick & survey nobody 2015-02-20 14:18
- Speeed!Helmut 2015-02-20 15:38
- Speeed! nobody 2015-02-20 16:37
- Speeed! ElMaestro 2015-02-20 23:48
- Speeed! Helmut 2015-02-21 01:11
- Unrolled example ElMaestro 2015-02-21 01:32
- Unrolled example Helmut 2015-02-21 01:50
- Unrolled example ElMaestro 2015-02-21 02:27
- Increasing vector & another example Helmut 2015-02-21 13:13
- Unrolled example ElMaestro 2015-02-21 02:27
- Unrolled example Helmut 2015-02-21 01:50
- Speeed! nobody 2015-02-21 21:02
- Unrolled example ElMaestro 2015-02-21 01:32
- Speeed! Helmut 2015-02-21 01:11
- Speeed!Helmut 2015-02-20 15:38
- Gimmick & survey nobody 2015-02-20 14:18
- Gimmick & survey Helmut 2015-02-20 13:01
- Gimmick & survey nobody 2015-02-20 08:25