Home > matlab > utilities > dataset > descriptive_statistics.m

descriptive_statistics

PURPOSE ^

Computes various descriptive statistics for the sample and stores them in the structure dataset_.

SYNOPSIS ^

function dataset_ = descriptive_statistics(dataset_,statistic,varagin)

DESCRIPTION ^

 Computes various descriptive statistics for the sample and stores them in the structure dataset_.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dataset_ = descriptive_statistics(dataset_,statistic,varagin)
0002 % Computes various descriptive statistics for the sample and stores them in the structure dataset_.
0003 
0004 %@info:
0005 %! @deftypefn {Function File} {@var{dataset_} =} descriptive_statistics(@var{dataset_},@var{statistic})
0006 %! @deftypefn {Function File} {@var{dataset_} =} descriptive_statistics(@var{dataset_},@var{statistic},nlags)
0007 %! @anchor{compute_corr}
0008 %! This function computes various descriptive statistics on the sample (possibly with missing observations).
0009 %!
0010 %! @strong{Inputs}
0011 %! @table @var
0012 %! @item dataset_
0013 %! Dynare structure describing the dataset, built by @ref{initialize_dataset}
0014 %! @item statistic
0015 %! String. The name of the statistic to be computed. Admissible values are:
0016 %!   @table @var
0017 %!   @item 'stdv'
0018 %!   Computes the standard deviation of each observed variable.
0019 %!   @item 'cova'
0020 %!   Computes the covariance matrix of the sample.
0021 %!   @item 'corr'
0022 %!   Computes the correlation matrix of the sample.
0023 %!   @item 'acov'
0024 %!   Computes the (multivariate) auto-covariance function of the sample. In this case a third argument (@code{nlags}) defining the
0025 %!   maximum number of lags is mandatory.
0026 %!   @end table
0027 %! @item nlags
0028 %! Integer scalar. The maximum number of lags when computing the autocovariance function.
0029 %! @end table
0030 %!
0031 %! @strong{Outputs}
0032 %! @table @var
0033 %! @item dataset_
0034 %! Dynare structure describing the dataset, built by @ref{initialize_dataset}
0035 %! @end table
0036 %!
0037 %! @strong{This function is called by:}
0038 %! none.
0039 %!
0040 %! @strong{This function calls:}
0041 %! @ref{compute_stdv}, @ref{compute_cova}, @ref{compute_corr}, @ref{compute_acov}.
0042 %!
0043 %! @strong{Remark 1.} On exit, a new field containing the computed statistics is appended to the structure.
0044 %!
0045 %! @end deftypefn
0046 %@eod:
0047 
0048 % Copyright (C) 2011 Dynare Team
0049 % stephane DOT adjemian AT univ DASH lemans DOT fr
0050 %
0051 % This file is part of Dynare.
0052 %
0053 % Dynare is free software: you can redistribute it and/or modify
0054 % it under the terms of the GNU General Public License as published by
0055 % the Free Software Foundation, either version 3 of the License, or
0056 % (at your option) any later version.
0057 %
0058 % Dynare is distributed in the hope that it will be useful,
0059 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0060 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0061 % GNU General Public License for more details.
0062 %
0063 % You should have received a copy of the GNU General Public License
0064 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0065 
0066 
0067 if strcmpi(statistic,'stdv')
0068     dataset_ = compute_std(dataset_)
0069 end
0070 
0071 if strcmpi(statistic,'cova')
0072     dataset_ = compute_cova(dataset_)
0073 end
0074 
0075 if strcmpi(statistic,'corr')
0076     dataset_ = compute_cova(dataset_)
0077 end
0078 
0079 if strcmpi(statistic,'acov')
0080     if nargin==2
0081         nlag = 10;
0082     else
0083         nlag = varargin{1};
0084     end
0085     dataset_ = compute_acov(dataset_,nlag);
0086 end

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