CAP.caps2corr#

CAP.caps2corr(method='pearson', output_dir=None, plot_output_format='png', suffix_filename=None, suffix_title=None, save_plots=True, save_df=False, show_figs=True, return_df=False, **kwargs)[source]#

Generate a Correlation Matrix for CAPs.

Produces a correlation matrix of all CAPs. Separate correlation matrices are created for each group.

Parameters:
  • method (str, default=”pearson”) – Type of correlation method to use. Options are “pearson” or “spearman”.

  • output_dir (str or None, default=None) – Directory to save plots (if save_plots is True) and correlation matrices DataFrames (if save_df is True). The directory will be created if it does not exist. If None, plots and dataFrame will not be saved.

  • plot_output_format (str, default=”png”) –

    The format to save plots in when output_dir is specified. Options are “png” or “pkl” (which can be further modified). Note that “pickle” is also accepted.

    Changed in version 0.33.0: Replaces as_pickle and accepts a string value.

  • suffix_filename (str or None, default=None) – Appended to the filename of each saved plot if output_dir is provided.

  • suffix_title (str or None, default=None) – Appended to the title of each plot.

  • save_plots (bool, default=True) – If True, plots are saves as png images. For this to be used, output_dir must be specified.

  • save_df (bool, default=False) – If True, saves the correlation matrix contained in the DataFrames as csv files. For this to be used, output_dir must be specified.

  • show_figs (bool, default=True) – Display figures.

  • return_df (bool, default=False) – If True, returns a dictionary with a correlation matrix for each group.

  • **kwargs – Additional keyword arguments for customizing plots. See neurocaps.utils.PlotDefaults.caps2corr() for all available options and their default values (See PlotDefaults Documentation for caps2corr)

Returns:

dict[str, pd.DataFrame] – A dictionary mapping an instance of a pandas DataFrame for each group. Only returned if return_df is True.

Note

Significance Values: If return_df is True, each element will contain its uncorrected p-value in parenthesis with a single asterisk if < 0.05, a double asterisk if < 0.01, and a triple asterisk < 0.001.