Description Usage Arguments Note Author(s) See Also Examples
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.
1 | gx.pearson(xx, log = FALSE, ifclr = FALSE, ifwarn = TRUE)
|
xx |
a matrix of numeric data. |
log |
if |
ifclr |
if |
ifwarn |
by default |
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 NA
s 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.
Robert G. Garrett
ltdl.fix.df
, remove.na
, clr
, sind.mat2open
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## 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)
|
Loading required package: MASS
Loading required package: fastICA
Pearson Correlation Coefficients and their Statistical Significance,
upper and lower triangles, respectively, for matrix sind.mat2open, N = 25
Zn Fe Mn Cd Cu Pb
Zn 0.296 0.208 0.967 0.969 0.096
Fe 0.925 0.743 0.428 0.194 0.723
Mn 0.841 1.000 0.404 0.051 0.830
Cd 1.000 0.984 0.977 0.906 0.267
Cu 1.000 0.824 0.596 1.000 -0.026
Pb 0.677 1.000 1.000 0.902 0.550
Data have been Log10 transformed
Pearson Correlation Coefficients and their Statistical Significance,
upper and lower triangles, respectively, for matrix sind.mat2open, N = 25
Zn Fe Mn Cd Cu Pb
Zn 0.664 0.547 0.908 0.954 0.300
Fe 1.000 0.777 0.643 0.545 0.625
Mn 0.998 1.000 0.556 0.388 0.659
Cd 1.000 1.000 0.998 0.924 0.323
Cu 1.000 0.998 0.972 1.000 0.215
Pb 0.927 1.000 1.000 0.942 0.848
** Are the data/parts all in the same measurement units? **
Data have been Centred Log-Ratio transformed
Pearson Correlation Coefficients and their Statistical Significance,
upper and lower triangles, respectively, for matrix sind.mat2open, N = 25
Zn Fe Mn Cd Cu Pb
Zn -0.746 -0.688 0.348 0.839 -0.865
Fe 1.000 0.614 -0.630 -0.844 0.714
Mn 1.000 0.999 -0.560 -0.874 0.605
Cd 0.956 1.000 0.998 0.597 -0.609
Cu 1.000 1.000 1.000 0.999 -0.843
Pb 1.000 1.000 0.999 0.999 1.000
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.