Skip to content

Instantly share code, notes, and snippets.

View mnarayan's full-sized avatar

mnarayan mnarayan

View GitHub Profile

One of the hallmarks of inter-regional functional coupling (IRFC) using fMRI is the distinctive and reproducible community structure that emerges after partitioning voxels into regions and regions into large scale sub-networks such as that of Yeo et. al. 2011. To the extent that IRFC in functional brain networks from any modality reects capacity for neurophysiological communication, the strength of coupling between two large scale communities, such as the default mode sub-network (DMN) and fronto-parietal control sub-network (FPN) in Fig 1a., is a vital index of possible reconguration of community structure. Changes to community strength may vary between individuals on the healthy to ill spectrum and vary within individuals across mental states or in response to brain stimulation. In this work, we provide a novel measure of community strength, higher order clique conductance (HOCC), inspired by Benson 2016 that takes not only connections but maximal cliques of size k>2 (Fig 1c.) into account. Results from app

@mnarayan
mnarayan / ParSpace1.m
Last active November 3, 2020 18:28
Scripts for "Quantifying and addressing parameter indeterminacy in the classical twin design."
%%%THIS FILE GRAPHS PARAMETER SPACE FROM TWIN DATA SETS
%%%WHENEVER CV(DZ)/CV(MZ)>1/2
%
% All parameter sets within this space are mathematically equally likely
% but are not necessarily biologically equally likely
%
% By Matt Keller
% Nov 26, 2004
%
% For more explanation, see:
@mnarayan
mnarayan / awesome-beamer.md
Last active April 12, 2023 11:39
Modern Beamer Templates
@mnarayan
mnarayan / README.md
Last active October 6, 2022 00:28
Kendall Tau correction for zero-inflation

Pimental's correction for kendall's tau correlation coefficient is given by

Pimental:Proposition 1

@mnarayan
mnarayan / Investigating Canonical Correlations.md
Last active May 4, 2019 16:04
Investigating Canonical Correlations

Summary

Canonical Correlation Analysis is a dimensionality reduction technique to find the subspace that maximizes the correlation between two sets of multivariate features X and Y that share the same number of rows or observations.

Since CCA is a supervised technique it is easy to obtain extremely high canonical correlations that might not generalize due to overfitting.

The script sample_canonical_correlations.m is designed to investigate out-of-sample canonical correlations. If one partitions the number of rows/observations into training and test sets, then one can

    1. do ordinary CCA on the training set
    1. use the canonical variates from the training set to obtain out-of-sample canonical correlations on the test set
    1. Compare in-sample vs. out-of-sample canonical correlations
@mnarayan
mnarayan / ds000031_model.json
Last active October 18, 2018 20:22 — forked from cmaumet/ds114_model.json
BIDS-models for ds000031
{
"name": "ds000031 example",
"description": "An example of connectivity analysis using ds000031",
"input":
{
"task": "rest"
},
"blocks": [
{
"level": "run",
@mnarayan
mnarayan / tutorial-combat.ipynb
Last active October 6, 2022 00:30
Explore Between Site "Batch" Effects in fMRI QC
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mnarayan
mnarayan / sample_canonical_correlation.m
Created October 19, 2017 02:52
How to compute canonical variates and canonical correlations across training and test splits
function [cca_rho cca_v cca_cv] = sample_canonical_correlation(X,Y,varargin)
% SAMPLE_CANONICAL_CORRELATION
%
% Usage: [rho] = sample_canonical_correlation(X,Y, R_X, R_Y)
%
% Inputs:
% - X is the test set data matrix of n_samples x p features
% - Y is the test set data matrix of n_samples x r features
% - options.W_X is the linear projection matrix for X
% - options.W_Y is a linear projection matrix for Y
@mnarayan
mnarayan / skggm_optimal_selection_example.py
Created October 8, 2017 17:43
Example of using scikit-optimize with skggm
import sys
import numpy as np
from skopt.space import Real, Categorical, Integer
from skopt import BayesSearchCV
from sklearn.grid_search import GridSearchCV
from sklearn.datasets import make_sparse_spd_matrix
from sklearn.model_selection import train_test_split
from sklearn.metrics import make_scorer
@mnarayan
mnarayan / Wavelets-TMS-fMRI-timeseries.md
Last active October 6, 2022 00:30
A brief note on using wavelet decompositions to study functional connectivity in block-TMS fMRI data.

Introduction

Here is an example of single-subject time-series during R pMFG stimulation.

Break down of global time-series by wavelet scales

Measuring total variance in the signal at each ROI could be very useful to do, particularly across scales 1 to 4.