time-shift
Johannes Pfeifer 2013-06-26 17:41:58 +02:00
commit e595ec7ac6
18 changed files with 588 additions and 35 deletions

View File

@ -4261,7 +4261,7 @@ the data. Default: @code{0}, @i{i.e.} no prefiltering
@item presample = @var{INTEGER}
@anchor{presample}
The number of observations to be skipped before evaluating the
likelihood. Default: @code{0}
likelihood. These first observations are used as a training sample. Default: @code{0}
@item loglinear
@anchor{loglinear}
@ -5521,12 +5521,22 @@ The parameters to be optimized must be listed with @code{osr_params}.
The quadratic objectives must be listed with @code{optim_weights}.
This problem is solved using a numerical optimizer.
This problem is solved using the numerical optimizer @code{csminwel} of Chris Sims.
@optionshead
This command accept the same options than @code{stoch_simul}
(@pxref{Computing the stochastic solution}).
This command accepts the same options as @code{stoch_simul}
(@pxref{Computing the stochastic solution}) plus
@table @code
@item maxit = @var{INTEGER}
Determines the maximum number of iterations used in the non-linear solver. Default: @code{1000}
@item tolf = @var{DOUBLE}
Convergence criterion for termination based on the function value. Iteration will
cease when it proves impossible to improve the function value by more than tolf. Default: @code{1e-7}
@end table
The value of the objective is stored in the variable
@code{oo_.osr.objective_function}, which is described below.
@ -6406,6 +6416,68 @@ Specifies a Markov chain defined by @ref{markov_switching}. Default:
@end deffn
@deffn Command sbvar (@var{OPTIONS}@dots{});
@descriptionhead
To be documented. For now, see the wiki: @uref{http://www.dynare.org/DynareWiki/SbvarOptions}
@optionshead
@table @code
@item datafile
@item freq
@item initial_year
@item initial_subperiod
@item final_year
@item final_subperiod
@item data
@item vlist
@item vlistlog
@item vlistper
@item restriction_fname
@item nlags
@item cross_restrictions
@item contemp_reduced_form
@item real_pseudo_forecast
@item no_bayesian_prior
@item dummy_obs
@item nstates
@item indxscalesstates
@item alpha
@item beta
@item gsig2_lmdm
@item q_diag
@item flat_prior
@item ncsk
@item nstd
@item ninv
@item indxparr
@item indxovr
@item aband
@item indxap
@item apband
@item indximf
@item indxfore
@item foreband
@item indxgforhat
@item indxgimfhat
@item indxestima
@item indxgdls
@item eq_ms
@item cms
@item ncms
@item eq_cms
@item tlindx
@item tlnumber
@item cnum
@item forecast
@item coefficients_prior_hyperparameters
@end table
@end deffn
@anchor{ms_estimation}
@deffn Command ms_estimation (@var{OPTIONS}@dots{});
@descriptionhead

View File

@ -176,14 +176,14 @@ if strncmp(computer, 'GLNX', 4) || ~isempty(regexpi(computer, '.*linux.*', 'once
addpath('/usr/share/matlab2tikz');
end
elseif strncmp(computer, 'MACI', 4) || ~isempty(regexpi(computer, '.*apple.*', 'once'))
if exist([dynareroot '/contrib/matlab2tikz/matlab2tikz.m']) == 2
addpath([dynareroot '/contrib/matlab2tikz']);
if exist([dynareroot '../contrib/matlab2tikz/matlab2tikz.m']) == 2
addpath([dynareroot '../contrib/matlab2tikz']);
elseif exist('/usr/local/share/matlab2tikz/matlab2tikz.m') == 2
addpath('/usr/local/share/matlab2tikz');
end
else
if exist([dynareroot '/contrib/matlab2tikz/matlab2tikz.m']) == 2
addpath([dynareroot '/contrib/matlab2tikz']);
if exist([dynareroot '../contrib/matlab2tikz/matlab2tikz.m']) == 2
addpath([dynareroot '../contrib/matlab2tikz']);
end
end

View File

@ -565,6 +565,11 @@ options_.risky_steadystate = 0;
options_.endogenous_prior = 0;
options_.endogenous_prior_restrictions.irf={};
% OSR Optimal Simple Rules
options_.osr.tolf=1e-7;
options_.osr.maxit=1000;
options_.osr.verbose=2;
% use GPU
options_.gpu = 0;

View File

@ -296,7 +296,7 @@ ReducedForm.StateVectorVariance = StateVectorVariance;
%------------------------------------------------------------------------------
DynareOptions.warning_for_steadystate = 0;
[s1,s2] = get_dynare_random_generator_state();
LIK = feval(DynareOptions.particle.algorithm,ReducedForm,Y,[],DynareOptions);
LIK = feval(DynareOptions.particle.algorithm,ReducedForm,Y,start,DynareOptions);
set_dynare_random_generator_state(s1,s2);
if imag(LIK)
likelihood = objective_function_penalty_base;

View File

@ -48,9 +48,9 @@ t0 = M_.params(i_params);
inv_order_var = oo_.dr.inv_order_var;
H0 = 1e-4*eye(np);
crit = 1e-7;
nit = 1000;
verbose = 2;
crit=options_.osr.tolf;
nit=options_.osr.maxit;
verbose=options_.osr.verbose;
[f,p]=csminwel1('osr_obj',t0,H0,[],crit,nit,options_.gradient_method,options_.gradient_epsilon,i_params,...
inv_order_var(i_var),weights(i_var,i_var));

View File

@ -108,7 +108,7 @@ class ParsingDriver;
%token <string_val> INT_NUMBER
%token <string_val> DATE_NUMBER
%token INV_GAMMA_PDF INV_GAMMA1_PDF INV_GAMMA2_PDF IRF IRF_SHOCKS
%token KALMAN_ALGO KALMAN_TOL SUBSAMPLES OPTIONS
%token KALMAN_ALGO KALMAN_TOL SUBSAMPLES OPTIONS TOLF
%token LABELS LAPLACE LIK_ALGO LIK_INIT LINEAR LOAD_IDENT_FILES LOAD_MH_FILE LOAD_PARAMS_AND_STEADY_STATE LOGLINEAR LYAPUNOV
%token LYAPUNOV_FIXED_POINT_TOL LYAPUNOV_DOUBLING_TOL LYAPUNOV_SQUARE_ROOT_SOLVER_TOL LOG_DEFLATOR LOG_TREND_VAR LOG_GROWTH_FACTOR MARKOWITZ MARGINAL_DENSITY MAX MAXIT
%token MFS MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER MIN MINIMAL_SOLVING_PERIODS SOLVE_MAXIT
@ -1616,13 +1616,23 @@ optim_weights_list : optim_weights_list symbol expression ';'
osr_params : OSR_PARAMS symbol_list ';' { driver.set_osr_params(); };
osr_options_list : osr_options_list COMMA osr_options
| osr_options
;
osr_options : stoch_simul_options
| o_osr_maxit
| o_osr_tolf
;
osr : OSR ';'
{ driver.run_osr(); }
| OSR '(' stoch_simul_options_list ')' ';'
| OSR '(' osr_options_list ')' ';'
{ driver.run_osr(); }
| OSR symbol_list ';'
{ driver.run_osr(); }
| OSR '(' stoch_simul_options_list ')' symbol_list ';'
| OSR '(' osr_options_list ')' symbol_list ';'
{driver.run_osr(); }
;
@ -2273,6 +2283,8 @@ o_solver_periods : SOLVER_PERIODS EQUAL INT_NUMBER { driver.option_num("ep.perio
o_extended_path_order : ORDER EQUAL INT_NUMBER { driver.option_num("ep.stochastic.order", $3); };
o_hybrid : HYBRID { driver.option_num("ep.stochastic.hybrid_order", "2"); };
o_maxit : MAXIT EQUAL INT_NUMBER { driver.option_num("maxit_", $3); };
o_osr_maxit : MAXIT EQUAL INT_NUMBER { driver.option_num("osr.maxit", $3); };
o_osr_tolf : TOLF EQUAL non_negative_number { driver.option_num("osr.tolf", $3); };
o_solve_maxit : SOLVE_MAXIT EQUAL INT_NUMBER { driver.option_num("solve_maxit", $3); };
o_cutoff : CUTOFF EQUAL non_negative_number { driver.cutoff($3); };
o_markowitz : MARKOWITZ EQUAL non_negative_number { driver.option_num("markowitz", $3); };

View File

@ -432,7 +432,7 @@ string eofbuff;
<DYNARE_STATEMENT>max_number_of_stages {return token::MAX_NUMBER_OF_STAGES;}
<DYNARE_STATEMENT>random_function_convergence_criterion {return token::RANDOM_FUNCTION_CONVERGENCE_CRITERION;}
<DYNARE_STATEMENT>random_parameter_convergence_criterion {return token::RANDOM_PARAMETER_CONVERGENCE_CRITERION;}
<DYNARE_STATEMENT>tolf {return token::TOLF;}
<DYNARE_STATEMENT>instruments {return token::INSTRUMENTS;}
/* These four (var, varexo, varexo_det, parameters) are for change_type */

View File

@ -240,16 +240,16 @@ EXTRA_DIST = \
run_block_byte_tests_octave.m \
run_reporting_test_matlab.m \
run_reporting_test_octave.m \
AnnualTable.m \
CommResidTablePage.m \
CountryGraphPage.m \
CountryTablePage.m \
ResidTablePage.m \
db_a.mat \
db_q.mat \
dc_a.mat \
dc_q.mat \
runDynareReport.m \
reporting/AnnualTable.m \
reporting/CommResidTablePage.m \
reporting/CountryGraphPage.m \
reporting/CountryTablePage.m \
reporting/ResidTablePage.m \
reporting/db_a.csv \
reporting/db_q.csv \
reporting/dc_a.csv \
reporting/dc_q.csv \
reporting/runDynareReport.m \
homotopy/common.mod \
block_bytecode/ls2003.mod \
fs2000_ssfile_aux.m \
@ -396,7 +396,7 @@ clean-local:
rm -rf block_bytecode/ls2003_tmp*
rm reporting/report.*
rm -f reporting/report.*
rm -f $(shell find -name wsOct) \
$(shell find -name wsMat.mat)

47
tests/reporting/db_a.csv Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

185
tests/reporting/db_q.csv Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

47
tests/reporting/dc_a.csv Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

185
tests/reporting/dc_q.csv Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -34,10 +34,10 @@ disp('');
disp(['*** TESTING: run_reporting_test_matlab.m ***']);
try
cd([top_test_dir filesep 'reporting']);
load db_a.mat;
load db_q.mat;
load dc_a.mat;
load dc_q.mat;
db_a = dynSeries('db_a.csv');
db_q = dynSeries('db_q.csv');
dc_a = dynSeries('dc_a.csv');
dc_q = dynSeries('dc_q.csv');
runDynareReport(dc_a, dc_q, db_a, db_q);
testFailed = false;
catch

View File

@ -38,10 +38,10 @@ end
printf("\n*** TESTING: run_reporting_test_octave.m ***\n");
try
cd([top_test_dir filesep 'reporting']);
load db_a.mat;
load db_q.mat;
load dc_a.mat;
load dc_q.mat;
db_a = dynSeries('db_a.csv');
db_q = dynSeries('db_q.csv');
dc_a = dynSeries('dc_a.csv');
dc_q = dynSeries('dc_q.csv');
runDynareReport(dc_a, dc_q, db_a, db_q);
testFailed = false;
catch