[Mne_analysis] source-space analysis on MNE

Roberto Petrosino roberto.petrosino at uconn.edu
Wed Aug 30 09:57:43 EDT 2017
Search archives:

Hi Jona,

that makes sense. I have another couple of questions, if you don’t mind me asking. :)

1) I tried to use linear_regression_raw on my data, but I got the weird result attached. It looked like my data needed to be baseline-corrected (which isn’t apparently applied within the actual function), but I wouldn't know how to do it. Is it the apply_baseline method that I should use for that purpose?

2) A way around the problem in 1) would be to use linear_regression on already epoched and baseline-corrected data as shown here <http://martinos.org/mne/dev/auto_examples/stats/plot_sensor_regression.html#sphx-glr-auto-examples-stats-plot-sensor-regression-py>. Is there a plotting results other than the topomaps exemplified there?

3) I don’t seem to understand what some of the arguments of linear_regression_raw really say. In particular, which argument takes the predictors to run the regression against - covariates or solver? What does each of them actually do?

Many thanks for all the help, and apologies for the amount of questions!

-Roberto

----------
Roberto Petrosino
Ph.D. Student in Linguistics
CT Institute for the Brain and Cognitive Sciences
University of Connecticut


> On Aug 30, 2017, at 4:40 AM, Jona Sassenhagen <jona.sassenhagen at gmail.com> wrote:
> 
>> 
>> On 29. Aug 2017, at 02:42, Roberto Petrosino <roberto.petrosino at uconn.edu <mailto: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/880af65d/attachment-0001.html 


More information about the Mne_analysis mailing list