T1E after 1st stage in TSDs [Two-Stage / GS Designs]

posted by Helmut Homepage – Vienna, Austria, 2022-06-25 16:07 (667 d 16:29 ago) – Posting: # 23086
Views: 2,104

Hi Mittyri,

[image]Of course, ElMaestro is right.

There Can Be Only One.


❝ do I understand it right that if the study is terminated after 1st stage (due to any reason), we are using the same function with n1 (not fixing n2 to 0)


Not sure what you mean. For any of the simulated studies the decision scheme of the method is followed. The function returns counters for the studies passing in the 1st stage (pBE_s1) and of the pooled data in the 2nd stage (pBE). We can extract all numbers:

library(Power2Stage)
# using defaults of method = "B"
tmp <- power.tsd(CV = 0.2, n1 = 12, theta0 = 1.25)
if (tmp$theta0 == tmp$theta1 | tmp$theta0 == tmp$theta2) {
  txt <- "Type I Error"
} else {
  txt <- "Power"
}
cat(formatC(tmp$nsims, digits = 7, big.mark = ","),
    "simulated studies\nFailed in stage 1     :",
    formatC(tmp$nsims - tmp$nsims * tmp$pBE_s1 - tmp$pct_s2 / 100 * tmp$nsims,
            digits = 6, big.mark = ","),
    sprintf("(%7.4f%%)",
            100 * (tmp$nsims - tmp$nsims * tmp$pBE_s1 - tmp$pct_s2 /
            100 * tmp$nsims) / tmp$nsims),
    "\nPassed in stage 1     :",
    formatC(tmp$pBE_s1 * tmp$nsims, digits = 6, big.mark = ","),
    sprintf("(%7.4f%%)", 100 * tmp$pBE_s1),
    "\nProceeded to stage 2  :",
    formatC(tmp$nsims * tmp$pct_s2 / 100, digits = 6, big.mark = ","),
    sprintf("(%7.4f%%)", tmp$pct_s2),
    "\nFailed in stage 2     :",
    formatC(tmp$nsims * tmp$pct_s2 / 100 - (tmp$pBE -tmp$pBE_s1) * tmp$nsims,
            digits = 6, big.mark = ","),
    sprintf("(%7.4f%%)",
    100 * (tmp$nsims * tmp$pct_s2 / 100 - (tmp$pBE -tmp$pBE_s1) * tmp$nsims) / tmp$nsims),
    "\nPassed in stage 2     :",
    formatC((tmp$pBE -tmp$pBE_s1) * tmp$nsims, digits = 6, big.mark = ","),
    sprintf("(%7.4f%%)", 100 * (tmp$pBE -tmp$pBE_s1)),
    "\nFailed in stage 1 or 2:",
    formatC((1 - tmp$pBE) * tmp$nsims, digits = 6, big.mark = ","),
    sprintf("(%7.4f%%)", 100 * (1 - tmp$pBE)),
    "\nPassed in stage 1 or 2:",
    formatC(tmp$pBE * tmp$nsims, digits = 6, big.mark = ","),
    sprintf("(%7.4f%%) = empiric", 100 * tmp$pBE), txt, "\n")


1,000,000 simulated studies
Failed in stage 1     :  92,550 ( 9.2550%)
Passed in stage 1     :  28,849 ( 2.8849%)
Proceeded to stage 2  : 878,601 (87.8601%)
Failed in stage 2     : 861,177 (86.1177%)
Passed in stage 2     :  17,424 ( 1.7424%)
Failed in stage 1 or 2: 953,727 (95.3727%)
Passed in stage 1 or 2:  46,273 ( 4.6273%) = empiric Type I Error


And:

tmp <- power.tsd(CV = 0.2, n1 = 12, theta0 = 0.95)

100,000 simulated studies
Failed in stage 1     :   2,325 ( 2.3250%)
Passed in stage 1     :  41,333 (41.3330%)
Proceeded to stage 2  :  56,342 (56.3420%)
Failed in stage 2     :  13,409 (13.4090%)
Passed in stage 2     :  42,933 (42.9330%)
Failed in stage 1 or 2:  15,734 (15.7340%)
Passed in stage 1 or 2:  84,266 (84.2660%) = empiric Power



❝ ❝


PS: I changed the category from Software. Though you asked for the [image]-package Power2Stage, perhaps somebody would have the balls to roll out own code. ;-)


❝ I changed the category twice when wrote the post :-D


I see. Feel free to change it to anyone you like.

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,990 posts in 4,826 threads, 1,665 registered users;
58 visitors (0 registered, 58 guests [including 4 identified bots]).
Forum time: 08:36 CEST (Europe/Vienna)

If you don’t like something change it;
if you can’t change it, change the way you think about it.    Mary Engelbreit

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