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

gx.symm.coords.r

Displays a Matrix of Correlation Coefficients based on Symmetric Balances


Description

Computes and displays a p by p matrix of correlation coefficients based on symmetric balances for a n by p matrix or data frame of compositional data. Computation of the correlation coefficients is by any valid R method, by default "spearman". The symmetric balance coefficients are displayed in the upper triangle, and for comparison, the correlation coefficients of the input data are displayed in the lower triangle. If "pearson" coefficients are required the option of a log transformation for the data is provided.

Usage

gx.symm.coords.r(x, log = FALSE, method = "spearman" )

Arguments

x

n by p matrix or data frame of compositional data for which the correlation coefficients will be computed.

log

to compute the non-symmetric balance coefficients with a logarithmic transformation and plot scaling, set log = TRUE.

method

the valid R method for computation of the correlation coefficients, the default is "spearman".

Value

r.sbs

the p by p matrix of correlation coefficients.

Note

For compositional data analysis all the data must be in the same measurement units.

The "spearman" coefficient is preferred for EDA as any systematic monotonic variation in the data is of interest, and may be worthy of further investigation. As "spearman" coefficients are based on ranks, any monotonic data transformation, e.g., logarithmic, has no impact on the results. This is not the case for "pearson" coefficients.

Author(s)

Robert G. Garrett

References

Garrett, R.G., Reimann, C., Hron, K., Kynclova, P. and Filzmoser, P., 2017. Finally, a correlation coefficient that tells the geochemical truth. Explore - Assoc. Applied Geochemists Newsletter, 176:1-10.

Reimann, C., Filzmoser, P., Hron, K., Kynclova, P. and Garrett, R.G., 2017. Correlation Analysis for Compositional (Environmental) Data. Science of the Total Environment, 607-608:965-971.

See Also

Examples

## Make test data available
data(nockolds)

## Compute and display correlation coefficients for the nockolds data
gx.symm.coords.r(nockolds)

## Save the matrix for further use
save <- gx.symm.coords.r(nockolds)

## Compute and display correlation coefficients for the nockolds data
## based on pearson product moment correlation coefficients with a
## logarithmic transform for the non-symmetric balance coefficients
gx.symm.coords.r(nockolds, method = "pearson", log = TRUE)

## Clean-up
rm(nockolds)
rm(save)

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.