Learn R Programming

CorrBin (version 1.6.2)

SO.trend.test: Likelihood ratio test of stochastic ordering

Description

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.

Usage

SO.trend.test(cbdata, R = 100, control = soControl())

Value

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 \(H_0\) and \(H_a\) 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.

Arguments

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.

Author

Aniko Szabo, aszabo@mcw.edu

Details

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.

References

Szabo A, George EO. (2010) On the Use of Stochastic Ordering to Test for Trend with Clustered Binary Data. Biometrika 97(1), 95-108.

See Also

SO.LRT for calculating only the test statistic, soControl

Examples

Run this code

# \donttest{
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)
# }

Run the code above in your browser using DataLab