<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Many thanks, and apologies for the silly question!<div class=""><br class=""></div><div class="">-Roberto</div><div class=""><div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">----------<br class="">Roberto Petrosino<br class="">Ph.D. Student in Linguistics</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">CT Institute for&nbsp;the Brain&nbsp;and Cognitive Sciences<br class="">University of Connecticut<br class=""><br class=""></div></div></div></div>
</div>
<br class=""><div style=""><blockquote type="cite" class=""><div class="">On Sep 6, 2017, at 8:46 PM, Dan McCloy &lt;<a href="mailto:drmccloy@uw.edu" class="">drmccloy@uw.edu</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class="">assuming your design matrix is a pandas DataFrame, where rows are epochs and columns are predictor variables:<br class=""><br class=""></div>design_matrix_for_retained_epochs = my_design_matrix.iloc[my_epochs.selection, :]<br class=""><br class=""></div><div class="">if that's not enough:<br class=""><a href="https://martinos.org/mne/stable/generated/mne.Epochs.html" class="">https://martinos.org/mne/stable/generated/mne.Epochs.html</a> (search for "selection")<br class=""><a href="https://pandas.pydata.org/pandas-docs/stable/indexing.html" class="">https://pandas.pydata.org/pandas-docs/stable/indexing.html</a><br class=""></div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Sep 6, 2017 at 5:33 PM, Roberto Petrosino <span dir="ltr" class="">&lt;<a href="mailto:roberto.petrosino@uconn.edu" target="_blank" class="">roberto.petrosino@uconn.edu</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi Dan,&nbsp;<div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">Thanks!</div><span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">-Roberto</div><div class=""><br class=""></div></font></span><div class=""><span class=""><br class=""><div class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="word-wrap:break-word" class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">----------<br class="">Roberto Petrosino<br class="">Ph.D. Student in Linguistics</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">CT Institute for&nbsp;the Brain&nbsp;and Cognitive Sciences<br class="">University of Connecticut<br class=""><br class=""></div></div></div></div>
</div>
<br class=""></span><div class=""><div class="h5"><div class=""><blockquote type="cite" class=""><div class="">On Sep 6, 2017, at 12:47 PM, Dan McCloy &lt;<a href="mailto:drmccloy@uw.edu" target="_blank" class="">drmccloy@uw.edu</a>&gt; wrote:</div><br class="m_-9208483585026143395Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="m_-9208483585026143395gmail-ajy"><img class="m_-9208483585026143395gmail-ajz" id="m_-9208483585026143395gmail-:oi" src="https://mail.google.com/mail/u/0/images/cleardot.gif" alt="">Epochs
 objects have a property called "selection" that give you the indices of
 the epochs that were not dropped.&nbsp; You can use those indices to select 
only those rows of your design matrix.<br class=""></div>-- dan<br class=""><br class="">Daniel McCloy<br class=""><a href="http://dan.mccloy.info/" target="_blank" class="">http://dan.mccloy.info/</a><br class="">Postdoctoral Research Associate<br class="">Institute for Learning and Brain Sciences<br class="">University of Washington</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Sep 6, 2017 at 8:36 AM, Roberto Petrosino <span dir="ltr" class="">&lt;<a href="mailto:roberto.petrosino@uconn.edu" target="_blank" class="">roberto.petrosino@uconn.edu</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi all,<div class=""><br class=""></div><div class="">I am trying to run linear regression on epochs after artifact rejection.&nbsp;</div><div class=""><br class=""></div><div class="">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.&nbsp;</div><div class=""><br class=""></div><div class="">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 <font face="Menlo" class="">linear_regression_raw </font>has the arguments <font face="Menlo" class="">reject&nbsp;</font>and <font face="Menlo" class="">flat</font>&nbsp;that would allow me to do what I want, but I’d actually rather use <font face="Menlo" class="">linear_regression</font>&nbsp;on already epoched and ICA-corrected data, but I don’t seem to find any similar option that would suit my case.</div><div class=""><br class=""></div><div class="">Many thanks in advance,</div><div class=""><br class=""></div><div class="">-Roberto</div><div class=""><br class=""><div class="">
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word" class=""><div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word" class=""><div style="word-wrap:break-word" class=""><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">----------<br class="">Roberto Petrosino<br class="">Ph.D. Student in Linguistics</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">CT Institute for&nbsp;the Brain&nbsp;and Cognitive Sciences<br class="">University of Connecticut<br class=""><br class=""></div></div></div></div>
</div>

