wagadap_extract_predicted_wager.m 1.99 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
function [predicted_wager] = wagadap_extract_predicted_wager(est)

% Extract trajectories of interest from infStates
mu1hat_a = est.traj.muhat_a(:,1);
mu1hat_r = est.traj.muhat_r(:,1);
mu2hat_a = est.traj.muhat_a(:,2);
mu2hat_r = est.traj.muhat_r(:,2);
sa2hat_r = est.traj.sahat_r(:,2);
sa2hat_a = est.traj.sahat_a(:,2);
mu3hat_r = est.traj.muhat_r(:,3);
mu3hat_a = est.traj.muhat_a(:,3);
ze       = est.p_obs.ze;
dandreea's avatar
dandreea committed
13
advice_card_space = est.u(:,3);
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
% Transform the card colour
transformed_mu1hat_r = mu1hat_r.^advice_card_space.*(1-mu1hat_r).^(1-advice_card_space);

%% Belief Vector
% Precision 1st level (i.e., Fisher information) vectors
px = 1./(mu1hat_a.*(1-mu1hat_a));
pc = 1./(mu1hat_r.*(1-mu1hat_r));

% Weight vectors 1st level
wx = ze.*px./(ze.*px + pc); % precision first level
wc = pc./(ze.*px + pc);

% Belief and Choice Noise
b              = wx.*mu1hat_a + wc.*transformed_mu1hat_r;

% Surprise
% ~~~~~~~~
surp = -log2(b);

% Arbitration
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arbitration = wx;

% Inferential variance (aka informational or estimation uncertainty, ambiguity)
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
inferv_a = tapas_sgm(mu2hat_a, 1).*(1 -tapas_sgm(mu2hat_a, 1)).*sa2hat_a; % transform down to 1st level
inferv_r = tapas_sgm(mu2hat_r, 1).*(1 -tapas_sgm(mu2hat_r, 1)).*sa2hat_r; % transform down to 1st level

% Phasic volatility (aka environmental or unexpected uncertainty)
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pv_a = tapas_sgm(mu2hat_a, 1).*(1-tapas_sgm(mu2hat_a, 1)).*exp(mu3hat_a); % transform down to 1st level
pv_r = tapas_sgm(mu2hat_r, 1).*(1-tapas_sgm(mu2hat_r, 1)).*exp(mu3hat_r); % transform down to 1st level

logrt = est.p_obs.be0 + est.p_obs.be1.*surp + est.p_obs.be2.*arbitration + ...
    est.p_obs.be3.*inferv_a + est.p_obs.be4.*inferv_r + est.p_obs.be5.*pv_a + ...
    est.p_obs.be6.*pv_r;
predicted_wager = tapas_sgm(logrt,1).*10-ones(size(logrt)); % wager from 1 to 10

end