Testing the independence of two numeric variables.
# S3 method for formula
spearman_test(formula, data, subset = NULL, weights = NULL, ...)
# S3 method for IndependenceProblem
spearman_test(object, distribution = c("asymptotic", "approximate", "none"), ...)# S3 method for formula
fisyat_test(formula, data, subset = NULL, weights = NULL, ...)
# S3 method for IndependenceProblem
fisyat_test(object, distribution = c("asymptotic", "approximate", "none"),
ties.method = c("mid-ranks", "average-scores"), ...)
# S3 method for formula
quadrant_test(formula, data, subset = NULL, weights = NULL, ...)
# S3 method for IndependenceProblem
quadrant_test(object, distribution = c("asymptotic", "approximate", "none"),
mid.score = c("0", "0.5", "1"), ...)
# S3 method for formula
koziol_test(formula, data, subset = NULL, weights = NULL, ...)
# S3 method for IndependenceProblem
koziol_test(object, distribution = c("asymptotic", "approximate", "none"),
ties.method = c("mid-ranks", "average-scores"), ...)
An object inheriting from class "IndependenceTest".
a formula of the form y ~ x | block where y and x are
numeric variables and block is an optional factor for stratification.
an optional data frame containing the variables in the model formula.
an optional vector specifying a subset of observations to be used. Defaults
to NULL.
an optional formula of the form ~ w defining integer valued case
weights for each observation. Defaults to NULL, implying equal
weight for all observations.
an object inheriting from class "IndependenceProblem".
a character, the conditional null distribution of the test statistic can be
approximated by its asymptotic distribution ("asymptotic", default)
or via Monte Carlo resampling ("approximate"). Alternatively, the
functions asymptotic or approximate can be used.
Computation of the null distribution can be suppressed by specifying
"none".
a character, the method used to handle ties: the score generating function
either uses mid-ranks ("mid-ranks", default) or averages the scores
of randomly broken ties ("average-scores").
a character, the score assigned to observations exactly equal to the median:
either 0 ("0", default), 0.5 ("0.5") or 1 ("1"); see
median_test().
further arguments to be passed to independence_test().
spearman_test(), fisyat_test(), quadrant_test() and
koziol_test() provide the Spearman correlation test, the Fisher-Yates
correlation test using van der Waerden scores, the quadrant test and the
Koziol-Nemec test. A general description of these methods is given by
Hájek, Šidák and Sen (1999, Sec. 4.6). The
Koziol-Nemec test was suggested by Koziol and Nemec (1979). For the
adjustment of scores for tied values see Hájek,
Šidák and Sen (1999, pp. 133--135).
The null hypothesis of independence, or conditional independence given
block, between y and x is tested.
The conditional null distribution of the test statistic is used to obtain
\(p\)-values and an asymptotic approximation of the exact distribution is
used by default (distribution = "asymptotic"). Alternatively, the
distribution can be approximated via Monte Carlo resampling by setting
distribution to "approximate". See asymptotic()
and approximate() for details.
Hájek, J., Šidák, Z. and Sen, P. K. (1999). Theory of Rank Tests, Second Edition. San Diego: Academic Press.
Koziol, J. A. and Nemec, A. F. (1979). On a Cramér-von Mises type statistic for testing bivariate independence. The Canadian Journal of Statistics 7(1), 43--52. tools:::Rd_expr_doi("10.2307/3315014")
## Asymptotic Spearman test
spearman_test(CONT ~ INTG, data = USJudgeRatings)
## Asymptotic Fisher-Yates test
fisyat_test(CONT ~ INTG, data = USJudgeRatings)
## Asymptotic quadrant test
quadrant_test(CONT ~ INTG, data = USJudgeRatings)
## Asymptotic Koziol-Nemec test
koziol_test(CONT ~ INTG, data = USJudgeRatings)
Run the code above in your browser using DataLab