[pymvpa] How to do a simple t or F test in PyMVPA

Daqiang Sun sundaqiang at yahoo.com
Sat May 30 07:45:19 UTC 2009


Thanks Michael!
I'll try scipy.stats for sure.
Best, Frank




----- Original Message ----
From: Michael Hanke <michael.hanke at gmail.com>
To: Daqiang Sun <sundaqiang at yahoo.com>
Cc: pkg-exppsy-pymvpa at lists.alioth.debian.org
Sent: Friday, May 29, 2009 11:29:35 PM
Subject: Re: [pymvpa] How to do a simple t or F test in PyMVPA

Hi,

On Fri, May 29, 2009 at 07:15:45PM -0700, Daqiang Sun wrote:
> Dear all,

> I was wondering how I can do a between-group voxel-wise t (or F, two
> groups though) test with PyMVPA. We have a paper in revision in which
> we applied PyMVPA classification, and we need to do some more
> calculations.

> My data are pretty simple. They are two groups of preprocessed
> structural images with labels 0 and 1. I don't need multiple
> comparison correction at this stage. I just want to count the number
> of voxels above an t/F or below a P value. 

> I tried default OneWayAnova, like:
> > anova = OneWayAnova()
> > fmap = anova(data)

> but the numbers I got doesn't look like F values. We should have a lot
> of significant voxels but the values I got here are between 0 and 1.
> I guess I must have done something wrong here. What is OneWayAnova
> really for? Should I use GLM instead? How should I set up the options?
> I'd appreciate it if anyone could point me to a solution. Thanks in
> advance!

Grmpf...

I guess you are right. OneWayAnova() would be the way to generate
F-scores, but it looks like it doesn't not return properly F-distributed
scores, because it does not consider the degrees of freedom --
unfortunately, it is probably me who is responsible :(

For now I would recommend to use SciPy's F-test implementation, e.g.
like this:

  >>> scipy.stats.f_oneway(ds['labels', [0]].samples,
  ...                      ds['labels', [1]].samples)

That will give you both F-scores and associated p-value.

Moreover, I will fix OneWayAnova to use SciPy as well. For additional
tests also scipy.stats is probably the best source.


Sorry,

Michael


-- 
GPG key:  1024D/3144BE0F Michael Hanke
http://apsy.gse.uni-magdeburg.de/hanke
ICQ: 48230050



      



More information about the Pkg-ExpPsy-PyMVPA mailing list