在MATLAB中模拟多元GARCH数据

时间:2019-05-22 12:00:34

标签: matlab statistics regression

我正在尝试使用Kevin Shepperd的工具箱在MATLAB中模拟多元GARCH数据。

他提供的代码文档非常简短,所以我想知道是否有人对此有所了解。

这里是文档。

function [data, Ht] = bekk_simulate(T,k,parameters,p,o,q,type)
% Simulation of symmetric and asymmetric BEKK(p,o,q) multivariate volatility models
%
% USAGE:
%  [DATA,HT] = bekk_simulate(T,K,PARAMETERS,P,O,Q,TYPE)
%
% INPUTS:
%   T          - Either a scalar containing the length of the series to simulate, or a T by K matrix 
%                  of simulated random variables.  The default is to use standard normals.  Providing 
%                  a T by K matrix allows other distributions to be used.
%   PARAMETERS - Vector of parameters.  The form of the parameters depends on the TYPE.  
%                  'Scalar':
%                  [CC' a(1) ... a(p) g(1) ... g(o) b(1) ... b(q)]'  (all scalars)
%                  'Diagonal' 
%                  [CC' diag(A(:,:,1))' ... diag(A(:,:,p))' diag(G(:,:,1))' ... diag(G(:,:,o))' diag(B(:,:,1))' ... diag(B(:,:,p))']'
%                  'Full' 
%                  [CC' f(A(:,:,1)) ... f(A(:,:,p)) f(G(:,:,1)) ... f(G(:,:,o)) f(B(:,:,1)) ... f(B(:,:,q))]'
%                  where CC = chol2vec(C')' and f(M) = M(:)'
%   P          - Positive, scalar integer representing the number of symmetric innovations
%   O          - Non-negative, scalar integer representing the number of asymmetric innovations
%   Q          - Non-negative, scalar integer representing the number of conditional covariance lags
%   TYPE       - String, one of :
%                  'Scalar' (Default) 
%                  'Diagonal'
%                  'Full'
%
% OUTPUTS:
%   DATA   - A T by K matrix of simulated data
%   HT     - A [K K T] dimension matrix of conditional covariances
%
% COMMENTS:
%   The dynamics of a BEKK are given by 
%   
%   H(:,:,t) = C*C' +
%       A(:,:,1)'*OP(:,:,t-1)*A(:,:,1) + ... + A(:,:,p)'*OP(:,:,t-1)*A(:,:,p) +
%       G(:,:,1)'*OPA(:,:,t-1)*G(:,:,1) + ... + G(:,:,o)'*OPA(:,:,t-1)*G(:,:,o) +
%       B(:,:,1)'*G(:,:,t-1)*B(:,:,1) + ... + B(:,:,q)'*OP(:,:,t-1)*B(:,:,q)
%
%   where in the scalar model A(:,:,i) = a(i)*eye(K) (similarly for G and B).
%
%  EXAMPLES:
%    % Scalar with A.^2=.05, G.^2=.1 and B.^2=.88
%    CCp = [1 .5;.5 4];
%    parameters = [chol2vec(chol(CCp)');sqrt([.05,.10,.88])']
%    [data,Ht] = bekk_simulate(1000,2,parameters,1,1,1,'Scalar')
%    % Diagonal 
%    parameters = [chol2vec(chol(CCp)');sqrt([.05 .07 .93 .88])']
%    [data,Ht] = bekk_simulate(1000,2,parameters,1,0,1,'Diagonal')
%
% See also BEKK

可以说我估计了一个GARCH模型,我已经在RATS中完成了这个工作,并且我想根据该规范生成一些数据,我该如何使用上面的函数来做到这一点:

5.  C(1,1)                        0.997031034  0.508107063      1.96225  0.04973386
6.  C(2,1)                        1.733801614  0.123673427     14.01919  0.00000000
7.  C(2,2)                       -1.176292837  0.086098995    -13.66210  0.00000000
8.  A(1,1)                        0.298475449  0.046993702      6.35139  0.00000000
9.  A(1,2)                       -0.124095879  0.070112013     -1.76997  0.07673281
10. A(2,1)                        0.061551419  0.031864938      1.93163  0.05340461
11. A(2,2)                        0.355969936  0.039672897      8.97262  0.00000000
12. B(1,1)                        1.147042406  0.035509033     32.30283  0.00000000
13. B(1,2)                        0.741209244  0.037170906     19.94058  0.00000000

从文档中,我会猜到我已经装满了,我可以使用以下输入来简单地模拟数据:

C = [0.997 1.734 -1.176];
A = [0.298 -0.124 0.062 0.356];
B = [1.147 0.741 -0.400 0.468];
parameters =[C A(:)' B(:)' ]'; %this is for the BEKK(1,1)
    [errors, Ht] = bekk_simulate(nobs,k,parameters,1,0,1,'Full');

然后,我显然会填写该函数运行所需的缺少的内容。

一位同事问一个问题,我是否需要先对参数求平方根?

0 个答案:

没有答案