Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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.

Note

Any less than detection limit values represented by negative values, or zeros or other numeric codes representing blanks in the data, must be removed prior to executing this function, see ltdl.fix.df.

Any data vectors (rows) containing NAs are removed prior to computation.

This function is not recommended for use with closed compositional data sets, i.e. geochemical analyses, unless correlations are sought between a non-compositional variable and individual compositional variables. If it is used with compositional data, it is highly recommended that ifclr be set to TRUE to remove the effects of closure and display the ‘true’ inter-element variability. However, different groups of elements, subsets, of a data set will yield different inter-element correlations for the same pair of elements due to the nature of the clr transform. When carrying out a centred log-ratio transformation it is essential that the data are all in the same measurement units, and by default a reminder/warning is display if the data are centred log-ratio transformed, see ifwarn above.

For working with compositional data sets functions gx.symm.coords.r, gx.vm and gx.sm are recommended. For visual displays see gx.pairs4parts and gx.plot2parts.

When a centred log-ratio transformation is undertaken the log ‘switch’ is ignored.

Author(s)

Robert G. Garrett

See Also

Examples

## 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)

rgr

Applied Geochemistry EDA

v1.1.15
GPL-2
Authors
Robert G. Garrett
Initial release
2018-03-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.