View source: R/mcnemartestClust.R
| mcnemartestClust | R Documentation |
Performs a test of marginal homogeneity of paired clustered data with potentially informative cluster size.
mcnemartestClust(x, y, id, variance = c("MoM", "emp"))
x, y |
vector or factor objects of equal length. |
id |
a vector or factor object which identifies the clusters. The length of |
variance |
character string specifying the method of variance estimation. Must be one of " |
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.
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. |
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.