File: descriptive_statistics.m

package info (click to toggle)
dynare 4.6.3-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 74,896 kB
  • sloc: cpp: 98,057; ansic: 28,929; pascal: 13,844; sh: 5,947; objc: 4,236; yacc: 4,215; makefile: 2,583; lex: 1,534; fortran: 877; python: 647; ruby: 291; lisp: 152; xml: 22
file content (87 lines) | stat: -rw-r--r-- 2,911 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
function dataset_ = descriptive_statistics(dataset_,statistic,varagin)
% Computes various descriptive statistics for the sample and stores them in the structure dataset_.

%@info:
%! @deftypefn {Function File} {@var{dataset_} =} descriptive_statistics(@var{dataset_},@var{statistic})
%! @deftypefn {Function File} {@var{dataset_} =} descriptive_statistics(@var{dataset_},@var{statistic},nlags)
%! @anchor{compute_corr}
%! This function computes various descriptive statistics on the sample (possibly with missing observations).
%!
%! @strong{Inputs}
%! @table @var
%! @item dataset_
%! Dynare structure describing the dataset, built by @ref{initialize_dataset}
%! @item statistic
%! String. The name of the statistic to be computed. Admissible values are:
%!   @table @var
%!   @item 'stdv'
%!   Computes the standard deviation of each observed variable.
%!   @item 'cova'
%!   Computes the covariance matrix of the sample.
%!   @item 'corr'
%!   Computes the correlation matrix of the sample.
%!   @item 'acov'
%!   Computes the (multivariate) auto-covariance function of the sample. In this case a third argument (@code{nlags}) defining the
%!   maximum number of lags is mandatory.
%!   @end table
%! @item nlags
%! Integer scalar. The maximum number of lags when computing the autocovariance function.
%! @end table
%!
%! @strong{Outputs}
%! @table @var
%! @item dataset_
%! Dynare structure describing the dataset, built by @ref{initialize_dataset}
%! @end table
%!
%! @strong{This function is called by:}
%! none.
%!
%! @strong{This function calls:}
%! @ref{compute_stdv}, @ref{compute_cova}, @ref{compute_corr}, @ref{compute_acov}.
%!
%! @strong{Remark 1.} On exit, a new field containing the computed statistics is appended to the structure.
%!
%! @end deftypefn
%@eod:

% Copyright (C) 2011-2017 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.

% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr


if strcmpi(statistic,'stdv')
    dataset_ = compute_std(dataset_)
end

if strcmpi(statistic,'cova')
    dataset_ = compute_cova(dataset_)
end

if strcmpi(statistic,'corr')
    dataset_ = compute_cova(dataset_)
end

if strcmpi(statistic,'acov')
    if nargin==2
        nlag = 10;
    else
        nlag = varargin{1};
    end
    dataset_ = compute_acov(dataset_,nlag);
end