Skip to content

Commit 85fe16c

Browse files
committedMar 2, 2017
remove baseline correction
1 parent 419485c commit 85fe16c

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
 

‎mi50it.m

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
function it = mi50it(data,xf,pts,plotit)
2+
% it = mi50it(data,xf,pts,plotit)
3+
%
4+
% Computes the 50% integration time of mutual information data.
5+
% 50it is a measure of processing speed that alleviates the need to consider peaks,
6+
% by considering the shape of a time-course in a time-window of interest.
7+
% The measure was introduced in this paper:
8+
% Rousselet, G.A., Gaspar, C.M., Pernet, C.R., Husk, J.S., Bennett, P.J. & Sekuler, A.B. (2010)
9+
% Healthy aging delays scalp EEG sensitivity to noise in a face discrimination task.
10+
% Front Psychol, 1, 19.
11+
% http://www.frontiersin.org/perception_science/10.3389/fpsyg.2010.00019/abstract
12+
% The current version is slightly different, starting with a baseline correction
13+
% so as to not integrate MI values around baseline level.
14+
%
15+
% data = a column vector or time x participant matrix of positive only observations, e.g. mutual information
16+
% xf = time vector - default -300:2:600
17+
% pts = points at which to estimate the time-course - default [0 500]
18+
% plotit = 1 to get a figure, 0 otherwise
19+
20+
% Copyright (C) 2016 Guillaume Rousselet - University of Glasgow
21+
22+
if nargin < 2
23+
xf = -300:2:600;
24+
end
25+
if nargin < 3
26+
pts = [0 500];
27+
end
28+
if nargin < 4
29+
plotit = 0;
30+
end
31+
32+
[nf,np] = size(data);
33+
frame_selec = xf>=pts(1) & xf<=pts(2);
34+
xf50it = xf(frame_selec);
35+
nf50it = numel(xf50it);
36+
37+
% baseline correction
38+
% data = data - repmat( median(data(xf<0,:),1), [nf 1] );
39+
40+
% cumulative sum
41+
data = data(frame_selec,:);
42+
data = cumsum( data, 1 );
43+
44+
% normalization
45+
data = data - repmat(min(data,[],1), [nf50it 1]); % figure;plot(Xf0500,cs1)
46+
data = data ./ repmat(max(data,[],1), [nf50it 1]); % figure;plot(Xf0500,cs1)
47+
it = zeros(np,1);
48+
for P = 1:np % for every participant
49+
it(P) = interp1(data(:,P),xf50it,.5,'linear');
50+
end
51+
52+
if plotit == 1
53+
54+
cc = parula(np);
55+
figure('Color','w','NumberTitle','off','Name','50% integration time')
56+
hold on
57+
for P=1:np
58+
plot(xf50it,data(:,P),'Color',cc(P,:),'LineWidth',2)
59+
plot([it(P) it(P)],[0 1],'Color',cc(P,:),'LineWidth',1)
60+
end
61+
set(gca,'LineWidth',2,'YLim',[0 1],'XLim',pts,'XTick',pts(1):50:pts(2))
62+
set(gca,'FontSize',14,'Layer','Top')
63+
xlabel('Time in ms','FontSize',16')
64+
ylabel('Normalised MI','FontSize',16')
65+
box on
66+
67+
end

0 commit comments

Comments
 (0)