Home > matlab > osr_obj.m

osr_obj

PURPOSE ^

objective function for optimal simple rules (OSR)

SYNOPSIS ^

function [loss,vx,junk,exit_flag]=osr_obj(x,i_params,i_var,weights);

DESCRIPTION ^

 objective function for optimal simple rules (OSR)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [loss,vx,junk,exit_flag]=osr_obj(x,i_params,i_var,weights);
0002 % objective function for optimal simple rules (OSR)
0003 
0004 % Copyright (C) 2005-2009 Dynare Team
0005 %
0006 % This file is part of Dynare.
0007 %
0008 % Dynare is free software: you can redistribute it and/or modify
0009 % it under the terms of the GNU General Public License as published by
0010 % the Free Software Foundation, either version 3 of the License, or
0011 % (at your option) any later version.
0012 %
0013 % Dynare is distributed in the hope that it will be useful,
0014 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0015 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016 % GNU General Public License for more details.
0017 %
0018 % You should have received a copy of the GNU General Public License
0019 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0020 
0021 global M_ oo_ options_ optimal_Q_ it_
0022 %  global ys_ Sigma_e_ endo_nbr exo_nbr optimal_Q_ it_ ykmin_ options_
0023 
0024 junk = [];
0025 exit_flag = 1;
0026 vx = [];
0027 % set parameters of the policiy rule
0028 M_.params(i_params) = x;
0029 
0030 % don't change below until the part where the loss function is computed
0031 it_ = M_.maximum_lag+1;
0032 [dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
0033 
0034 switch info(1)
0035   case 1
0036     loss = 1e8;
0037     return
0038   case 2
0039     loss = 1e8*min(1e3,info(2));
0040     return
0041   case 3
0042     loss = 1e8*min(1e3,info(2));
0043     return
0044   case 4
0045     loss = 1e8*min(1e3,info(2));
0046     return
0047   case 5
0048     loss = 1e8;
0049     return
0050   case 6
0051     loss = 1e8*min(1e3,info(2));
0052     return
0053   case 20
0054     loss = 1e8*min(1e3,info(2));
0055     return
0056   otherwise
0057 end
0058 
0059 vx = get_variance_of_endogenous_variables(dr,i_var);
0060 loss = weights(:)'*vx(:);
0061 
0062 
0063 
0064 
0065 
0066 
0067 
0068 
0069 
0070 
0071 
0072 
0073 
0074 
0075

Generated on Tue 22-May-2012 02:40:23 by m2html © 2005