[Mne_analysis] running artifact rejection and then linear regression

Dan McCloy drmccloy at uw.edu
Wed Sep 6 20:46:35 EDT 2017
Search archives:

assuming your design matrix is a pandas DataFrame, where rows are epochs
and columns are predictor variables:

design_matrix_for_retained_epochs =
my_design_matrix.iloc[my_epochs.selection, :]

if that's not enough:
https://martinos.org/mne/stable/generated/mne.Epochs.html (search for
"selection")
https://pandas.pydata.org/pandas-docs/stable/indexing.html


On Wed, Sep 6, 2017 at 5:33 PM, Roberto Petrosino <
roberto.petrosino at uconn.edu> wrote:

> Hi Dan,
>
> thanks for your suggestion, which seems doable and easy enough. Would you
> mind expanding a bit about it? I’m not an python expert, and it would be
> really helpful if you can pinpoint a tutorial/documentation I can look at.
>
> Thanks!
>
> -Roberto
>
>
> ----------
> Roberto Petrosino
> Ph.D. Student in Linguistics
> CT Institute for the Brain and Cognitive Sciences
> University of Connecticut
>
>
> On Sep 6, 2017, at 12:47 PM, Dan McCloy <drmccloy at uw.edu> wrote:
>
> Epochs objects have a property called "selection" that give you the
> indices of the epochs that were not dropped.  You can use those indices to
> select only those rows of your design matrix.
> -- dan
>
> Daniel McCloy
> http://dan.mccloy.info/
> Postdoctoral Research Associate
> Institute for Learning and Brain Sciences
> University of Washington
>
> On Wed, Sep 6, 2017 at 8:36 AM, Roberto Petrosino <
> roberto.petrosino at uconn.edu> wrote:
>
>> Hi all,
>>
>> I am trying to run linear regression on epochs after artifact rejection.
>>
>> Each epoch in my data refers to a specific stimulus (say, a specific
>> word) having specific predictors (i.e., frequency values) associated with
>> it. I have constructed a design matrix with all the predictors I would like
>> to run regression against for each epoch. Since each stimulus will have
>> specific values for the predictors, I assume that if I reject all bad
>> epochs before running regression, there will be a mismatch between the
>> dimension of the data to be regressed and the dimension of the design
>> matrix array.
>>
>> So, my question is: is there any way around this - e.g., is there a way
>> have bad epochs only marked as bad, and run linear regression on good
>> epochs only? That way, the dimension of the data to be regressed and the
>> design matrix are the same, but the actual regression calculations will be
>> run selectively. I know that the function linear_regression_raw has the
>> arguments reject and flat that would allow me to do what I want, but I’d
>> actually rather use linear_regression on already epoched and
>> ICA-corrected data, but I don’t seem to find any similar option that would
>> suit my case.
>>
>> Many thanks in advance,
>>
>> -Roberto
>>
>> ----------
>> Roberto Petrosino
>> Ph.D. Student in Linguistics
>> CT Institute for the Brain and Cognitive Sciences
>> University of Connecticut
>>
>>
>>
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>
>>
>> The information in this e-mail is intended only for the person to whom it
>> is
>> addressed. If you believe this e-mail was sent to you in error and the
>> e-mail
>> contains patient information, please contact the Partners Compliance
>> HelpLine at
>> http://www.partners.org/complianceline . If the e-mail was sent to you
>> in error
>> but does not contain patient information, please contact the sender and
>> properly
>> dispose of the e-mail.
>>
>>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> The information in this e-mail is intended only for the person to whom it
> is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in
> error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
>
>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> The information in this e-mail is intended only for the person to whom it
> is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in
> error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170906/a0b45325/attachment.html 


More information about the Mne_analysis mailing list