gx.symm.coords.r: Displays a Matrix of Correlation Coefficients based on...

Description Usage Arguments Value Note Author(s) References See Also Examples

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

1
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

gx.symm.coords, gx.symm.coords.plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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)

Example output

Loading required package: MASS
Loading required package: fastICA
  ** Are the data/parts all in the same measurement units? **

  Symmetric coordinate 'spearman' coefficients and untransformed 'spearman' coefficients 
       Upper and lower triangles, respectively, for nockolds, N = 16

       Si    Al   Fe3   Fe2    Mg    Ca    Na     K    Ti    Mn     P    OH
Si         0.87 -0.58 -0.38 -0.66 -0.55  0.56  0.74 -0.79 -0.40 -0.16  0.71
Al  -0.44       -0.54 -0.67 -0.82 -0.44  0.77  0.75 -0.80 -0.42 -0.27  0.60
Fe3 -0.79  0.36        0.45  0.54  0.22 -0.22 -0.13  0.46  0.84  0.08 -0.19
Fe2 -0.74 -0.04  0.80        0.93  0.51 -0.88 -0.59  0.67  0.41 -0.06 -0.23
Mg  -0.76  0.00  0.76  0.98        0.71 -0.86 -0.77  0.92  0.44  0.11 -0.30
Ca  -0.78  0.54  0.63  0.57  0.64       -0.32 -0.76  0.82  0.10  0.09 -0.30
Na  -0.13  0.77  0.20 -0.28 -0.30  0.21        0.64 -0.68 -0.25  0.01  0.47
K    0.66  0.06 -0.30 -0.56 -0.63 -0.63  0.29       -0.74 -0.30  0.47  0.41
Ti  -0.79  0.37  0.94  0.84  0.83  0.71  0.13 -0.36        0.41  0.15 -0.35
Mn  -0.77  0.19  0.84  0.76  0.70  0.37  0.06 -0.37  0.78       -0.21 -0.01
P   -0.40  0.40  0.75  0.49  0.50  0.62  0.30  0.00  0.79  0.37       -0.62
OH  -0.51  0.23  0.41  0.50  0.52  0.34  0.10 -0.48  0.54  0.53  0.17      

  ** Are the data/parts all in the same measurement units? **

  Symmetric coordinate 'spearman' coefficients and untransformed 'spearman' coefficients 
       Upper and lower triangles, respectively, for nockolds, N = 16

       Si    Al   Fe3   Fe2    Mg    Ca    Na     K    Ti    Mn     P    OH
Si         0.87 -0.58 -0.38 -0.66 -0.55  0.56  0.74 -0.79 -0.40 -0.16  0.71
Al  -0.44       -0.54 -0.67 -0.82 -0.44  0.77  0.75 -0.80 -0.42 -0.27  0.60
Fe3 -0.79  0.36        0.45  0.54  0.22 -0.22 -0.13  0.46  0.84  0.08 -0.19
Fe2 -0.74 -0.04  0.80        0.93  0.51 -0.88 -0.59  0.67  0.41 -0.06 -0.23
Mg  -0.76  0.00  0.76  0.98        0.71 -0.86 -0.77  0.92  0.44  0.11 -0.30
Ca  -0.78  0.54  0.63  0.57  0.64       -0.32 -0.76  0.82  0.10  0.09 -0.30
Na  -0.13  0.77  0.20 -0.28 -0.30  0.21        0.64 -0.68 -0.25  0.01  0.47
K    0.66  0.06 -0.30 -0.56 -0.63 -0.63  0.29       -0.74 -0.30  0.47  0.41
Ti  -0.79  0.37  0.94  0.84  0.83  0.71  0.13 -0.36        0.41  0.15 -0.35
Mn  -0.77  0.19  0.84  0.76  0.70  0.37  0.06 -0.37  0.78       -0.21 -0.01
P   -0.40  0.40  0.75  0.49  0.50  0.62  0.30  0.00  0.79  0.37       -0.62
OH  -0.51  0.23  0.41  0.50  0.52  0.34  0.10 -0.48  0.54  0.53  0.17      

  ** Are the data/parts all in the same measurement units? **

  Symmetric coordinate 'pearson' coefficients and log transformed 'pearson' coefficients 
       Upper and lower triangles, respectively, for nockolds, N = 16

       Si    Al   Fe3   Fe2    Mg    Ca    Na     K    Ti    Mn     P    OH
Si         0.69 -0.61 -0.26 -0.39 -0.48  0.44  0.64 -0.77 -0.26 -0.24  0.77
Al   0.18       -0.73 -0.76 -0.80 -0.06  0.86  0.69 -0.56 -0.66  0.24  0.44
Fe3 -0.78 -0.05        0.58  0.67  0.14 -0.39 -0.26  0.52  0.81 -0.01 -0.30
Fe2 -0.75 -0.42  0.78        0.96  0.40 -0.95 -0.78  0.61  0.63 -0.48  0.05
Mg  -0.77 -0.54  0.68  0.96        0.56 -0.94 -0.85  0.74  0.56 -0.35  0.02
Ca  -0.74  0.26  0.60  0.65  0.64       -0.21 -0.66  0.71 -0.23  0.13 -0.25
Na   0.12  0.87  0.10 -0.45 -0.58  0.09        0.77 -0.49 -0.43  0.54  0.23
K    0.59  0.51 -0.16 -0.63 -0.73 -0.47  0.65       -0.62 -0.24  0.46  0.29
Ti  -0.78  0.08  0.86  0.80  0.72  0.83  0.07 -0.30        0.28  0.05 -0.29
Mn  -0.65 -0.30  0.88  0.78  0.65  0.31 -0.10 -0.23  0.67       -0.17  0.02
P   -0.29  0.52  0.58  0.21  0.07  0.50  0.64  0.37  0.58  0.36       -0.66
OH  -0.51 -0.03  0.47  0.45  0.42  0.36  0.00 -0.32  0.59  0.48 -0.01      

rgr documentation built on May 2, 2019, 6:09 a.m.

Related to gx.symm.coords.r in rgr...