本帖最后由 郝倞 于 2014-9-14 14:44 编辑
最近在做毕业论文,需要用bekk模型,matlab中help bekk提示如下: [PARAMETERS,LL,HT,VCV,SCORES] = bekk(DATA,DATAASYM,P,O,Q,TYPE,STARTINGVALS,OPTIONS)
bekk is both a directory and a function.
Estimation of symmetric and asymmetric bekk(p,o,q) multivarate volatility models
USAGE:
[PARAMETERS] = bekk(DATA,[],P,O,Q)
[PARAMETERS,LL,HT,VCV,SCORES] = bekk(DATA,DATAASYM,P,O,Q,TYPE,STARTINGVALS,OPTIONS)
INPUTS:
DATA - A T by K matrix of zero mean residuals -OR-
K by K by T array of covariance estimators (e.g. realized covariance)
DATAASYM - [OPTIONAL] K by K by T array of asymmetric covariance estimators only needed if
DATA is 3-dimensional and O>0
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 - [OPTIONAL] String, one of 'Scalar' (Default) ,'Diagonal' or 'Full'
STARTINGVALS - [OPTIONAL] Vector of starting values to use. See parameters and COMMENTS.
OPTIONS - [OPTIONAL] Options to use in the model optimization (fmincon)
OUTPUTS:
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(:)'
LL - The log likelihood at the optimum
HT - A [K K T] dimension matrix of conditional covariances
VCV - A numParams^2 square matrix of robust parameter covariances (A^(-1)*B*A^(-1)/T)
SCORES - A T by numParams matrix of individual scores
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).
Use bekk_parameter_transform to produce formatted parameter matrices.
See also bekk_simulate, bekk_parameter_transform, rarch
两个问题:
1、输出部分的HT,按照help提示的应该是一个[K K T]维的矩阵吧,怎么我做出来是个[K,K,T+1]维的,多出了一页,不合理啊。
2、DATAASYM这个是不是已实现的方差-协方差矩阵啊?要自己编一小段算出来时吧?不知道哪位大神遇到过类似第一个的问题,第二个给点提示也好啊。
可以做如下小程序,
PARA=[0.00357460132567677;0.00161923973530560;0.00103131388676117;0.399431477394937;0.0165599809459979;-0.0265518007745671;0.233371240388713;0.830112532352297;-0.0195658469175946;0.113649710973876;0.931668342134348;];
[DATA,HT] = bekk_simulate(1000,2,PARA,1,0,1,'Full');
[para_bekk,ll_bekk,ht_bekk]=bekk(DATA,[],1,0,1,'full');
ht_bekk应该是[2 2 1000]维吧,结果反而是[2,2,1001]维,和HT明显不一样