forked from translationalneuromodeling/tapas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtapas_h2gf_model.m
50 lines (41 loc) · 1.24 KB
/
tapas_h2gf_model.m
1
2
3
4
5
6
7
8
9
10
11
12
13
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
function [model] = tapas_h2gf_model(data, hgf, pars)
%% Get the model from the hgf.
%
% Input
% hgf -- Hgf model.
% pars -- pars structure.
% Output
% model -- Model structre.
%
% copyright (C) 2016
%
%% Define the model.
%
% copyright (C) 2016
%
model = struct('graph', []);
model.graph = cell(4, 1);
for i = 1:4
model.graph{i} = struct('llh', [], 'htheta', []);
end
% Likelihood (individual level)
model.graph{1}.llh = @tapas_h2gf_llh;
% Parameters (individual level)
model.graph{2}.llh = @tapas_dlinear_hier_llh;
% Parameters (population level)
model.graph{3}.llh = @tapas_dlinear_llh;
% Placeholder for hyperparameters (fixed)
model.graph{4}.llh = [];
% Needed for efficient parallel tempering
model.graph{2}.llh_sn = @tapas_dlinear_hier_llh_sn;
% For
model.graph{1}.htheta = struct('T', pars.T, 'hgf', hgf);
model.graph{2}.htheta = struct('T', ones(size(pars.T, 2)));
model.graph{3}.htheta = struct('T', ones(size(pars.T, 2)));
% The last level is a dummy used to store the hyperpriors.
% y: variable the likelihood is defined on, llh = p(y|y_above, u)
% u: parameters of likelihood for y (fixed)
model.graph{4}.htheta = struct('y', [], 'u', []);
end