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

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/Reprod.R

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

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

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.

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.

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 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.

Author(s)

Aniko Szabo, aszabo@mcw.edu

References

Szabo A, George EO. (2009) On the Use of Stochastic Ordering to Test for Trend with Clustered Binary Data.

See Also

SO.LRT for calculating only the test statistic, soControl

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(shelltox)
set.seed(45742)
sh.test <- SO.trend.test(shelltox, R=5, 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)

CorrBin documentation built on May 2, 2019, 4:46 p.m.