Page 1 of 1

Cholesky decomposition of time-varying covariances

Posted: Fri Apr 24, 2015 7:49 am
by klaus86
Dear all,

I estimate a standard bivariate VECM-BEKK model with futures and spot prices and need to conduct a cholesky decomposition of the estimated variance-covariance matrix at each time t of my sample period. I know how to do the Cholesky for a time-invariant covariance matrix but I was not able to do it for the time-varying H-matrix of my BEKK model. Does anyone have an idea how to compute the (time-varying) lower triangular matrix from the Cholesky decomposition of H for each t of my sample period?
Here is my code:

Code: Select all

[OPEN DATA "<spot_futures.xlsx"
CALENDAR(W) 2009:7:20
DATA(FORMAT=XLSX,ORG=COLUMNS) 2009:07:20 2014:04:21 spot futures year week


set retspot = log(spot)-log(spot{1})
set retfutures = log(futures)-log(futures{1})
set ect = log(futures)-log(spot)


system(model=vecm)
variables retfutures retspot
lags 1 to 2
det constant ect{1}
end(system)
*
* Estimate by GARCH-BEKK
*
garch(model=vecm,mv=bekk,hmatrices=h, MVHSERIES=bekkHmatrix, rvectors=r,pmethod=simplex,piters=5,method=bfgs,iters=400)


Any help is greatly appreciated!

Cholesky decomposition of time-varying covariances

Posted: Fri Apr 24, 2015 9:15 am
by TomDoan
%decomp(h(t)) would give the Cholesky factorization of the covariance matrix at T. What is it that you want to do with them? How you would use that depends upon what the end result is to be.

Cholesky decomposition of time-varying covariances

Posted: Fri Apr 24, 2015 9:54 am
by klaus86
TomDoan wrote:%decomp(h(t)) would give the Cholesky factorization of the covariance matrix at T. What is it that you want to do with them? How you would use that depends upon what the end result is to be.
Thank you Tom.
Is it possible to generate a separate series for each element of the lower triangular over the entire sample so that I can export it to Excel and do some further calculations? So in my 2 variable case the Cholesky factor F will have 3 (non-zero) elements. What I want is a series for the element (1,1) in F, a series for the element (2,1) in F and a series for the element (2,2) in F at each t over the whole sample period. Given that my H-matrix contains estimates for t=1,...,246, each of these 3 series will thus have a length of 246 entries.

Thanks in advance!

Cholesky decomposition of time-varying covariances

Posted: Fri Apr 24, 2015 10:22 am
by TomDoan
I would suggest that you might find it easier to do the further calculations in RATS, but at any rate, the following would kick out series of the lower triangle to Excel. The first column will be the (1,1) elements, the second the (2,1), the third the (2,2) etc. If you want the full matrices with zeros and all, change "packed" in the first two lines to "rect".

Code: Select all

dec packed[series] cholesky(%nvar,%nvar)
dec packed factor
do t=%regstart(),%regend()
   compute factor=%decomp(h(t)),%pt(cholesky,t,factor)
end do t
*
copy(format=xls,org=columns) %regstart() %regend() choleski