cvnlab / nsdcode

Code related to analyzing the Natural Scenes Dataset
BSD 2-Clause "Simplified" License
32 stars 9 forks source link

Easy way to compute voxel noise covariance matrix from residual timeseries? #26

Open johnmarktaylor91 opened 1 month ago

johnmarktaylor91 commented 1 month ago

Hello, apologies if there's something I overlooked, but I am trying to figure out the easiest way to compute the voxel covariance matrix for an ROI based on the residuals from the GLM (useful for e.g. computing Mahalanobis distance). Are the residuals stored somewhere in the dataset, or must these be computed manually from the raw timeseries and the beta values?

kendrickkay commented 1 month ago

Hi JohnMark -

GLMsingle's approach is a bit complicated, and in the current implementation there is not an easy way to compute traditional GLM residuals... There are also larger complex issues revolving around what type of residuals you are looking for (e.g. GLMsingle is designed to remove some noise fluctuations of no interest, etc.). I could chat more in depth about this if you wanted to potentially open a rabbit's hole...

Another appraoch is to just implement your own GLM flavor and analyze the preprocessed time series data yourself.

Finally, another approach is to treat the noise as what rides on top of the single trial betas. (see e.g. https://www.biorxiv.org/content/10.1101/2024.04.22.590510v1) This is most conceptually straightforward but is obviously very different from thinking about time series residuals.

Kendrick

On Sep 14, 2024, at 5:27 AM, JohnMark Taylor @.***> wrote:

Hello, apologies if there's something I overlooked, but I am trying to figure out the easiest way to compute the voxel covariance matrix for an ROI based on the residuals from the GLM (useful for e.g. computing Mahalanobis distance). Are the residuals stored somewhere in the dataset, or must these be computed manually from the raw timeseries and the beta values?

— Reply to this email directly, view it on GitHub https://github.com/cvnlab/nsdcode/issues/26, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAU2DESN7ML4356C4M3SNIDZWNDE5AVCNFSM6AAAAABOGBMI4SVHI2DSMVQWIX3LMV43ASLTON2WKOZSGUZDKNRTHA4TSMI. You are receiving this because you are subscribed to this thread.

johnmarktaylor91 commented 1 month ago

Many thanks for this breakdown--using the single-trial betas to compute noise seems simplest for now, I will give that a shot. The thought of using the timeseries residuals from the GLM seemed appealing for the vast amounts of data, but it sounds like it opens a few cans of worms.