Test for marginal association between paired samples in clustered data with potentially informative cluster size.
cortestClust(x, ...)# S3 method for default
cortestClust(
x,
y,
id,
method = c("pearson", "kendall", "spearman"),
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95,
...
)
# S3 method for formula
cortestClust(formula, id, data, subset, na.action, ...)
numeric vectors of data values.
further arguments to be passed to or from methods.
a vector or factor object which identifies the clusters. The length of id
should be the
same as the number of observations.
a character string indicating which correlation coefficient is to be used for the test.
One of "pearson
", "kendall
", or "spearman
". Can be abbreviated.
indicates the alternative hypothesis and must be one of "two.sided
", "greater
",
or "less
".You can specify just the initial letter. "greater
" corresponds to positive association,
"less
" to negative association.
confidence level for the returned confidence interval.
a formula of the form ~ u + v, where each of u
and v
are numeric variables
giving the data values for one sample. The samples must be of the sample length.
an optional matrix or data frame containing variables in the formula formula
. By default the
variables are taken from environment(formula)
.
an optional vector specifying a subset of observations to be used.
a function which indicates what should happen when data contain NA
s. Defaults to
getOption("na.action")
.
A list with class "htest
" containing the following components:
the value of the test statistic.
the p-value of the test.
the estimated measure of marginal association, with name "cluster-weighted cor
",
"cluster-weighted tau
", or "cluster-weighted rho
" corresponding to the method employed.
the value of the association measure under the null hypothesis, always 0.
a confidence interval for the measure of association.
a character string describing the alternative hypothesis.
a character string indicating how the association was measured.
a character string giving the name(s) of the data and the total number of clusters.
the number of clusters.
The three methods each estimate the marginal association between paired observations from clustered data and compute a test of the value being zero.
If method
is "pearson
" ("kendall
"), the test statistic is based on the
Pearson product-moment (Kendall concordance coefficient) analog of Lorenz et al. (2011).
If method
is "spearman
", the test statistic
is based on the Spearman coefficient analog of Lorenz et al. (2018) modified for paired data.
Lorenz, D., Datta, S., Harkema, S. (2011) Marginal association measures for clustered data. Statistics in Medicine, 30, 3181--3191.
Lorenz, D., Levy, S., Datta, S. (2018) Inferring marginal association with paired and unpaired clustered data. Stat. Methods Med. Res., 27, 1806--1817.
# NOT RUN {
data(screen8)
## test if math and reading scores are marginally correlated using vectors
cortestClust(screen8$read, screen8$math, screen8$sch.id)
## formula interface
cortestClust(~ math + read, sch.id, data=screen8, method="kendall")
# }
Run the code above in your browser using DataLab