Last chance! 50% off unlimited learning
Sale ends in
Computes the CDF of the Baumgartner-Weiss-Schindler test statistic under the null hypothesis of equal distributions.
bws_cdf(b, maxj = 5L, lower_tail = TRUE)
A vector of the CDF of
a vector of BWS test statistics.
the maximum value of j to take in the approximate computation of the CDF via equation (2.5). Baumgartner et. al. claim that a value of 3 is sufficient.
boolean, when TRUE
returns
Steven E. Pav shabbychef@gmail.com
Given value
The expression for the CDF contains the integral
W. Baumgartner, P. Weiss, H. Schindler, 'A nonparametric test for the general two-sample problem', Biometrics 54, no. 3 (Sep., 1998): pp. 1129-1135. tools:::Rd_expr_doi("10.2307/2533862")
bws_stat
, bws_test
# do it 500 times
set.seed(123)
bvals <- replicate(500, bws_stat(rnorm(50),rnorm(50)))
pvals <- bws_cdf(bvals)
# these should be uniform!
# \donttest{
plot(ecdf(pvals))
# }
# compare to Table 1 of Baumgartner et al.
bvals <- c(1.933,2.493,3.076,3.880,4.500,5.990)
tab1v <- c(0.9,0.95,0.975,0.990,0.995,0.999)
pvals <- bws_cdf(bvals,lower_tail=TRUE)
show(data.frame(B=bvals,BWS_psi=tab1v,our_psi=pvals))
Run the code above in your browser using DataLab