correlations {FORTLS} | R Documentation |
Correlation Between Field Estimations and TLS Metrics
Description
Computes correlations between variables estimates from field data and metrics derived from TLS data. Field estimates and TLS metrics for a common set of plots are required in order to compute correlations. These data must be obtained from any of the three different plot designs currently available (fixed area, k-tree and angle-count), and correspond to plots with incremental values for the plot design parameter (radius, k and BAF, respectively). Two correlation measures are implemented: Pearson's correlation coefficient and Spearman's rho. In addition to estimating these measures, tests for association are also executed, and interactive line charts graphically representing correlations are generated.
Usage
correlations(simulations,
variables = c("N", "G", "V", "d", "dg", "d.0", "h", "h.0"),
method = c("pearson", "spearman"), save.result = TRUE,
dir.result = NULL)
Arguments
simulations |
List including estimated variables based on field data and metrics
derived from TLS data. The structure and format must be analogous to output
returned by the
|
variables |
Optional character vector naming field estimates for which correlations
between these and all the available TLS metrics will be computed. If
this argument is specified by the user, it must include at least one of the
following character strings: “
|
method |
Optional character vector naming which correlation measurements will be used.
If this argument is specified by the user, it must include at least one of
the following character strings: “ |
save.result |
Optional logical indicating wheter or not the output files described in
‘Output Files’ section must be saved in |
dir.result |
Optional character string naming the absolute path of an existing directory
where files described in the ‘Output Files’ section will be saved.
|
Details
For each radius, k or BAF value (according to the currently available plot
designs: circular fixed area, k-tree and angle-count), this function computes
correlations between each variable estimated from field data
specified in the variables
argument and all the metrics derived from TLS
data existing in the data frames included in the simulations
argument.
Two correlation measures are implemented at present: Pearson's correlation
coefficient and Spearman's rho. For each method, in addition to the
estimated measure, the p-value of a test for association is also returned.
The cor.test
function from the utils package is used to compute
both the estimated correlations and the p-values of the associated tests; more
details about these measures and their tests for association can be found in
the corresponding documentation. There cannot be
missing data for three or more plots, and there cannot be zero standard deviation,
in order to prevent missing correlation values for each (field estimation, TLS
metric) pair and plot design parameter (radius, k or BAF).
Apart from estimated correlations and their corresponding p-values, for ecah method, the function also returns the plot design parameter and field estimates, the value of the optimal correlation (i.e. the maximum of the absolute value of available correlations) and the TLS metric to which it corresponds.
Value
correlations |
A list including the estimated correlations for each measure specified in the
|
correlations.pval |
List containing the p-value of the test for association corresponding to each
measure specified in |
opt.correlations |
List containing the optimal correlations, and the names of the TLS metrics to
which they correspond, for each measure specified in
|
Output Files
During the execution, if the save.result
argument is TRUE
, the
function prints to files the matrices and data frames included in
correlations
and opt.correlations
elements described in
‘Value’. Both are written without row names in
dir.result
directory by using the write.csv
function in the
utils package. The patterns used for naming these files are
‘correlations.<plot design>.<method>.csv’ and
‘opt.correlations.<plot design>.plot.<method>.csv’ for correlation
matrices and optimal correlation data frames, respectively, where
‘<plot design>’ is equal to “fixed.area.plot
”,
“k.tree.plot
” or “angle.count.plot
” according to
plot design, and ‘<method>’ equals “pearson
” or
“spearman
” according to the correlation measure.
Furthermore, if the save.result
argument is TRUE
, interactive line
charts graphically representing correlations will also be created and saved
in the dir.result
directory by means of saveWidget
function
in the htmlwidgets package. Generated widgets enable users to
consult correlation data directly on the plots, select/deselect different
sets of traces, to zoom and scroll, etc. The pattern used for naming
these files is ‘correlations.<x>.<plot design>.<method>.html’, where both
‘<plot design>’ and ‘<method>’ are as indicated for the previous
described files, and ‘<x>’ is equal to any of elements specified in the
variables
argument.
Note
This function is particularly useful for further steps related to model-based and model-assisted approaches, as correlations measure the strength of a relationship between two variables (linear for Pearson's correlation, monotonic for Spearman's correlation).
Author(s)
Juan Alberto Molina-Valero and Adela MartÃnez-Calvo.
See Also
simulations
, optimize.plot.design
.
cor.test
in utils package.
Examples
# Load field estimates and TLS metrics corresponding to Rioja data set
data("Rioja.simulations")
# Establish directory where correlation results corresponding to the Rioja example
# will be saved. For instance, current working directory
# dir.result <- getwd()
# Compute correlations between field estimates and TLS metrics corresponding
# to Rioja example
# Pearson's and Spearman's correlations for variables by default
# corr <- correlations(simulations = Rioja.simulations, dir.result = dir.result)
# Pearson's and Spearman's correlations for variable 'N'
# corr <- correlations(simulations = Rioja.simulations, variables = "N",
# dir.result = dir.result)
# Only Pearson's correlations for variables by default
# corr <- correlations(simulations = Rioja.simulations, method = "pearson",
# dir.result = dir.result)
# Pearson's and Spearman's correlations corresponding to angle-count design for
# all available variables
# corr <- correlations(simulations = Rioja.simulations["angle.count"],
# variables <- c("N", "G", "V", "d", "dg", "dgeom", "dharm",
# "d.0", "dg.0", "dgeom.0", "dharm.0", "h",
# "hg", "hgeom", "hharm", "h.0", "hg.0",
# "hgeom.0", "hharm.0"),
# dir.result = dir.result)