[pymvpa] Permutation in RSA searchlight regression. Also Mahalanobis distance.

Oliver Contier o.contier at gmail.com
Tue Apr 30 17:47:16 BST 2019


Dear pymvpa community,

I’m a newcomer to the RSA features in this amazing (!) package. I come to seek your wisdom.

I’m trying to run a RSA regression via a spherical searchlight procedure through a brain mask. In addition to the coefficients of each predictor, I would like to have a p-value and - ideally - the null distribution for further statistics. Aaand I can’t get it to work.

My code snippet looks as follows:

> quote_type
> # imports
> from mvpa2.generators.permutation import AttributePermutator
> from mvpa2.clfs.stats import MCNullDist
> from mvpa2.measures.rsa import Regression
> from mvpa2.measures.searchlight import sphere_searchlight
>
> # set up permutation and null distribution generator
> permutator = AttributePermutator('condition', count=5, enable_ca=['ca.raw_results'])
> mcnull = MCNullDist(permutator, tail='right', enable_ca=['ca.dist_samples'])
>
> # set up RSA regression
> rsa_reg = Regression(predictors, pairwise_metric='correlation', center_data=True, method=‚ridge‘, fit_intercept=True, rank_data=True, normalize=True, force_train=True, enable_ca=['null_t', 'null_prob'])
>
> # set up searchlight
> sl = sphere_searchlight(rsa_reg, radius=3, null_dist=mcnull, enable_ca=['roi_sizes', ‚null_t‘])
>
> # run searchlight
> slres = sl(betas)

betas itself is returned by fit_event_hrf_model, based on the events and preprocessed bold image from one functional run of a task-fmri experiment. The result (slres) only has the coefficients stored as sample attributes (slres.sa.coefs), yet the null distributions - let alone probabilities or t/p values - are nowhere in sight.

When I try use the pass_attr method in either of the Regression, MCNullDist, or sphere_searchlight object, I get the following:
> quote_type
>
> UnknownStateError: Unknown yet value of null_prob

I would really appreciate it if someone could point me into the right direction! :-)

A second, minor, question I have is how to use Mahalanobis distance in this case instead of correlation distance as the pairwise_metric. When I replace ‚correlation‘ with ‚mahalanobis‘, I get the following exception thrown by numpy:

> quote_type
> LinAlgError: Singular matrix

I am aware that I’d have to pass the (invers) covariance matrix of features within a searchlight into the regression, yet again, I don’t know how.


Thanks and I’d really appreciate some help with my problem.

Cheers!

Oli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-exppsy-pymvpa/attachments/20190430/e9738355/attachment.html>


More information about the Pkg-ExpPsy-PyMVPA mailing list