Skip to content

DOC: Document how to do stats in / inter-operate with R #13721

Closed

Description

@larsoner

From talking to several people, it seems like doing stats in R can be a compelling option in many use cases. I think it would be cool to showcase in our docs how this can be done.

A first tutorial could show for example how to do something simple, like a mass-univariate t-test (e.g., 2-sample across two conditions using Epochs) first in Python, then in R. It could show that you get equivalent results, but shows how to get data over to R and results back to Python.

Activity

  1. added this to the 1.12 milestone on Mar 4, 2026
  2. drammock commented on Mar 4, 2026

    @drammock
    Member

    +1. I have some old code where I used rpy2 to do graph-specific covariance shrinkage estimation (here), but presumably we can come up with something a bit more general.

  3. AasmaGupta commented on Mar 4, 2026

    @AasmaGupta

    Hi @larsoner ! I’d be interested in helping with this. Beyond a single tutorial, would it make sense to expand this into a broader workflow for Python–R interoperability with MNE (for example utilities for exporting Epochs data, running statistical models in R, and bringing results back to Python for visualization)?

    I’m also exploring possible directions for a GSoC proposal, so I wanted to check whether something along these lines would be useful for the project.

  4. larsoner commented on Mar 5, 2026

    @larsoner
    MemberAuthor

    I don't see this as GSoC-worthy... I think once we have the simple example described above, the other use cases follow pretty straightforwardly (I hope!). But yes feel free to open a PR @AasmaGupta

  5. aman-coder03 commented on Mar 9, 2026

    @aman-coder03
    Contributor

    hi @larsoner @drammock i would love to take a shot at this. I am thinking of writing a tutorial that runs a 2 sample mass univariate t-test on Epochs data....first in Python with scipy.stats ....then the same thing in R via rpy2 and shows that both give equivalent results. Would that be a good starting point?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions