SO.trend.test {CorrBin} | R Documentation |
Performs a likelihood ratio test of stochastic ordering versus equality using
permutations to estimate the null-distribution and the p-value. If only the value
of the test statistic is needed, use SO.LRT
instead.
SO.trend.test(cbdata, R = 100, control = soControl())
cbdata |
a CBData object. |
R |
an integer – the number of random permutations for estimating the null distribution. |
control |
an optional list of control settings, usually a call to soControl .
See there for the names of the settable control values and their effect. |
The test is valid only under the assumption that the cluster-size distribution does not depend on group. During the estimation of the null-distribution the group assignments of the clusters are permuted keeping the group sizes constant; the within-group distribution of the cluster-sizes 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.
A list with the following components
LRT |
the value of the likelihood ratio test statistic. It has two attributes: ll0 and ll1 -
the values of the log-likelihood under H0 and Ha respectively. |
p.val |
the estimated one-sided p-value. |
boot.res |
an object of class "boot" with the detailed results of the permutations.
See boot for details. |
Aniko Szabo, aszabo@mcw.edu
Szabo A, George EO. (2009) On the Use of Stochastic Ordering to Test for Trend with Clustered Binary Data.
SO.LRT
for calculating only the test statistic, soControl
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 null-distribution", xlim=range(c(0,20,null.vals))) points(sh.test$LRT, 0, pch="*",col="red", cex=3)