[Mne_analysis] source-space analysis on MNE

Jona Sassenhagen jona.sassenhagen at gmail.com
Wed Aug 30 04:40:22 EDT 2017
Search archives:

> On 29. Aug 2017, at 02:42, Roberto Petrosino <roberto.petrosino at uconn.edu> wrote:
> 
> Hi Jona,
> 
> many thanks for your reply. 
> 
> So, linear_regression_raw will take predictors from the covariates argument, which will have to refer to an array having the same length as the event file - am I correct? What is the reasoning behind having two regression functions (one for continuous and one for non-continuous data)? 
> 

(The suggestion is to use pandas data frames for linear_regression_raw)
They work completely differently. One fits independent models at each time point, the other fits one model for the whole data set.



> I was looking at the script here <http://martinos.org/mne/dev/auto_examples/stats/plot_sensor_regression.html#sphx-glr-auto-examples-stats-plot-sensor-regression-py>, and I was a bit unclear about some lines of code - I just started migrating from eeglab, so I apologize if I sound completely ignorant about everything here.
> 
> names = ['intercept', 'trial-count']
> 
> intercept = np.ones <http://docs.scipy.org/doc/numpy/reference/generated/numpy.ones.html#numpy.ones>((len(epochs),), dtype=np.float)
> design_matrix = np.column_stack <http://docs.scipy.org/doc/numpy/reference/generated/numpy.column_stack.html#numpy.column_stack>([intercept,  # intercept
>                                  np.linspace <http://docs.scipy.org/doc/numpy/reference/generated/numpy.linspace.html#numpy.linspace>(0, 1, len(intercept))])
> So, if I’m understanding correctly, here the code is defining one of the two predictors for the next regression analysis. `intercept` is an array as long as the variable `epochs`, and filled with ones. Such an array is “glued” with another array of the same length, filled with evenly spaced numbers between 0 and 0. Everything is then put in the linear regression model:
> 
> # also accepts source estimates
> lm = linear_regression <http://martinos.org/mne/dev/generated/mne.stats.linear_regression.html#mne.stats.linear_regression>(epochs, design_matrix, names)
> 
> My question is - what is `trial_count` in the first place? It is defined as follows:
> 
> trial_count = lm['trial-count']
> but I don’t seem to understand what that really is. Basically what I was trying to do is plotting rERP waveforms with the epoched regression function, similarly to what is showed for the non-epoched regression function here <http://martinos.org/mne/dev/auto_examples/stats/plot_linear_regression_raw.html#sphx-glr-auto-examples-stats-plot-linear-regression-raw-py>.
> 

trial_count is the 2nd column of the design matrix. It’s, as you said, evenly spaced numbers from 0 to 1, so it’s 0 for the first and 1 for the last epoch. It gets its name from the “names” list (defined further up) fed as the 3rd argument to linear_regression.
So it’s just a regressor for how late you are in the experiment.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170830/768583e6/attachment-0001.html 


More information about the Mne_analysis mailing list