<br class=""></div></div><br class="">______________________________<wbr class="">_________________<br class="">
Mne_analysis mailing list<br class="">
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank" class="">Mne_analysis@nmr.mgh.harvard.e<wbr class="">du</a><br class="">
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank" class="">https://mail.nmr.mgh.harvard.e<wbr class="">du/mailman/listinfo/mne_analys<wbr class="">is</a><br class="">
<br class="">
<br class="">
The information in this e-mail is intended only for the person to whom it is<br class="">
addressed. If you believe this e-mail was sent to you in error and the e-mail<br class="">
contains patient information, please contact the Partners Compliance HelpLine at<br class="">
<a href="http://www.partners.org/complianceline" rel="noreferrer" target="_blank" class="">http://www.partners.org/compli<wbr class="">anceline</a> . If the e-mail was sent to you in error<br class="">
but does not contain patient information, please contact the sender and properly<br class="">
dispose of the e-mail.<br class="">
<br class=""></blockquote></div><br class=""></div>
______________________________<wbr class="">_________________<br class="">Mne_analysis mailing list<br class=""><a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank" class="">Mne_analysis@nmr.mgh.harvard.<wbr class="">edu</a><br class=""><a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" target="_blank" class="">https://mail.nmr.mgh.harvard.<wbr class="">edu/mailman/listinfo/mne_<wbr class="">analysis</a><br class=""><br class=""><br class="">The information in this e-mail is intended only for the person to whom it is<br class="">addressed. If you believe this e-mail was sent to you in error and the e-mail<br class="">contains patient information, please contact the Partners Compliance HelpLine at<br class=""><a href="http://www.partners.org/complianceline" target="_blank" class="">http://www.partners.org/<wbr class="">complianceline</a> . If the e-mail was sent to you in error<br class="">but does not contain patient information, please contact the sender and properly<br class="">dispose of the e-mail.<br class=""></div></blockquote></div><br class=""></div></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">
Mne_analysis mailing list<br class="">
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" class="">Mne_analysis@nmr.mgh.harvard.<wbr class="">edu</a><br class="">
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank" class="">https://mail.nmr.mgh.harvard.<wbr class="">edu/mailman/listinfo/mne_<wbr class="">analysis</a><br class="">
<br class="">
<br class="">
The information in this e-mail is intended only for the person to whom it is<br class="">
addressed. If you believe this e-mail was sent to you in error and the e-mail<br class="">
contains patient information, please contact the Partners Compliance HelpLine at<br class="">
<a href="http://www.partners.org/complianceline" rel="noreferrer" target="_blank" class="">http://www.partners.org/<wbr class="">complianceline</a> . If the e-mail was sent to you in error<br class="">
but does not contain patient information, please contact the sender and properly<br class="">
dispose of the e-mail.<br class="">
<br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">Mne_analysis mailing list<br class=""><a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" class="">Mne_analysis@nmr.mgh.harvard.edu</a><br class="">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis<br class=""><br class=""><br class="">The information in this e-mail is intended only for the person to whom it is<br class="">addressed. If you believe this e-mail was sent to you in error and the e-mail<br class="">contains patient information, please contact the Partners Compliance HelpLine at<br class="">http://www.partners.org/complianceline . If the e-mail was sent to you in error<br class="">but does not contain patient information, please contact the sender and properly<br class="">dispose of the e-mail.<br class=""></div></blockquote></div><br class=""></div></div></body></html>