% LongShort :: Script that illustrates the proportional relationship between lateral intraparietal response and reaction time as in Figure 10 of Grossberg and Pilly (2008)
%
%% Reference
% Grossberg, S. and Pilly, P. K. (2008). Temporal dyanamics of decision-making during motion perception in the visual cortex. Vision Research, 48(12), 1345-1373.
%
%% Author
% Praveen K. Pilly (advaitp@gmail.com)
%
%% License policy
% Written by Praveen K. Pilly, Department of Cognitive and Neural Systems, Boston University
% Copyright 2009, Trustees of Boston University
%
% Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted
% without fee, provided that the above copyright notice and this permission notice appear in all copies, derivative works and
% associated documentation, and that neither the name of Boston University nor that of the author(s) be used in advertising or
% publicity pertaining to the distribution or sale of the software without specific, prior written permission. Neither Boston
% University nor its agents make any representations about the suitability of this software for any purpose. It is provided "as
% is" without warranty of any kind, either express or implied. Neither Boston University nor the author indemnify any
% infringement of copyright, patent, trademark, or trade secret resulting from the use, modification, distribution or sale of
% this software.
%
%% Last modified
% June 25, 2009
%%
% s: short group
% l: long group
% The code below is pretty straight forward. But it does not follow all the
% 'consistent' notations used in other programs in the package
RT_s=zeros(numtrials,cohL);
RT_l=zeros(numtrials,cohL);
RTm_s=zeros(1,cohL);
RTm_l=zeros(1,cohL);
nzCohs=[];
for coh=1:cohL
% This analysis makes sense only if there are at least two correct
% trials per coherence level
if length(nonzeros(RTc(:,coh)))>1
RTm=median(nonzeros(RTc(:,coh))); % median RT at each coherence
for trial=1:numtrials
if RTc(trial,coh)~=0
if RTc(trial,coh)>RTm % dividing into short and long groups
RT_l(trial,coh)=RTc(trial,coh);
else
RT_s(trial,coh)=RTc(trial,coh);
end
end
end
nzCohs=[nzCohs coh];
% Computing the median RT of each group
RTm_s(coh)=median(nonzeros(RT_s(:,coh)));
RTm_l(coh)=median(nonzeros(RT_l(:,coh)));
end
end
% Least squares estimates for linear fits (inset in Figure 10d)
Xcoh=coherences(nzCohs);
X1m=0:1:51;
if length(Xcoh)>0
[pm_s]=polyfit(Xcoh,nonzeros(RTm_s)',1);
Y1m=pm_s(1)*X1m+pm_s(2);
[pm_l]=polyfit(Xcoh,nonzeros(RTm_l)',1);
Y2m=pm_l(1)*X1m+pm_l(2);
figure
hold on
plot(Xcoh,nonzeros(RTm_s),'ko')
plot(X1m,Y1m,'k')
plot(Xcoh,nonzeros(RTm_l),'kd')
plot(X1m,Y2m,'k--')
axis([-5 55 200 1100])
hold off
xlabel('Motion strength (% coherence)','Fontsize',15)
ylabel('Median RT (ms)','Fontsize',15)
title('Relationship between LIP response and RT for the RT task','Fontsize',15)
box off
set(gca,'Fontsize',12)
end
[y3s,y4s,tnc_Fextent_s]=computeLIP_lhs(RT_s,Y1c,Y2c,cohL,numtrials,dt);
[y3l,y4l,tnc_Fextent_l]=computeLIP_lhs(RT_l,Y1c,Y2c,cohL,numtrials,dt);
% Figure 10b shows data from 6.4% coherence trials
coh=3; % coherence level can be changed here
% The figure can be computed only if there are atleast two correct trials
% at the coherence level
if length(nonzeros(RTc(:,coh)))>1
figure
hold on
Q1=y3s(:,coh);
Q2=y3l(:,coh);
x_1=round(1:tnc_Fextent_s(coh));
x_2=round(1:tnc_Fextent_l(coh));
y_1=Q1(x_1);
y_2=Q2(x_2);
plot(x_1,y_1,'k')
plot(x_2,y_2,'k--')
x_1=round(201:tnc_Fextent_s(coh)); % just to make sure they are positive integers
x_2=round(201:tnc_Fextent_l(coh)); % just to make sure they are positive integers
y_1=Q1(x_1);
y_2=Q2(x_2);
[ps]=polyfit(x_1,y_1',1);
[pl]=polyfit(x_2,y_2',1);
Y_1=ps(1)*x_1+ps(2);
Y_2=pl(1)*x_2+pl(2);
plot(x_1,Y_1,'k')
plot(x_2,Y_2,'k')
hold off
axis([0 1000 20 75])
xlabel('Time (ms)','Fontsize',15)
ylabel('Activity','Fontsize',15)
box off
set(gca,'Fontsize',12)
title('Relationship between LIP response and RT for the RT task','Fontsize',15)
end
% Hs=zeros(2,cohL);
% Hl=zeros(2,cohL);
% for coh=1:cohL
% if length(nonzeros(RTc(:,coh)))>1
% Q1=y3s(:,coh);
% Q2=y3l(:,coh);
% x_1=round(201:tnc_Fextent_s(coh)); % just to make sure they are positive integers
% x_2=round(201:tnc_Fextent_l(coh)); % just to make sure they are positive integers
% y_1=Q1(x_1);
% y_2=Q2(x_2);
% x_1=x_1/1000;x_2=x_2/1000;
% fresult1=fit(x_1',y_1,'poly1');
% fresult2=fit(x_2',y_2,'poly1');
% ci1=confint(fresult1);
% ci2=confint(fresult2);
% Hs(1,coh)=(ci1(1,1)+ci1(2,1))/2;
% Hs(2,coh)=(ci1(2,1)-ci1(1,1))/2;
% Hl(1,coh)=(ci2(1,1)+ci2(2,1))/2;
% Hl(2,coh)=(ci2(2,1)-ci2(1,1))/2;
% end
% end
%
% if length(Xcoh)
% figure
% bar(1:3:16,Hs(1,:),0.2)
% hold on
% bar(2:3:17,Hl(1,:),0.2),colormap([1 1 1])
% errorbar(1:3:16,Hs(1,:),Hs(2,:),'k.')
% errorbar(2:3:17,Hl(1,:),Hl(2,:),'k.')
% hold off
% ylabel('Slope of response','Fontsize',15)
% box off
% set(gca,'Fontsize',12)
% end