Debian Codegraph @

tests/estimation/univariate/nls/staticmodel.mod

raw
1 // --+ options: json=compute, stochastic +--
2
3 var y x z;
4
5 varexo ey ex ez;
6
7 parameters theta gamma;
8
9 gamma = .3;
10
11 model;
12
13 [name='eqx']
14 x = x(-1)^.8*exp(ex) ;
15
16 [name='eqz']
17 z = exp(ez);
18
19 [name='eqy']
20 y = x^(1-gamma)*z^gamma + ey;
21
22 end;
23
24 histval;
25 x(0) = 0.1;
26 z(0) = 0.5;
27 end;
28
29 shocks;
30 var ex = .05;
31 var ez = .05;
32 var ey = .01;
33 end;
34
35 // Simulate a sample.
36 simulations = simul_backward_model([], 5000);
37
38 // Set residuals in the estimated equation to NaNs.
39 simulations.ey = dseries(NaN);
40
41 // Set initial guess for the estimated parameter.
42 clear('eparams')
43 eparams.gamma = 0.6;
44
45 // Call estimation routine.
46 if ~isoctave
47 % Under Octave, estimate.nls (provided by matlab/+estimate/nls.m) is not
48 % accessible because there is a function which has the same name as the
49 % +estimate package, namely matlab/cli/estimate.m. This is a known Octave
50 % bug (https://savannah.gnu.org/bugs/?func=detailitem&item_id=46889).
51 estimate.nls('eqy', eparams, simulations, 1001Y:5000Y, 'annealing')
52 end