Sims [🇷 for BE/BA]

posted by Helmut Homepage – Vienna, Austria, 2010-04-27 03:36 (5111 d 23:04 ago) – Posting: # 5242
Views: 55,674

Dear D. Labes,

you have already outed yourself as a passionate wheel-reinventer, but why don't you simply go with the Welch-test (orwhatsover for unequal variances)? Since our Capt'n luuuvs simulations, I recycled some of his code to play width:
sims   <- 10000
MeanT  <- 95
MeanR  <- 100
CVT    <- 0.25
CVR    <- 0.40
nCons  <- 0
nAnti  <- 0
nT     <- 12
nR     <- 10
for (iter in 1:sims)
  {
    lnPKT  <- rnorm(n=nT,mean=MeanT,sd=CVT*MeanT)
    lnPKR  <- rnorm(n=nR,mean=MeanR,sd=CVR*MeanR)
    WelchRes <- t.test(lnPKT,lnPKR,conf.level=0.9)
    TtestRes <- t.test(lnPKT,lnPKR,var.equal=TRUE,conf.level=0.9)
    WidthW <- abs(WelchRes$conf.int[1]-WelchRes$conf.int[2])
    WidthT <- abs(TtestRes$conf.int[1]-TtestRes$conf.int[2])
    if (WidthT<WidthW){
      nAnti <- nAnti+1
      }else{
      nCons <- nCons+1
    }
  }
result  <- paste(paste("t-test compared to Welch-test\n"),
          paste("Conservative = ", 100*nCons/sims, "%\n"),
          paste("Liberal = ", 100*nAnti/sims, "%\n"))
cat(result)

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,993 posts in 4,828 threads, 1,656 registered users;
111 visitors (0 registered, 111 guests [including 2 identified bots]).
Forum time: 02:41 CEST (Europe/Vienna)

Never never never never use Excel.
Not even for calculation of arithmetic means.    Martin Wolfsegger

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