You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DOC: Document how to do stats in / inter-operate with R #13721
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.
+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.
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.
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
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?
Activity
drammock commentedon Mar 4, 2026
+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.
AasmaGupta commentedon Mar 4, 2026
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.
larsoner commentedon Mar 5, 2026
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
aman-coder03 commentedon Mar 9, 2026
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 viarpy2and shows that both give equivalent results. Would that be a good starting point?