<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Dear Eliana,
<br>
One option for you would be, rather than deleting the bad channels, to interpolate what their activity would be from the average of surrounding channels.
<br>
You can do this with FT_CHANNELREPAIR and it's pretty straightforward<br>
<br>
<a href="http://www.fieldtriptoolbox.org/reference/channelrepair" target="_blank">http://www.fieldtriptoolbox.org/reference/channelrepair</a><br>
<br>
Good luck with it!<br>
<br>
<br>
Erin<br>
<br>
<div><br>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div>----------------------------------------------------</div>
Erin White, PhD
<div>Post-Doctoral Research Fellow</div>
<div><font face="Tahoma" size="2">Neurosciences and Mental Health<br>
The Hospital for Sick Children<br>
555 University Avenue<br>
Toronto, Ontario<br>
Canada</font><font style="font-family:'Times New Roman'; font-size:16px" face="Times New Roman"> </font></div>
<div>Telephone: (647)834-7813</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF390338"><font face="Tahoma" size="2" color="#000000"><b>From:</b> fieldtrip-bounces@science.ru.nl [fieldtrip-bounces@science.ru.nl] on behalf of Eliana Nicolaisen [elinicolaisen@gmail.com]<br>
<b>Sent:</b> April 11, 2016 10:21 AM<br>
<b>To:</b> fieldtrip@science.ru.nl<br>
<b>Subject:</b> [FieldTrip] Grand average with deleted channels<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr"><span style="font-size:12.8px">Dear all,</span>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">I'm trying to make an ERP grand average using version 20150301. In some subjects I deleted bad channels. Those channels were replaced for NaNs. When I make the grand average using ft_timelockaverage, the grand average is composed
 only for the common channels across subjects. In other words, in channels deleated at least in one subject the grand average is NaN. This is because ft_timelockanalysis in this version calculates the average making a sum and dividng into degrees of freedom:</div>
<span style="font-size:12.8px">
<div><br>
</div>
<div><i>grandavg.avg   = reshape(sum(avgmat, 1), datsiz)./ResultDOF; </i></div>
<div><i><br>
</i></div>
<div>(in line 187 of revision '$Id: ft_timelockgrandaverage.m 10194 2015-02-11 09:08:16Z roboos $')<br>
</div>
<div><br>
</div>
</span>
<div style="font-size:12.8px">However, I tried version 20121014 that my colleague uses. In this version ft_timelockedanalysis makes a mean:</div>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px"><i>ResultGrandavg = mean(avgmat, 1);</i><br>
</div>
<span style="font-size:12.8px">
<div><br>
</div>
<div>(in line 183 of revision '$Id: ft_timelockgrandaverage.m 6750 2012-10-13 15:07:32Z roboos $')</div>
<div><br>
</div>
<div>In the version 20121014 is easy to make a correction that calculates a grand average taking into account NaNs (just changing mean for nanmean). However, in version 20150301 making a similar correction seems more complicated. </div>
<div><br>
</div>
<div>Question 1: Why version 20150301 calculates average using sum and division instead of using nanmean?</div>
<div>Question 2: Do someone have a suggestion about how to change version 20150301?</div>
<div><br>
</div>
<div>Any comment would be greatly appreciated.</div>
<div><br>
</div>
<div>Kind regards,</div>
<div>Eliana Nicolaisen</div>
</span></div>
</div>
</div>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
This e-mail may contain confidential, personal and/or health information(information which may be subject to legal restrictions on use, retention and/or disclosure) for the sole use of the intended recipient. Any review or distribution by anyone other than
 the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete all copies.<br>
</font>
</body>
</html>