Debian Codegraph @

tests/ecb/SURGibbs/fulton_fish.mod

raw
1 // --+ options: json=compute +--
2 % Example from Section 6.1 of
3 % Ando, Tomohiro and Zellner, Arnold. 2010. Hierarchical Bayesian Analysis of the
4 % Seemingly Unrelated Regression and Simultaneous Equations Models Using a
5 % Combination of Direct Monte Carlo and Importance Sampling Techniques.
6 % Bayesian Analysis Volume 5, Number 1, pp. 65-96.
7
8 var qty, price;
9 varexo res_u, res_v, stormy, mixed;
10 parameters bq0, bp0, bq1, bp1, bp2;
11
12 bp0 = 8.5527;
13 bp1 = -0.5302;
14 bp2 = -0.3974;
15
16 bq0 = 6.7523;
17 bq1 = -0.7969;
18
19 model(linear);
20 qty = bq0 + bq1*price + res_u;
21 price = bp0 + bp1*stormy + bp2*mixed + res_v;
22 end;
23
24 % Estimate all parameters
25 %estparams = M_.param_names;
26 %estparamsval = M_.params;
27
28 % Estimate demand parameters
29 estparams = {'bq1' 'bq0'};
30 estparamsval = [bq1 bq0];
31
32 A = 0.0005.*eye(length(estparams));
33 simdata = surgibbs(dseries('fishdata.csv'), estparams, estparamsval, A, 20000, 5000, 7);
34
35 good = [6.791587808530124
36 8.552700000000000
37 -0.478275288902356
38 -0.530200000000000
39 -0.397400000000000];
40
41 if isoctave
42 tolerance = 1e-2;
43 else
44 tolerance = 1e-13;
45 end
46
47 if sum(abs(M_.params-good)) > tolerance
48 error(['sum of M_.params - good was: ' num2str(sum(abs(M_.params-good)))]);
49 end