Testing the independence of two numeric variables.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
## S3 method for class 'formula'
spearman_test(formula, data, subset = NULL, weights = NULL, ...)
## S3 method for class 'IndependenceProblem'
spearman_test(object, distribution = c("asymptotic", "approximate", "none"), ...)
## S3 method for class 'formula'
fisyat_test(formula, data, subset = NULL, weights = NULL, ...)
## S3 method for class 'IndependenceProblem'
fisyat_test(object, distribution = c("asymptotic", "approximate", "none"),
ties.method = c("mid-ranks", "average-scores"), ...)
## S3 method for class 'formula'
quadrant_test(formula, data, subset = NULL, weights = NULL, ...)
## S3 method for class 'IndependenceProblem'
quadrant_test(object, distribution = c("asymptotic", "approximate", "none"),
mid.score = c("0", "0.5", "1"), ...)
## S3 method for class 'formula'
koziol_test(formula, data, subset = NULL, weights = NULL, ...)
## S3 method for class 'IndependenceProblem'
koziol_test(object, distribution = c("asymptotic", "approximate", "none"),
ties.method = c("mid-ranks", "average-scores"), ...)
``` |

`formula` |
a formula of the form |

`data` |
an optional data frame containing the variables in the model formula. |

`subset` |
an optional vector specifying a subset of observations to be used. Defaults
to |

`weights` |
an optional formula of the form |

`object` |
an object inheriting from class |

`distribution` |
a character, the conditional null distribution of the test statistic can be
approximated by its asymptotic distribution ( |

`ties.method` |
a character, the method used to handle ties: the score generating function
either uses mid-ranks ( |

`mid.score` |
a character, the score assigned to observations exactly equal to the median:
either 0 ( |

`...` |
further arguments to be passed to |

`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.

An object inheriting from class `"IndependenceTest"`

.

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.

1 2 3 4 5 6 7 8 9 10 11 | ```
## 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)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.