Cosmetic changes to documentation of osr
parent
9d32204790
commit
23f0322236
23
matlab/osr.m
23
matlab/osr.m
|
@ -1,5 +1,26 @@
|
||||||
function osr_res = osr(var_list,params,i_var,W)
|
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
|
% Copyright (C) 2001-2012 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
|
|
|
@ -2,10 +2,21 @@ function osr_res = osr1(i_params,i_var,weights)
|
||||||
% Compute the Optimal Simple Rules
|
% Compute the Optimal Simple Rules
|
||||||
% INPUTS
|
% INPUTS
|
||||||
% i_params vector index of optimizing parameters in M_.params
|
% 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
|
% 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.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -78,8 +89,6 @@ end
|
||||||
% [p,f]=fminunc(@osr_obj,t0,options,i_params,...
|
% [p,f]=fminunc(@osr_obj,t0,options,i_params,...
|
||||||
% inv_order_var(i_var),weights(i_var,i_var));
|
% inv_order_var(i_var),weights(i_var,i_var));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
skipline()
|
skipline()
|
||||||
disp('OPTIMAL VALUE OF THE PARAMETERS:')
|
disp('OPTIMAL VALUE OF THE PARAMETERS:')
|
||||||
skipline()
|
skipline()
|
||||||
|
@ -88,6 +97,4 @@ for i=1:np
|
||||||
end
|
end
|
||||||
disp(sprintf('Objective function : %16.6g\n',f));
|
disp(sprintf('Objective function : %16.6g\n',f));
|
||||||
skipline()
|
skipline()
|
||||||
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
|
[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
|
|
|
@ -78,11 +78,11 @@ switch info(1)
|
||||||
case 20
|
case 20
|
||||||
loss = 1e8*min(1e3,info(2));
|
loss = 1e8*min(1e3,info(2));
|
||||||
return
|
return
|
||||||
otherwise
|
otherwise
|
||||||
if info(1)~=0
|
if info(1)~=0
|
||||||
loss = 1e8;
|
loss = 1e8;
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vx = get_variance_of_endogenous_variables(dr,i_var);
|
vx = get_variance_of_endogenous_variables(dr,i_var);
|
||||||
|
|
Loading…
Reference in New Issue