Title: | Connectome Predictive Modelling in R |
---|---|
Description: | Connectome Predictive Modelling (CPM) (Shen et al. (2017) <doi:10.1038/nprot.2016.178>) is a method to predict individual differences in behaviour from brain functional connectivity. 'cpmr' provides a simple yet efficient implementation of this method. |
Authors: | Liang Zhang [aut, cre] |
Maintainer: | Liang Zhang <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-12-06 06:53:31 UTC |
Source: | CRAN |
The connectome-based predictive modeling (CPM) is a data-driven approach to predict individual behavior from brain connectivity data. Originally proposed by Shen et al. (2017), the CPM has been widely used in various studies. This function implements the CPM algorithm and provides a convenient interface to use it.
cpm( conmat, behav, ..., confounds = NULL, thresh_method = c("alpha", "sparsity"), thresh_level = 0.01, kfolds = NULL, bias_correct = TRUE, return_edges = c("sum", "none", "all"), na_action = c("fail", "exclude") )
cpm( conmat, behav, ..., confounds = NULL, thresh_method = c("alpha", "sparsity"), thresh_level = 0.01, kfolds = NULL, bias_correct = TRUE, return_edges = c("sum", "none", "all"), na_action = c("fail", "exclude") )
conmat |
A matrix of connectome data. Observations in row, edges in column (assumed that duplicated edges are removed). |
behav |
A numeric vector contains behavior data. Length must equal to
number of observations in |
... |
For future extension. Currently ignored. |
confounds |
A matrix of confounding variables. Observations in row,
variables in column. If |
thresh_method , thresh_level
|
The threshold method and level used in edge
selection. If method is set to be |
kfolds |
Folds number of cross-validation. If |
bias_correct |
Logical value indicating if the connectome data should be
bias-corrected. If |
return_edges |
A character string indicating the return value of the
selected edges. If |
na_action |
A character string indicating the action when missing values
are found in |
A list with the following components:
folds |
The corresponding fold for each observation when used as test group in cross-validation. |
real |
The real behavior data. This is the same as the input |
pred |
The predicted behavior data, with each column corresponding to
a model, i.e., both edges, positive edges, negative edges, and the row
names corresponding to the observation names (the same as those of
|
edges |
The selected edges, if |
call |
The matched call. |
params |
A list of parameters used in the function, including:
|
Shen, X., Finn, E. S., Scheinost, D., Rosenberg, M. D., Chun, M. M., Papademetris, X., & Constable, R. T. (2017). Using connectome-based predictive modeling to predict individual behavior from brain connectivity. Nature Protocols, 12(3), 506–518. https://doi.org/10.1038/nprot.2016.178
Rapuano, K. M., Rosenberg, M. D., Maza, M. T., Dennis, N. J., Dorji, M., Greene, A. S., Horien, C., Scheinost, D., Todd Constable, R., & Casey, B. J. (2020). Behavioral and brain signatures of substance use vulnerability in childhood. Developmental Cognitive Neuroscience, 46, 100878. https://doi.org/10.1016/j.dcn.2020.100878
conmat <- matrix(rnorm(100 * 100), nrow = 100) behav <- rnorm(100) cpm(conmat, behav) # use different threshold method and level cpm(conmat, behav, thresh_method = "sparsity", thresh_level = 0.05) # use a 10-fold cross-validation cpm(conmat, behav, kfolds = 10)
conmat <- matrix(rnorm(100 * 100), nrow = 100) behav <- rnorm(100) cpm(conmat, behav) # use different threshold method and level cpm(conmat, behav, thresh_method = "sparsity", thresh_level = 0.05) # use a 10-fold cross-validation cpm(conmat, behav, kfolds = 10)
This function provides a summary of a cpm
object, including the
prediction performance and the selected edges.
## S3 method for class 'cpm' summary(object, ..., method = c("pearson", "spearman"), edge_level = 0.5) ## S3 method for class 'cpm_summary' print(x, ...)
## S3 method for class 'cpm' summary(object, ..., method = c("pearson", "spearman"), edge_level = 0.5) ## S3 method for class 'cpm_summary' print(x, ...)
object |
An object of class |
... |
Other parameters passed to the function. |
method |
A character vector indicating the method used to calculate the correlation between the real and predicted values. |
edge_level |
A numeric value between 0 and 1 indicating the proportional threshold for edge selection. |
x |
An object of class |
A list of class cpm_summary
containing two elements:
performance |
A matrix of prediction performance, including the correlation between the real and predicted values for both edges, positive edges only, and negative edges only. |
edges |
A logical vector indicating whether each edge is selected based on the edge_level. |
params |
A list of parameters used in the summary. |
cpm
objectTidy a cpm
object
## S3 method for class 'cpm' tidy(x, ..., component = c("performance", "edges"))
## S3 method for class 'cpm' tidy(x, ..., component = c("performance", "edges"))
x |
A |
... |
Additional arguments passed to |
component |
A character vector indicating the component to tidy. |
A tibble with columns storing parameters of the
cpm()
object and further columns depending on the component
argument:
For component = "performance"
:
method |
The method used to calculate the correlation between the real and predicted values. |
pos |
The correlation between the real and predicted values for positive edges. |
neg |
The correlation between the real and predicted values for negative edges. |
For component = "edges"
:
level |
The proportional threshold for edge selection. |
pos |
A logical vector indicating whether each edge is selected based on the edge_level (positive). |
neg |
A logical vector indicating whether each edge is selected based on the edge_level (negative). |