Giter VIP home page Giter VIP logo

Comments (17)

agramfort avatar agramfort commented on July 24, 2024

++++++1 :)

from mne-python.

dengemann avatar dengemann commented on July 24, 2024

... won't be 0.5. however ;-)

from mne-python.

christianbrodbeck avatar christianbrodbeck commented on July 24, 2024

I have a basic implementation of ANOVA capability for balanced and completely specified models at https://github.com/christianmbrodbeck/Eelbrain/blob/master/eelbrain/analyze/glm.py . Model specification is done with the factors I described in Issue #133, but that could be modified.

from mne-python.

christianbrodbeck avatar christianbrodbeck commented on July 24, 2024

To be more specific:

  • for univariate dependent variables, I have implemented incremental f-tests for fixed effects models which can include scalar and categorial predictors example.
  • For balanced models I have also implemented random effects models example.
  • For the latter method I have added a class that can fit the model to several data points simultaneously, which can then be used for a cluster permutation test example. Here the ndvar object is useful because you can submit data with an arbitrary dimensions (time, sensor, source, ....) and get the result map of F- or p-values (or cluster extent) back with the same dimensions (minus the 'case' dimension).

from mne-python.

dengemann avatar dengemann commented on July 24, 2024

Hi chris,

thanks! let's get back and see how we can interface / support integrate your efforts as the anova issue will transform into a WIP PR. Maybe we can setup that up together. From my side however not before 0.5

Best,
Denis

On 06.12.2012, at 00:50, Christian Brodbeck [email protected] wrote:

I have a basic implementation of ANOVA capability for balanced and completely specified models at https://github.com/christianmbrodbeck/Eelbrain/blob/master/eelbrain/analyze/glm.py . Model specification is done with the factors I described in Issue #133, but that could be modified.


Reply to this email directly or view it on GitHub.

from mne-python.

dengemann avatar dengemann commented on July 24, 2024

Addressed by #580. Closing.

from mne-python.

TheChymera avatar TheChymera commented on July 24, 2024

hey there, so does mne-python have a repeated measures anova? if so what's the name of the function - and are there any docs?

I'd also be willing to provide a more general package atom (ebuild) for my distribution (gentoo) if I can use your software.

from mne-python.

agramfort avatar agramfort commented on July 24, 2024

hi,

look at this diff:

https://github.com/mne-tools/mne-python/pull/580/files

you'll see the example and the function of interest to you is : f_twoway_rm

the rendered example is at :

http://martinos.org/mne/auto_examples/stats/plot_cluster_stats_time_frequency_repeated_measures_anova.html

if some doc or function is missing don't hesitate to send us a pull request to help us making MNE-Python better.

Regarding gentoo packaging that would be great. Maybe @mluessi can give a hand too as a gentoo user.

Hope this helps,
Alex

from mne-python.

dengemann avatar dengemann commented on July 24, 2024

Hi @TheChymera , now @agramfort was faster. Two things to add. First, this is optimized for mass-univariate use cases (estimate thousands of models at once), the interface is hence more Matlab-like, matrix oriented an allows for passing large matrices with thousands of observations per person. Functionality is tested against R and SPSS and of course you can also pass behavioral data with one observation per subject. Second currently we only have 2-way repeated measures ANOVA. Extending the code is relatively easy though, e.g. supporting more factors, non-repeated factors (e.g. groups) and covariates. However I did not have a real use case for this since simple 2-way ANOVA models are already quite complex in an MEG context. From my point of view adding groups support, a third factor and a covariate would make sense. From your post records across different projects (Psychopy, statsmodels) it seems you're looking for standard functionality / sth. for behavioural data. Why not R then? Gentoo packaging is of course a nice idea ;-) and of course if you're interested in extending our ANOVA support contributions are always welcome.

from mne-python.

TheChymera avatar TheChymera commented on July 24, 2024

@dengemann Well, I want to keep all of my data post-processing and analysis in python instead of switching between programs. I tried Rpy but for some reason I have issues formatting my pandas dataframe for R...

Anyway, do you have a one-way repeated measure ANOVA? or cam I use f_twoway_rm for that as well? I have 5 conditions presented to 10 participants with 100 trials each - I'm only interested in the variance of the conditions, not of the participants etc.

from mne-python.

dengemann avatar dengemann commented on July 24, 2024

@TheChymera

Here is some pseudo code / snippet thatdemonstrates how I use Rpy (for 'small' data / when it comes to standard analyses I always do this at some point --- I guess Python will never, at least not in the next 5-10 years catch up with all the general stats provided in R -- it's strength is in particular and advanced packages. Python makes tackling difficult / new problems fun, so many developers / scientists choose it to start a new project rather than reimplementing what's e.g. in R. People simply want to work on new stuff ;-). I can see that Rpy does not come with a self-evident API and you need to know both R and Python to take full advantage of it. But given my prediction it's worth the effort, and actually it works nicely.)

import pandas.rpy.common as com
import pandas as pd
base = com.importr('base')
stats = com.importr('stats')

# .... read data and stuff, a few lines omitted
aggfunc = np.mean  # how to aggregegate
agglist = ['subject', 'A', 'B', 'C']  # splitby 
fml = 'latency ~ A * B * C + Error(subject/ (A * B * C))'  #  formula string
df_ = df.groupby(agglist).agg(aggfunc).reset_index()  # final structure to be tested
dfr = com.convert_to_r_dataframe(df_, True)  # convert from pandas to R and make string columns factors
fml_ = Formula(fml)  #  make a formula    obect
print str(base.summary(stats.aov(fml_, dfr)))

As to the one-way in mne-python.... I don't know whether the implemented version accepts 1-factor only input, I never tried. You would need to setup a matrix with 5 columns (one for each level) and try to pass [5] as factor_levels argument.

from mne-python.

dengemann avatar dengemann commented on July 24, 2024

Btw. you can also take a look at Roger Lew's pyvttbl package https://pypi.python.org/pypi/pyvttbl/0.4.1.0, I think this the most comprehensive collection of ANOVA models in Python. I drew from there and we actually had discussions at statsmodels to refactor his code and add it there. But no one including himself or myself had time for it.

from mne-python.

mluessi avatar mluessi commented on July 24, 2024

@TheChymera having mne-python in the gentoo science overlay would be perfect. I will be happy to assist with making an ebuild :).

from mne-python.

TheChymera avatar TheChymera commented on July 24, 2024

@mluessi I'm caught up quite a bit in my master thesis until the start of december, so since I won't be using the mne-python ANOVA function, I'll only get to the ebuild after that. There are a number of high-profile neuroscience packages still not merged into gentoo-sci - there's a list with them (as well as some info on neuro~gentoo) in this neurogentoo guide. If you have any provisorial ebuild for mne-python I can add it to the listing, maybe someone will notice it even before I get more time.

from mne-python.

dengemann avatar dengemann commented on July 24, 2024

@TheChymera btw I took a look at running one-way repeated measures with our ANOVA. The contrast coding as is implemented right now prevents such a model, adding support for it should not be too difficult though. I just won't have time for it, unless an urgent use case emerges on my end which I don't see coming.

from mne-python.

mluessi avatar mluessi commented on July 24, 2024

@TheChymera thanks for the link. I will look into making an mne-python ebuild, it should be terribly simple, unlike e.g. packing for Debian ;). Good luck with your thesis.

from mne-python.

chrisdembia avatar chrisdembia commented on July 24, 2024

+1

from mne-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.