R: Pairwise Tests for Association/Correlation Between Paired...

pairwise.cor.test {MESS} | R Documentation

## Pairwise Tests for Association/Correlation Between Paired Samples

### Description

Calculate pairwise correlations between group levels with corrections for multiple testing.

### Usage

    pairwise.cor.test(
      x,
      g,
      p.adjust.method = p.adjust.methods,
      method = c("pearson", "kendall", "spearman"),
      ...
    )

### Arguments

`x` | response vector.
`g` | grouping vector or factor.
`p.adjust.method` | method for adjusting p values (see `p.adjust`). Can be abbreviated.
`method` | string argument to set the method to compute the correlation. Possibilities are "pearson" (the default), "kendall", and "spearman"
`...` | additional arguments passed to `cor.test`.

### Details

Note that correlation tests require that the two vectors examined are of the same length. Thus, if the grouping defines groups of varying lengths then the specific correlation is not computed and a `NA` is returned instead. The adjusted p values are only based on the actual correlation that are computed. Extra arguments that are passed on to `cor.test` may or may not be sensible in this context.

### Value

Object of class `pairwise.htest`

### Examples

    attach(airquality)
    Month <- factor(Month, labels = month.abb[5:9])
    pairwise.cor.test(Ozone, Month)
    pairwise.cor.test(Ozone, Month, p.adj = "bonf")
    detach()

[Package MESS version 0.5.9 Index]