icstestClust {htestClust} | R Documentation |
Test for Informative Cluster Size
Description
Performs a test for informative cluster size.
Usage
icstestClust(x, id, test.method = c("TF", "TCM"), B = 1000, print.it = TRUE)
Arguments
x |
a vector of numeric responses. Can also be a data frame. |
id |
a vector or factor object which identifies the clusters; ignored if |
test.method |
character string specifying the method of construction for the test statistic.
Must be one of " |
B |
the number of bootstrap iterations. |
print.it |
a logical indicating whether to print the progression of bootstrap iterations. |
Details
The null is that the marginal distributions of the responses are independent of the cluster sizes. A small p-value is evidence for the presence of informative cluster size.
When test.method = "TF"
, the test statistic is constructed based on differences between the null and
alternative distribution functions. "TF
" is the suggested method when there are a large
number of unique cluster sizes and the number of clusters of each size is small. When test.method = "TCM"
,
the test statistic is a multisample Cramer von Mises-based test. This method is recommended
when there are a small number of possible cluster sizes. See Nevalainen et al. (2017) for more details.
When x
is a data frame, the first column should contain values denoting cluster membership and
the second column the responses.
This test is computationally intensive and can take significant time to execute. print.it
defaults to
TRUE
to identify the bootstrap progression.
Value
A list with class "htest
" containing the following components:
statistic |
the value of the test statistic. |
p.value |
the p-value of the test. |
method |
a character string indicating the test performed and the method of construction. |
data.name |
a character string giving the name(s) of the data. |
References
Nevalainen, J., Oja, H., Datta, S. (2017) Tests for informative cluster size using a novel balanced bootstrap scheme. Statistics in Medicine, 36, 2630–2640.
Examples
data(screen8)
## using vectors
## test if cluster size is related to math scores
icstestClust(screen8$math, screen8$sch.id, B=100)
## same test, but using a data frame and supressing iterations
tdat <- data.frame(screen8$sch.id, screen8$math)
icstestClust(tdat, B=100, print.it = FALSE)