simulation [Nonparametrics]

posted by martin  – Austria, 2010-09-14 10:33 (4966 d 20:51 ago) – Posting: # 5907
Views: 20,373

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
22,988 posts in 4,825 threads, 1,654 registered users;
104 visitors (0 registered, 104 guests [including 4 identified bots]).
Forum time: 07:24 CEST (Europe/Vienna)

The whole purpose of education is
to turn mirrors into windows.    Sydney J. Harris

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