Commit 5f7781ee authored by Simon Ciranka's avatar Simon Ciranka

new report

parent 9555081a
......@@ -22,9 +22,16 @@ my_theme <- theme_bw( )+theme(axis.text = element_text(size = 18),
```
# Implementing Binomal Updating in Wouters way.
# The task.
Each Trial, Participants see a binomal sequence that consits out of 7 to 33 draws from the distribution with varying outcome probabilites. Then they are asked to estimate the distribution of the sequence. After this they make a gambling choice based upon this inference. They can decide for a gamble with outcome probabilites as indicated by the sequence they observed. They also can decide for a safe option that yields a lower but certain bonus.The whole sample is devided onto five 3x3 grids where a grey circle is mereley a placeholder.
![image](LiklelihoodUpdateBeta_files/task.png "Task").
Data is from 53 Subjects who each performed 72 trials of the experiment. Each grid was shwon for one second and there was an ITI ranging from 2 to 5 seconds with a skew towards shorter ITIs.
![image](LiklelihoodUpdateBeta_files/ITI_Distributions.png "Task").
They had 7 seconds for estimating and 4 seconds for the gambeling choice.
These code chunks and results are implementing the models in wouters mail form the 11.9.2018. Other than before, we now caluculate the log likelihood of our participants estimates by assuming that the range of possible estimates is normally distributed. The probability density under the specific probability estimate of the participant is now the likelihood. For this i need a function that returns discrete values for the probability denisty in question.
# Implementing Binomal Updating.
The following code chunks and results are implementing the models in wouters mail form the 11.9.2018. Other than before, we now caluculate the log likelihood of our participants estimates by assuming that the range of possible estimates is normally distributed. The probability density under the specific probability estimate of the participant is now the likelihood. For this i need a function that returns discrete values for the probability denisty in question.
I implemented the function you sent to me in your mail. At some point when you talk about the arguments that you pass to the cumulative densitiy function which you use to get a log likelihood; you say sigma is sigma.
In the example you sent to me; you do not use sigma as the variance estimate of the beta updating before. You pass sigma with the function one higher level that you then minimize. Is sigma as you use it a free parameter of the model as well? So you dont have one but two free parameters?
......
Implementing Binomal Updating in Wouters way.
=============================================
These code chunks and results are implementing the models in wouters
mail form the 11.9.2018. Other than before, we now caluculate the log
likelihood of our participants estimates by assuming that the range of
possible estimates is normally distributed. The probability density
under the specific probability estimate of the participant is now the
likelihood. For this i need a function that returns discrete values for
the probability denisty in question.
The task.
=========
Each Trial, Participants see a binomal sequence that consits out of 7 to
33 draws from the distribution with varying outcome probabilites. Then
they are asked to estimate the distribution of the sequence. After this
they make a gambling choice based upon this inference. They can decide
for a gamble with outcome probabilites as indicated by the sequence they
observed. They also can decide for a safe option that yields a lower but
certain bonus.The whole sample is devided onto five 3x3 grids where a
grey circle is mereley a placeholder.
![image](LiklelihoodUpdateBeta_files/task.png "Task"). Data is from 53
Subjects who each performed 72 trials of the experiment. Each grid was
shwon for one second and there was an ITI ranging from 2 to 5 seconds
with a skew towards shorter ITIs.
![image](LiklelihoodUpdateBeta_files/ITI_Distributions.png "Task"). They
had 7 seconds for estimating and 4 seconds for the gambeling choice.
Implementing Binomal Updating.
==============================
The following code chunks and results are implementing the models in
wouters mail form the 11.9.2018. Other than before, we now caluculate
the log likelihood of our participants estimates by assuming that the
range of possible estimates is normally distributed. The probability
density under the specific probability estimate of the participant is
now the likelihood. For this i need a function that returns discrete
values for the probability denisty in question.
I implemented the function you sent to me in your mail. At some point
when you talk about the arguments that you pass to the cumulative
......
This diff is collapsed.
clear all;
%% generate samples (each with 1-9 blue marbles)
nmarbles=9; % per sample
nsamples=5;
ntrials=10000;
oribin=betarnd(1,1,ntrials,1); % true distributions
allmarbles=binornd(1,repmat(oribin,1,nsamples,9));
stims=sum(allmarbles,3);
%% sample wise "Bayesian update"
expos=0.6:0.05:2;
for exp=1:length(expos)
expo=expos(exp);
basew=1;
wk=ones(1,nsamples); % tbd (can use for weighting across sample positions)
w=powerf(linspace(0,1,nmarbles+1),expo,0);
w=w./(linspace(0,1,nmarbles+1)-mean(linspace(0,1,nmarbles+1))); % neutralises & replaces gainc
w=w-mean(w);
w=1+w;
plot(w); hold on
title('weights');
wk=basew+(wk-mean(wk));
%update
betahum=NaN(ntrials,nsamples,2);
for i=1:size(stims,1)
actstim=stims(i,:);
init=[1 1];
for j=1:size(stims,2)
thisw=actstim(j)+1; % in this simple case, this and and actstim are the same
init(1)=init(1)+wk(j)*w(thisw)*(actstim(j));
init(2)=init(2)+wk(j)*w(thisw)*(nmarbles-actstim(j));
betahum(i,j,:)=init;
end
end
%% optimal (noiseless observer)
avg=mean(stims,2)./nmarbles;
optiresp= avg>oribin; % where oribin here just is the EV-matched safe alternative
%% noisy prediction
mfns=1:1:20; % my funny noises (the more internal sampling, the less noise)
for m=1:length(mfns);
mfn=mfns(m);
betahummer1=repmat(betahum(:,end,1),1,mfn);
betahummer2=repmat(betahum(:,end,2),1,mfn);
hummer=betarnd(betahummer1,betahummer2);
think=mean(hummer,2);
%% loss
perf(m,exp)=-sum((think-oribin).^2);
end
end
figure;imagesc(expos,mfns,perf);colorbar;
set(gca,'YDir','normal')
xlabel('exponent k');
ylabel('>>noise');
title('loss');
function [pf]=powerf(x,expo,gainc);
y=x-mean(x);
y=y./max(y);
y=sign(y).*abs(y.^expo);
if gainc
g=sum(abs(y))./sum(abs(x));
y=y./g;
end
pf=y;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment