Add integration tests for NLS estimation.
parent
8c8a2cf0fa
commit
24c817afa7
|
@ -82,6 +82,8 @@ MODFILES = \
|
|||
estimation/system_prior_restriction/Gali_2015.mod \
|
||||
estimation/no_init_estimation_check_first_obs/fs2000_init_check.mod \
|
||||
estimation/example_nls.mod \
|
||||
estimation/univariate/nls/staticmodel.mod \
|
||||
estimation/univariate/nls/dynamicmodel.mod \
|
||||
moments/example1_var_decomp.mod \
|
||||
moments/example1_bp_test.mod \
|
||||
moments/test_AR1_spectral_density.mod \
|
||||
|
@ -632,7 +634,8 @@ XFAIL_MODFILES = ramst_xfail.mod \
|
|||
estimation/tune_mh_jscale/fs2000_2_xfail.mod \
|
||||
estimation/no_init_estimation_check_first_obs/fs2000_init_check_XFAIL.mod \
|
||||
estimation/no_init_estimation_check_first_obs/fs2000_init_check_XFAIL2.mod \
|
||||
var-expectations/1-with-time-shift-b/example1.mod
|
||||
var-expectations/1-with-time-shift-b/example1.mod \
|
||||
estimation/univariate/nls/staticmodelx.mod
|
||||
|
||||
MFILES = histval_initval_file/ramst_initval_file_data.m
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
// --+ options: json=compute, stochastic +--
|
||||
|
||||
var y x z;
|
||||
|
||||
varexo ey ex ez;
|
||||
|
||||
parameters gamma rho;
|
||||
|
||||
gamma = .3;
|
||||
rho = .9;
|
||||
|
||||
model;
|
||||
|
||||
[name='eqx']
|
||||
x = x(-1)^.8*exp(ex) ;
|
||||
|
||||
[name='eqz']
|
||||
z = exp(ez);
|
||||
|
||||
[name='eqy']
|
||||
y = x^(1-gamma)*z^gamma*abs(y(-1))^rho + ey;
|
||||
|
||||
end;
|
||||
|
||||
histval;
|
||||
x(0) = 0.1;
|
||||
z(0) = 0.5;
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var ex = .05;
|
||||
var ez = .05;
|
||||
var ey = .01;
|
||||
end;
|
||||
|
||||
// Simulate a sample.
|
||||
simulations = simul_backward_model([], 5000);
|
||||
|
||||
// Set residuals in the estimated equation to NaNs.
|
||||
simulations.ey = dseries(NaN);
|
||||
|
||||
// Set initial guess for the estimated parameter.
|
||||
clear('eparams')
|
||||
eparams.gamma = 0.6;
|
||||
eparams.rho = 0.3;
|
||||
|
||||
// Call estimation routine.
|
||||
estimate.nls('eqy', eparams, simulations, 1001Y:5000Y, 'annealing')
|
|
@ -0,0 +1,46 @@
|
|||
// --+ options: json=compute, stochastic +--
|
||||
|
||||
var y x z;
|
||||
|
||||
varexo ey ex ez;
|
||||
|
||||
parameters theta gamma;
|
||||
|
||||
gamma = .3;
|
||||
|
||||
model;
|
||||
|
||||
[name='eqx']
|
||||
x = x(-1)^.8*exp(ex) ;
|
||||
|
||||
[name='eqz']
|
||||
z = exp(ez);
|
||||
|
||||
[name='eqy']
|
||||
y = x^(1-gamma)*z^gamma + ey;
|
||||
|
||||
end;
|
||||
|
||||
histval;
|
||||
x(0) = 0.1;
|
||||
z(0) = 0.5;
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var ex = .05;
|
||||
var ez = .05;
|
||||
var ey = .01;
|
||||
end;
|
||||
|
||||
// Simulate a sample.
|
||||
simulations = simul_backward_model([], 5000);
|
||||
|
||||
// Set residuals in the estimated equation to NaNs.
|
||||
simulations.ey = dseries(NaN);
|
||||
|
||||
// Set initial guess for the estimated parameter.
|
||||
clear('eparams')
|
||||
eparams.gamma = 0.6;
|
||||
|
||||
// Call estimation routine.
|
||||
estimate.nls('eqy', eparams, simulations, 1001Y:5000Y, 'annealing')
|
|
@ -0,0 +1,49 @@
|
|||
// --+ options: json=compute, stochastic +--
|
||||
|
||||
var y x z;
|
||||
|
||||
varexo ey ex ez;
|
||||
|
||||
parameters theta gamma;
|
||||
|
||||
gamma = .3;
|
||||
|
||||
model;
|
||||
|
||||
[name='eqx']
|
||||
x = x(-1)^.8*exp(ex) ;
|
||||
|
||||
[name='eqz']
|
||||
z = exp(ez);
|
||||
|
||||
[name='eqy']
|
||||
y = x^(1-gamma)*z^gamma + ey;
|
||||
|
||||
end;
|
||||
|
||||
histval;
|
||||
x(0) = 0.1;
|
||||
z(0) = 0.5;
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var ex = .05;
|
||||
var ez = .05;
|
||||
var ey = .01;
|
||||
end;
|
||||
|
||||
// Simulate a sample.
|
||||
simulations = simul_backward_model([], 5000);
|
||||
|
||||
// Set residuals in the estimated equation to NaNs.
|
||||
simulations.ey = dseries(NaN);
|
||||
|
||||
// Add a missing NaN in the database, this should trigger an error in estimate.nls.
|
||||
simulations.z(1002Y) = NaN;
|
||||
|
||||
// Set initial guess for the estimated parameter.
|
||||
clear('eparams')
|
||||
eparams.gamma = 0.6;
|
||||
|
||||
// Call estimation routine.
|
||||
estimate.nls('eqy', eparams, simulations, 1001Y:5000Y, 'annealing')
|
Loading…
Reference in New Issue