Debian Codegraph @

tests/estimation/univariate/nls/staticmodelx.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 // Add a missing NaN in the database, this should trigger an error in estimate.nls.
42 simulations.z(1002Y) = NaN;
43
44 // Set initial guess for the estimated parameter.
45 clear('eparams')
46 eparams.gamma = 0.6;
47
48 // Call estimation routine.
49 estimate.nls('eqy', eparams, simulations, 1001Y:5000Y, 'annealing')