Learn R Programming

MESS (version 0.5.7)

pairwise.cor.test: 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.

Value

Object of class pairwise.htest

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.

Examples

Run this code
# NOT RUN {
attach(airquality)
Month <- factor(Month, labels = month.abb[5:9])
pairwise.cor.test(Ozone, Month)
pairwise.cor.test(Ozone, Month, p.adj = "bonf")
detach()
# }

Run the code above in your browser using DataLab