svyranktest {survey} | R Documentation |
Design-based versions of two-sample rank tests. The built-in tests are all for location hypotheses, but the user can specify others.
svyranktest(formula, design, test = c("wilcoxon", "vanderWaerden", "median"), ...)
formula |
Model formula |
design |
A survey design object |
test |
Which rank test to use: Wilcoxon, van der Waerden's normal-scores
test, Mood's test for the median, or a function |
... |
for future expansion |
Object of class htest
as
data(api) dclus1<-svydesign(id=~dnum, weights=~pw, fpc=~fpc, data=apiclus1) svyranktest(ell~comp.imp, dclus1) svyranktest(ell~comp.imp, dclus1, test="median") ## upper quartile svyranktest(ell~comp.imp, dclus1, test=function(r,N) as.numeric(r>0.75*N)) quantiletest<-function(p){ rval<-function(r,N) as.numeric(r>(N*p)) attr(rval,"name")<-paste(p,"quantile") rval } svyranktest(ell~comp.imp, dclus1, test=quantiletest(0.5)) svyranktest(ell~comp.imp, dclus1, test=quantiletest(0.75))