Skip to contents

Calculates a sparse, z-scored similarity graph between parcels based on their activation profiles across different conditions or task features.

Usage

compute_W_task_from_activations(
  activation_matrix,
  parcel_names,
  k_conn_task_pos,
  k_conn_task_neg,
  similarity_method = "pearson",
  use_dtw = FALSE
)

Arguments

activation_matrix

A numeric matrix (`C x V_p`) where `C` is the number of conditions/features and `V_p` is the number of parcels. Each column represents the activation profile for a parcel.

parcel_names

A character vector of length `V_p` specifying parcel names.

k_conn_task_pos

Non-negative integer. Number of strongest positive connections to retain per parcel during sparsification.

k_conn_task_neg

Non-negative integer. Number of strongest negative connections to retain per parcel during sparsification.

similarity_method

Character string or function. Specifies the method to compute the initial `V_p x V_p` similarity matrix from `activation_matrix`. If "pearson" (default) or "spearman", `stats::cor` is used. If a function, it must take `activation_matrix` as input and return a `V_p x V_p` numeric matrix.

use_dtw

Logical, defaults to `FALSE`. (Placeholder, currently unused but kept for potential future compatibility or signature consistency).

Value

A sparse, symmetric `Matrix::dgCMatrix` of size `V_p x V_p` representing the z-scored task-based similarity graph `W_task_i`.