Histogram charlatanry [Two-Stage / GS Designs]

posted by Helmut Homepage – Vienna, Austria, 2015-06-09 15:43 (3680 d 20:08 ago) – Posting: # 14932
Views: 20,085

Dear Detlew!

❝ Wow! That made me dumbfounded! Clever, clever.

:clap:


THX for the premature praise. Unfortunately my code is just approximate (euphemism for quick & dirty):

mean(N)
[1] 42.25025

Whereas correct is
power.2stage(CV=0.3, alpha=c(0.001, 0.0413), n1=24, print=F, details=F)$nmean
[1] 42.26836


If one wants to get the histograms right, download the source from CRAN and after the line
  } # end stage 2 calculations
add
  hist <- hist(ntot, plot=FALSE)
At the res-list change the last line to
  nmean=mean(ntot), nrange=range(ntot), nperc=quantile(ntot, p=npct),
  hist=hist
)


Now the data needed to plot a histogram of the total sample size are accessible for further use:

CV  <- 0.3
n1  <- 24
col <- "#AAF7FF"
alpha <- matrix(nrow=4, ncol=2, byrow=T, dimnames=list(
  c("Haybittle/Peto 0.0010/0.0413",
    "O\u2019Brien/Fleming 0.0050/0.0416",
    "Zheng 0.0100/0.0412",
    "Potvin 0.0302/0.0302"),
  c("alpha1", "alpha2")))
alpha[1, ] <- c(0.001, 0.0413)
alpha[2, ] <- c(0.005, 0.0416)
alpha[3, ] <- c(0.010, 0.0412)
alpha[4, ] <- rep(0.0302, 2)
invisible(split.screen(c(2, 2)))
for(j in 1:nrow(alpha)) {
  screen(j)
  res <- power.2stage(CV=CV, alpha=alpha[j, ], n1=n1, print=F, details=F)
  plot(res$hist, freq=F, xlim=c(12, 120), ylim=c(0, 0.1),
    main=rownames(alpha)[j], xlab=expression(n[total]),
    cex.main=0.95, cex.axis=0.9, col=col, las=1)
  abline(v=c(res$nmean, res$nperc[["50%"]]), lty=c(1, 3))
  legend("topright", box.lty=0, legend=c("mean", "median"), lty=c(1, 3),
    cex=0.9)
}
close.screen(all.screens=T)


[image]

I luf open source!

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,427 posts in 4,929 threads, 1,681 registered users;
42 visitors (0 registered, 42 guests [including 12 identified bots]).
Forum time: 11:51 CEST (Europe/Vienna)

No matter what side of the argument you are on,
you always find people on your side
that you wish were on the other.    Thomas Berger

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