Learn R Programming

rgr (version 1.1.15)

gx.pearson: Display Pearson Correlation Coefficients and their Significances

Description

The function computes Pearson product moment correlation coefficients and places them in the upper triangle of a printed matrix displayed on the current device, the probabilities that the coefficients are not due to chance (Ho: Coefficient = 0) are printed in the lower triangle. The diagonal is filled with NAs to visually split the two triangles.

Usage

gx.pearson(xx, log = FALSE, ifclr = FALSE, ifwarn = TRUE)

Arguments

xx

a matrix of numeric data.

log

if log = TRUE the data are log10 transformed prior to computation of the Pearson coefficients. The default is no transformation.

ifclr

if ifclr = TRUE the data are Centred Log-Ratio transformed prior to the computation of the Pearson Coefficients. The default is no transformation.

ifwarn

by default ifwarn = TRUE which generates a reminder/warning that when carrying out a centred log-ratio transformation all the data must be in the same measurement units. The message can be suppressed by setting ifwarn = FALSE.

See Also

ltdl.fix.df, remove.na, clr, sind.mat2open

Examples

Run this code
# NOT RUN {
## Make test data available
data(sind.mat2open)

## Compute Pearson correlation coefficients
gx.pearson(sind.mat2open)

## Compute Pearson correlation coefficients following
## a logarithmic transformation
gx.pearson(sind.mat2open, log = TRUE)

## Compute Pearson correlation coefficients following
## a centred log-ratio transformation
gx.pearson(sind.mat2open, ifclr = TRUE)
# }

Run the code above in your browser using DataLab