corr.matrix
calculates the correlation between all column pairs of a
given data frame, and thresholds the resultant correlation matrix based on a
given density (e.g., 0.1
if you want to keep only the 10% strongest
correlations). If you want to threshold by a specific correlation coefficient
(via the thresholds
argument), then the densities
argument is
ignored.
The plot
method will plot “heat maps” of the correlation
matrices.
corr.matrix(resids, densities, thresholds = NULL, what = c("resids",
"raw"), exclude.reg = NULL, type = c("pearson", "spearman"),
rand = FALSE)# S3 method for corr_mats
[(x, i, g = NULL)
# S3 method for corr_mats
plot(x, mat.type = c("thresholded", "raw"),
thresh.num = 1L, ordered = TRUE, order.by = "lobe",
graphs = NULL, grp.names = NULL, legend.title = NULL, ...)
# S3 method for corr_mats
region.names(object)
# S3 method for corr_mats
nregions(object)
A corr_mats
object containing the following components:
Numeric arrays of correlation coefficients and P-values. The length of the 3rd dimension equals the number of groups
A list of 3-d binary arrays indicating correlations that are above a certain threshold. The length of the list equals the number of groups, and the length of the 3rd dimension equals the number of thresholds/densities.
Numeric matrix of the thresholds supplied. The number of columns equals the number of groups.
Residuals or raw values
Excluded regions (if any)
Pearson or Spearman
The brain atlas used
Numeric vector; the densities of the resulting graphs, if you chose to threshold each group to have equal densities.
An object of class brainGraph_resids
(the output from
get.resid
)
Numeric vector indicating the resultant network densities; keeps the top X% of correlations
Numeric; absolute correlation value to threshold by
(default: NULL
)
Character string indicating whether to correlate the residuals or
the raw structural MRI values (default: 'resids'
)
Character vector of regions to exclude (default:
NULL
)
Character string indicating which type of correlation coefficient
to calculate (default: 'pearson'
)
Logical indicating whether the function is being called for
permutation testing; not intended for general use (default: FALSE
)
A corr_mats
object
Integer for subsetting by density/threshold
Integer, character, or logical for subsetting by group
Character string indicating whether to plot raw or thresholded
(binarized) matrices. Default: 'raw'
Integer specifying which threshold to plot (if
mat.type='thresholded'
). Default: 1L
Logical indicating whether to order the vertices by some
grouping. Default: TRUE
Character string indicating how to group vertices. Default:
'lobe'
A brainGraphList
object containing graphs with the
vertex-level attribute of interest. Default: NULL
Character vector specifying the names of each group of
vertices. Default: NULL
Character string for the legend title. Default is to leave blank
Unused
There are several ways to control the plot appearance. First, you may plot
the “raw” correlations, or only those of the thresholded (binarized)
matrices. Second, you may order the vertices by a given vertex attribute; by
default, they will be ordered by lobe, but you may also choose to
order by, e.g., network (for the dosenbach160
atlas) or by
community membership. In the latter case, you need to pass a
brainGraphList
object to the graphs
argument; each graph in the
object must have a vertex attribute specified in order.by
. Finally,
you can control the legend text with grp.names
.
Christopher G. Watson, cgwatson@bu.edu
If you wish to exclude regions from your analysis, you can give the indices
of their columns with the exclude.reg
argument.
By default, the Pearson correlation coefficients are calculated, but you can
return Spearman by changing the type
argument.
Other Structural covariance network functions: Bootstrapping
,
IndividualContributions
,
Residuals
,
brainGraph_permute
,
import_scn
, plot_volumetric