AntoineSoetewey / statsandr

A blog on statistics and R aiming at helping academics and professionals working with data to grasp important concepts in statistics and to apply them in R. See www.statsandr.com
http://statsandr.com/
36 stars 16 forks source link

idea #6

Closed krzysiektr closed 4 years ago

krzysiektr commented 4 years ago

Note that the presence of equal elements (ties) prevents an exact p-value calculation

Other functions calculate ?

> library("coin")
> wilcox_test(Grade ~ Sex,data= dat,alternative= "less",distribution = exact())

    Exact Wilcoxon-Mann-Whitney Test

data:  Grade by Sex (Boy, Girl)
Z = -2.3449, p-value = 0.008815
alternative hypothesis: true mu is less than 0
> library("coin")
> wilcox_test(Grade ~ Sex,data= dat,alternative= "less")

    Asymptotic Wilcoxon-Mann-Whitney Test

data:  Grade by Sex (Boy, Girl)
Z = -2.3449, p-value = 0.009516
alternative hypothesis: true mu is less than 0

Solution for stochastic equality:

library("nparcomp")
r1 <- npar.t.test(Grade ~ Sex,data= dat,alternative= "less",method="t.app",rounds=6)
summary(r1)

       Effect Estimator    Lower Upper        T  p.Value
1 p(Boy,Girl)   0.78125 0.612167     1 2.861507 0.004655
library("nparcomp")
r2 <- npar.t.test(Grade ~ Sex,data= dat,alternative= "less",method="permu",rounds=6)
summary(r2)

       Estimator Statistic    Lower    Upper p.value
id       0.78125  2.861507 0.573536 0.995312  0.0087
logit    0.78125  2.213386 0.560774 0.911383  0.0082
probit   0.78125  2.331348 0.562881 0.920822  0.0083
AntoineSoetewey commented 4 years ago

Dear Krzysztof,

Thanks for your suggestion, they have been included in the article.