SO.trend.test {CorrBin}  R Documentation 
Likelihood ratio test of stochastic ordering
Description
Performs a likelihood ratio test of stochastic ordering versus equality using
permutations to estimate the nulldistribution and the pvalue. If only the
value of the test statistic is needed, use SO.LRT
instead.
Usage
SO.trend.test(cbdata, R = 100, control = soControl())
Arguments
cbdata 
a 
R 
an integer – the number of random permutations for estimating the null distribution. 
control 
an optional list of control settings, usually a call to

Details
The test is valid only under the assumption that the clustersize distribution does not depend on group. During the estimation of the nulldistribution the group assignments of the clusters are permuted keeping the group sizes constant; the withingroup distribution of the clustersizes will vary randomly during the permutation test.
The default value of R
is probably too low for the final data
analysis, and should be increased.
Value
A list with the following components
LRT 
the value of the likelihood ratio test statistic. It has two
attributes: 
p.val 
the estimated onesided pvalue. 
boot.res 
an object of class "boot" with the detailed results of
the permutations. See 
Author(s)
Aniko Szabo, aszabo@mcw.edu
References
Szabo A, George EO. (2010) On the Use of Stochastic Ordering to Test for Trend with Clustered Binary Data. Biometrika 97(1), 95108.
See Also
SO.LRT
for calculating only the test statistic,
soControl
Examples
data(shelltox)
set.seed(45742)
sh.test < SO.trend.test(shelltox, R=10, control=soControl(eps=0.1, max.directions=25))
sh.test
#a plot of the resampled LRT values
#would look better with a reasonable value of R
null.vals < sh.test$boot.res$t[,1]
hist(null.vals, breaks=10, freq=FALSE, xlab="Test statistic", ylab="Density",
main="Simulated nulldistribution", xlim=range(c(0,20,null.vals)))
points(sh.test$LRT, 0, pch="*",col="red", cex=3)