<div dir="ltr"><div><div>assuming your design matrix is a pandas DataFrame, where rows are epochs and columns are predictor variables:<br><br></div>design_matrix_for_retained_epochs = my_design_matrix.iloc[my_epochs.selection, :]<br><br></div><div>if that&#39;s not enough:<br><a href="https://martinos.org/mne/stable/generated/mne.Epochs.html">https://martinos.org/mne/stable/generated/mne.Epochs.html</a> (search for &quot;selection&quot;)<br><a href="https://pandas.pydata.org/pandas-docs/stable/indexing.html">https://pandas.pydata.org/pandas-docs/stable/indexing.html</a><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 6, 2017 at 5:33 PM, Roberto Petrosino <span dir="ltr">&lt;<a href="mailto:roberto.petrosino@uconn.edu" target="_blank">roberto.petrosino@uconn.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Dan, <div><br></div><div>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><br></div><div>Thanks!</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Roberto</div><div><br></div></font></span><div><span class=""><br><div>
<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;word-wrap:break-word"><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;word-wrap:break-word"><div style="word-wrap:break-word"><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">----------<br>Roberto Petrosino<br>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">CT Institute for the Brain and Cognitive Sciences<br>University of Connecticut<br><br></div></div></div></div>
</div>
<br></span><div><div class="h5"><div><blockquote type="cite"><div>On Sep 6, 2017, at 12:47 PM, Dan McCloy &lt;<a href="mailto:drmccloy@uw.edu" target="_blank">drmccloy@uw.edu</a>&gt; wrote:</div><br class="m_-9208483585026143395Apple-interchange-newline"><div><div dir="ltr"><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 &quot;selection&quot; 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.<br></div>-- dan<br><br>Daniel McCloy<br><a href="http://dan.mccloy.info/" target="_blank">http://dan.mccloy.info/</a><br>Postdoctoral Research Associate<br>Institute for Learning and Brain Sciences<br>University of Washington</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 6, 2017 at 8:36 AM, Roberto Petrosino <span dir="ltr">&lt;<a href="mailto:roberto.petrosino@uconn.edu" target="_blank">roberto.petrosino@uconn.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi all,<div><br></div><div>I am trying to run linear regression on epochs after artifact rejection. </div><div><br></div><div>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. </div><div><br></div><div>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">linear_regression_raw </font>has the arguments <font face="Menlo">reject </font>and <font face="Menlo">flat</font> that would allow me to do what I want, but I’d actually rather use <font face="Menlo">linear_regression</font> on already epoched and ICA-corrected data, but I don’t seem to find any similar option that would suit my case.</div><div><br></div><div>Many thanks in advance,</div><div><br></div><div>-Roberto</div><div><br><div>
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="word-wrap:break-word"><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">----------<br>Roberto Petrosino<br>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">CT Institute for the Brain and Cognitive Sciences<br>University of Connecticut<br><br></div></div></div></div>
</div>

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