[FieldTrip] What is the data present in the covariance matrix after using ft_timelockanalysis
Nakhnikian, Alexander
Alexander_Nakhnikian at hms.harvard.edu
Thu Jun 16 17:00:02 CEST 2016
Hi Soujatta,
I hope I understand your question.
For demeaned data, the covariance is the expected value of sum(xy). For data with finite mean, we have to get the expected value of sum(x-mu(x))*sum(y-mu(y)). Removing the mean and trend doesn't have any impact on the denominators used to compute the unbiased estimate of E{sum(xy)}. The unbiased covariance estimated between x and y for a given trial is sum(xy)/(N_times-1), where N _times is the number of time points in an epoch. When averaging covariance matrices over multiple trials the denominator becomes N_trs-1. I hope that helps.
Best,
Alexander
________________________________
From: fieldtrip-bounces at science.ru.nl <fieldtrip-bounces at science.ru.nl> on behalf of Soujata Borbaruah <s.borbaruah at student.utwente.nl>
Sent: Thursday, June 16, 2016 10:19:12 AM
To: fieldtrip, donders
Subject: [FieldTrip] What is the data present in the covariance matrix after using ft_timelockanalysis
Hello,
I want to calculate the covariance of the data I provide. In the function ft_timelockanalysis there is a portion where the covariance is being normalised over all trials by the total number of samples in all trials.
% normalize the covariance over all trials by the total number of samples in all trials
if strcmp(cfg.covariance, 'yes')
if strcmp(cfg.keeptrials,'yes')
for i=1:ntrial
if strcmp(cfg.removemean, 'yes')
covsig(i,:,:) = covsig(i,:,:) / (numcovsigsamples(i)-1);
else
covsig(i,:,:) = covsig(i,:,:) / numcovsigsamples(i);
end
end
else
if strcmp(cfg.removemean, 'yes')
covsig = squeeze(nansum(covsig, 1)) / (sum(numcovsigsamples)-ntrial);
else
covsig = squeeze(nansum(covsig, 1)) / sum(numcovsigsamples);
end
end
end
Please note that the cfg.removemean was selected as yes.
Can someone please explain what is the final data present in my covariance matrix?
Sent with MailTrack<https://mailtrack.io/install?source=signature&lang=en&referral=s.borbaruah@student.utwente.nl&idSignature=22>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160616/a5d15d23/attachment-0002.html>
More information about the fieldtrip
mailing list