[pymvpa] outputting p-values from searchlight

William Graves william.wyatt.graves at gmail.com
Fri May 19 14:16:20 UTC 2017


Hi Nick,

Thanks for the quick reply!

The problem is, when I run the searchlight without setting “corrcoef_only” to “True”, I get this error (here are the last few lines of the output, let me know if it doesn’t show up properly):

[SLC] DBG:              +0:00:57 ======[100%]====== 0:00:00  ROI 1465 (1465/1465), 36 features

[SLC] DBG:               hstacking 1465 results of shape (1, 2)
[SLC] DBG:               hstacked shape (1, 2930)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-185-a11e1def05a0> in <module>()
----> 1 slres = sl(ds)

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mvpa2/base/learner.pyc in __call__(self, ds)
    256                                    "used and auto training is disabled."
    257                                    % str(self))
--> 258         return super(Learner, self).__call__(ds)
    259 
    260     is_trained = property(fget=lambda x: x.__is_trained, fset=_set_trained,

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mvpa2/base/node.pyc in __call__(self, ds, _call_kwargs)
    135 
    136         self._precall(ds)
--> 137         result = self._call(ds, **(_call_kwargs or self._get_call_kwargs(ds)))
    138         result = self._postcall(ds, result)
    139 

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mvpa2/measures/searchlight.pyc in _call(self, dataset)
    152 
    153         # pass to subclass
--> 154         results = self._sl_call(dataset, roi_ids, nproc)
    155 
    156         if 'mapper' in dataset.a:

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mvpa2/measures/searchlight.pyc in _sl_call(self, dataset, roi_ids, nproc)
    382                                     dataset=dataset,
    383                                     roi_ids=roi_ids,
--> 384                                     results=self.__handle_all_results(p_results))
    385 
    386         # Assure having a dataset (for paranoid ones)

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mvpa2/measures/searchlight.pyc in _concat_results(sl, dataset, roi_ids, results)
    262 
    263         # store the center ids as a feature attribute
--> 264         result_ds.fa['center_ids'] = roi_ids
    265 
    266         return result_ds

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mvpa2/base/collections.pyc in __setitem__(self, key, value)
    597                                 len(value.value),
    598                                 ulength,
--> 599                                 str(self)))
    600         # tell the attribute to maintain the desired length
    601         value.set_length_check(ulength)

ValueError: Collectable 'center_ids' with length [1465] does not match the required length [2930] of collection '<FeatureAttributesCollection: metrics>'.

Presumably there’s a clever way to get around this that I just haven’t figured out.


> On May 19, 2017, at 10:04 AM, Nick Oosterhof <n.n.oosterhof at googlemail.com> wrote:
> 
> 
>> On 19 May 2017, at 15:58, William Graves <william.wyatt.graves at gmail.com> wrote:
>> 
>> Dear PyMVPA Experts:
>> 
>> In trying to do an RSA analysis using PyMVPA, I have to say your tools are really great. One issue I’ve run into though is that I can’t figure out from your documentation how to output both correlation coefficients and p-values into a NIfTI file to view the output.
>> 
>> Here’s what I’ve done so far:
>> 
>> Set up a comparison matrix for eventually testing against each searchlight:
>> tdm = rsa.pdist(ds.sa.orth, 'correlation’)
>> 
>> Set up the target similarity comparison:
>> dsm = rsa.PDistTargetSimilarity(tdm, comparison_metric='spearman', corrcoef_only=True)
>> 
>> Set up the searchlight:
>> sl = sphere_searchlight(dsm, radius=3, enable_ca='ca.pvalues’)
>> 
>> Run it:
>> slres = sl(ds)
>> 
>> And finally output the results in NIfTI format:
>> map2nifti(slres, imghdr=ds.a.imghdr).to_filename('meansubj.rsa_orth_sl.nii.gz’)
>> 
>> From your documentation, it seems like there’s a way to output not only correlation coefficients for each voxel, but also p-values.
> 
> See http://www.pymvpa.org/generated/mvpa2.measures.rsa.PDistTargetSimilarity.html
> 
> corrcoef_only : bool, optional
> If True, return only the correlation coefficient (rho), otherwise return rho and probability, p. Constraints: value must be convertible to type bool. [Default: False]
> 
> 
> _______________________________________________
> Pkg-ExpPsy-PyMVPA mailing list
> Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20170519/c6bd0ac3/attachment-0001.html>


More information about the Pkg-ExpPsy-PyMVPA mailing list