Home > matlab > gsa > read_data.m

read_data

PURPOSE ^

Written by Marco Ratto

SYNOPSIS ^

function [gend, data] = read_data

DESCRIPTION ^

 Written by Marco Ratto
 Joint Research Centre, The European Commission,
 (http://eemc.jrc.ec.europa.eu/),
 marco.ratto@jrc.it 

 Reference:
 M. Ratto, Global Sensitivity Analysis for Macroeconomic models, MIMEO, 2006.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [gend, data] = read_data
0002 % Written by Marco Ratto
0003 % Joint Research Centre, The European Commission,
0004 % (http://eemc.jrc.ec.europa.eu/),
0005 % marco.ratto@jrc.it
0006 %
0007 % Reference:
0008 % M. Ratto, Global Sensitivity Analysis for Macroeconomic models, MIMEO, 2006.
0009 
0010 % Copyright (C) 2012 Dynare Team
0011 %
0012 % This file is part of Dynare.
0013 %
0014 % Dynare is free software: you can redistribute it and/or modify
0015 % it under the terms of the GNU General Public License as published by
0016 % the Free Software Foundation, either version 3 of the License, or
0017 % (at your option) any later version.
0018 %
0019 % Dynare is distributed in the hope that it will be useful,
0020 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0021 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0022 % GNU General Public License for more details.
0023 %
0024 % You should have received a copy of the GNU General Public License
0025 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0026 
0027 global options_ bayestopt_
0028 
0029 rawdata = read_variables(options_.datafile,options_.varobs,[],options_.xls_sheet,options_.xls_range);
0030 
0031 options_ = set_default_option(options_,'nobs',size(rawdata,1)-options_.first_obs+1);
0032 gend = options_.nobs;
0033 
0034 rawdata = rawdata(options_.first_obs:options_.first_obs+gend-1,:);
0035 if options_.loglinear == 1 & ~options_.logdata
0036   rawdata = log(rawdata);
0037 end
0038 if options_.prefilter == 1
0039   bayestopt_.mean_varobs = mean(rawdata,1);
0040   data = transpose(rawdata-ones(gend,1)*bayestopt_.mean_varobs);
0041 else
0042   data = transpose(rawdata);
0043 end
0044 
0045 if ~isreal(rawdata)
0046   error(['There are complex values in the data. Probably  a wrong' ...
0047      ' transformation'])
0048 end

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005