Lab book for Zebrafish experiments

April 2, 2012

Relation between the new model (the one in Sara’s paper) and the old one (the one in PLoS). It is analytical!

Filed under: Bayesian theory, Social Decision Making — alperezescudero @ 11:26 am

Name of this file: Cuaderno20120402T111150.m

Model definition

I define the new model with k=1, so that we have deltan

P=@(ax,ay,s,deltan) (1+(1+ax*s.^-deltan)./(1+ay*s.^deltan)).^-1;
Pold=@(a,s,deltan) (1+a*s.^-deltan).^-1;

Comparison for a=1

They are identical

figure
deltan=-10:10;
a=1;
s=2.5;
ax=1;
ay=1;
plot(deltan,Pold(a,s,deltan))
hold on
plot(deltan,P(ax,ay,s,deltan),’r–‘)

 

Comparison for a~=1

I check for a=10.

figure
deltan=-10:10;
a=10;
s=2.5;
ax=1;
ay=.1;
plot(deltan,Pold(a,s,deltan))
hold on
plot(deltan,P(ax,ay,s,deltan),’r–‘)

aes=10.^(-5:.1:5);
n_a=length(aes);
errores1=NaN(n_a);
for cx_a=1:n_a
for cy_a=1:n_a
errores1(cy_a,cx_a)=sum(abs(Pold(a,s,deltan)-P(aes(cx_a),aes(cy_a),s,deltan)));
end % cy
end % cx
[m,ind]=min(errores1(:));
[i,j]=ind2sub(size(errores1),ind);
ax=aes(j)
ay=aes(i)
figure
imagesc(log10(aes),log10(aes),errores1)
colorbar
figure
imagesc(log10(aes),log10(aes),log10(errores1))
colorbar
xlabel(‘log_{10}(a_x)’)
ylabel(‘log_{10}(a_y)’)
figure
plot(deltan,Pold(a,s,deltan))
hold on
plot(deltan,P(ax,ay,s,deltan),’r–‘)

ax =
10
ay =
0.1000

 

 

 

 

So we get a very clear minimum, with excellent agreement.

General search for a~=1

I repeat the whole procedure for different values of a.

a=10.^(-5:.5:5);
m=NaN(length(a),1);
ax=m;
ay=m;
for c_a=1:length(a)
aes=10.^(-5:.1:5);
n_a=length(aes);
errores2=NaN(n_a);
for cx_a=1:n_a
for cy_a=1:n_a
errores2(cy_a,cx_a)=sum(abs(Pold(a(c_a),s,deltan)-P(aes(cx_a),aes(cy_a),s,deltan)));
end % cy
end % cx
[m(c_a),ind]=min(errores2(:));
[i,j]=ind2sub(size(errores2),ind);
ax(c_a)=aes(j);
ay(c_a)=aes(i);
end % c_a
subplot(1,2,1)
plot(log10(a),log10(m))
xlabel(‘log_{10}(a_{old})’)
ylabel(‘log_{10}(error)’)
subplot(1,2,2)
hold off
plot(log10(a),log10(ax))
hold on
plot(log10(a),log10(ay),’r’)
xlabel(‘log_{10}(a_{old})’)
ylabel(‘log_{10}(a_{new})’)

 

figure
loglog(a,ax./ay,’.-‘)
xlabel(‘a_{old}’)
ylabel(‘a_x/a_y’)
figure
loglog(a,ax)
xlabel(‘a_{old}’)
ylabel(‘a_x’)
figure
loglog(a,ay)
xlabel(‘a_{old}’)
ylabel(‘a_y’)
figure
loglog(ax,ay)
xlabel(‘a_x’)
ylabel(‘a_y’)

 

 

 

 

So incredibly simple relation! There must be something analytical here…

Efectiviguonder

It turns out that

.

So it is analytical! We just have ax=a, ay=1/a.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.