mcnemartestClust {htestClust}R Documentation

Test of Marginal Homogeneity for Clustered Data

Description

Performs a test of marginal homogeneity of paired clustered data with potentially informative cluster size.

Usage

mcnemartestClust(x, y, id, variance = c("MoM", "emp"))

Arguments

x, y

vector or factor objects of equal length.

id

a vector or factor object which identifies the clusters. The length of id must be the same as the length of x.

variance

character string specifying the method of variance estimation. Must be one of "MoM" or "emp".

Details

The null is that the marginal probabilities of being classified into cells [i,j] and [j,i] are equal.

Arguments x, y, and id must be vectors or factors of the same length. Incomplete cases are removed.

When variance is MoM, a method of moments variance estimate evaluated under the null is used. This is equivalent to the test by Durkalski et al. (2003). When variance is emp, an empirical variance estimate is used. See Gregg (2020) for details.

Value

A list with class "htest" containing the following components:

statistic

the value of the test statistic.

parameter

the degrees of freedom of the approximate chi-squared distribution of the test statistic.

p.value

the p-value of the test.

method

a character string indicating the test performed and which variance estimation method was used.

data.name

a character string giving the name(s) of the data and the total number of clusters.

M

the number of clusters.

References

Durkalski, V., Palesch, Y., Lipsitz, S., Rust, P. (2003). Analysis of clustered matched pair data. Statistics in Medicine, 22, 2417–2428.

Gregg, M., Marginal methods and software for clustered data with cluster- and group-size informativeness. PhD dissertation, University of Louisville, 2020.

Examples

data(screen8)
## Is marginal proportion of students in lowest fitness category
## at the end of year equal to the beginning of year?
screen8$low.start <- 1*(screen8$qfit.s=='Q1')
screen8$low.end <- 1*(screen8$qfit=='Q1')
mcnemartestClust(screen8$low.start, screen8$low.end, screen8$sch.id)


[Package htestClust version 0.2.2 Index]