simulation [Nonparametrics]

posted by martin  – Austria, 2010-09-14 10:33 (5263 d 18:39 ago) – Posting: # 5907
Views: 21,895

dear HS and d_labes!

you may find the following simulation results interesting

rm(list=ls(all=TRUE))
library(coin)
library(exactRankTests)

set.seed(130910)
n <- 10
nsim <- 1E4
cover1 <- 0
cover2 <- 0
grp <- as.factor(c(rep('A', n), rep('B', n)))
for(i in 1:nsim){
    x <- c(round(rnorm(n, mean=0, sd=1),1), round(rnorm(n, mean=0, sd=1),1))
    res1 <- confint(wilcox_test(x~grp, distribution='exact', conf.int=TRUE,
    conf.level=0.95))$conf.int
    res2 <- wilcox.exact(x~grp, conf.int=TRUE, conf.level=0.95)$conf.int
      if(res1[1] < 0 & res1[2] > 0){cover1 <- cover1 + 1}
      if(res2[1] < 0 & res2[2] > 0){cover2 <- cover2 + 1}
  }
print(cover1/nsim)
[1] 0.937
print(cover2/nsim)
[1] 0.9505

prop.test(x=c(cover1, cover2), n=c(nsim, nsim))

        2-sample test for equality of proportions with continuity correction

data:  c(cover1, cover2) out of c(nsim, nsim)
X-squared = 16.9122, df = 1, p-value = 3.915e-05
alternative hypothesis: two.sided
95 percent confidence interval:
 -0.01998361 -0.00701639
sample estimates:
prop 1 prop 2
0.9370 0.9505


best regards
martin

Complete thread:

UA Flag
Activity
 Admin contact
23,379 posts in 4,913 threads, 1,661 registered users;
257 visitors (0 registered, 257 guests [including 17 identified bots]).
Forum time: 04:12 CET (Europe/Vienna)

Statistics is the art of never having to say you’re wrong.
Variance is what any two statisticians are at.    C.J. Bradfield

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