<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">Dear pymvpa community,
<div><br /></div>
<div>I’m a newcomer to the RSA features in this amazing <span style="caret-color: rgb(213, 218, 222);">(!) </span>package. I come to seek your wisdom.</div>
<div><br /></div>
<div>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.</div>
<div><br /></div>
<div>My code snippet looks as follows:</div>
<div><br /></div>
<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><i># imports</i></div>
<div><i>from mvpa2.generators.permutation import AttributePermutator</i></div>
<div><i>from mvpa2.clfs.stats import MCNullDist</i></div>
<div><i>from mvpa2.measures.rsa import Regression</i></div>
<div><i>from mvpa2.measures.searchlight import sphere_searchlight</i></div>
<div><i><br /></i></div>
<div><i># set up permutation and null distribution generator</i></div>
<div><i>permutator = AttributePermutator('condition', count=5, enable_ca=['ca.raw_results'])</i></div>
<div><i>mcnull = MCNullDist(permutator, tail='right', enable_ca=['ca.dist_samples'])</i></div>
<div><i><br /></i></div>
<div><i># set up RSA regression</i></div>
<div><i>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'])</i></div>
<div><i><br /></i></div>
<div><i># set up searchlight</i></div>
<div><i>sl = sphere_searchlight(rsa_reg, radius=3, null_dist=mcnull, enable_ca=['roi_sizes', ‚null_t‘])</i></div>
<div><i><br /></i></div>
<div><i># run searchlight</i></div>
<div><i>slres = sl(betas)</i></div>
</blockquote>
<div><br /></div>
<div><i>betas</i> itself is returned by <i>fit_event_hrf_model</i>, based on the events and preprocessed bold image from one functional run of a task-fmri experiment. <span style="orphans: 2; widows: 2;">The result (<i>slres</i>) only has the coefficients stored as sample attributes (<i>slres.sa.coefs</i>), yet the null distributions - let alone probabilities or t/p values - are nowhere in sight.</span></div>
<div>
<div><br /></div>
<div>When I try use the pass_attr method in either of the Regression, MCNullDist, or sphere_searchlight object, I get the following:<br /></div>
</div>
<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div>
<div><br /></div>
<div><i>UnknownStateError: Unknown yet value of null_prob</i></div>
</div>
</blockquote>
<div><br /></div>
<div>I would really appreciate it if someone could point me into the right direction! :-) </div>
<div><br /></div>
<div>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:</div>
<div><br /></div>
<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div>
<div><i>LinAlgError: Singular matrix</i></div>
</div>
</blockquote>
<div><br /></div>
<div>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.</div>
<div><br /></div>
<div><br /></div>
<div>Thanks and I’d really appreciate some help with my problem.</div>
<div><br /></div>
<div>Cheers!</div>
</div>
<div name="messageSignatureSection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
Oli</div>
</body>
</html>