Merge pull request #632 from JohannesPfeifer/osr_doc

Cosmetic changes to documentation of osr
time-shift
Sébastien Villemot 2014-03-11 15:54:44 +01:00
commit 8b90ca5d07
4 changed files with 44 additions and 14 deletions

View File

@ -6086,9 +6086,11 @@ The quadratic objectives must be listed with @code{optim_weights}.
This problem is solved using the numerical optimizer @code{csminwel} of Chris Sims.
@optionshead
This command accepts the same options as @code{stoch_simul}
The @code{osr} command will subsequently run @code{stoch_simul}
and accepts the same options, including restricting the endogenous variables by listing them after the command, as @code{stoch_simul}
(@pxref{Computing the stochastic solution}) plus
@table @code

View File

@ -1,5 +1,26 @@
function osr_res = osr(var_list,params,i_var,W)
% osr_res = osr(var_list,params,i_var,W)
% Wrapper function computing the solution to the optimal simple
% rule-problem; calls osr1 for actual computation
% INPUTS
% var_list [character array] list of endogenous variables specified
% after osr1-command (deprecated and not used anymore)
% params [character array] list of parameter to be chosen in
% optimal simple rule
% i_var [n_osr_vars by 1 double] indices of osr-variable in
% specified in optim_weights in declaration order
% W [M_.endo_nbr by M_.endo_nbr sparse matrix] Weighting matrix for variance of endogenous variables
%
% OUTPUTS
% osr_res: [structure] results structure containing:
% - objective_function [scalar double] value of the objective
% function at the optimum
% - optim_params [structure] parameter values at the optimum
%
%
% SPECIAL REQUIREMENTS
% none.
%
% Copyright (C) 2001-2012 Dynare Team
%
% This file is part of Dynare.

View File

@ -2,10 +2,21 @@ function osr_res = osr1(i_params,i_var,weights)
% Compute the Optimal Simple Rules
% INPUTS
% i_params vector index of optimizing parameters in M_.params
% i_var vector variables indices
% i_var vector variables indices in declaration order
% weights vector weights in the OSRs
%
% Copyright (C) 2005-2013 Dynare Team
% OUTPUTS
% osr_res: [structure] results structure containing:
% - objective_function [scalar double] value of the objective
% function at the optimum
% - optim_params [structure] parameter values at the optimum
%
% Algorithm:
%
% Uses Newton-type optimizer csminwel to directly solve quadratic
% osr-problem
%
% Copyright (C) 2005-2014 Dynare Team
%
% This file is part of Dynare.
%
@ -78,8 +89,6 @@ end
% [p,f]=fminunc(@osr_obj,t0,options,i_params,...
% inv_order_var(i_var),weights(i_var,i_var));
skipline()
disp('OPTIMAL VALUE OF THE PARAMETERS:')
skipline()
@ -88,6 +97,4 @@ for i=1:np
end
disp(sprintf('Objective function : %16.6g\n',f));
skipline()
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
% 05/10/03 MJ modified to work with osr.m and give full report
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);

View File

@ -78,11 +78,11 @@ switch info(1)
case 20
loss = 1e8*min(1e3,info(2));
return
otherwise
if info(1)~=0
loss = 1e8;
return;
end
otherwise
if info(1)~=0
loss = 1e8;
return;
end
end
vx = get_variance_of_endogenous_variables(dr,i_var);