MULTIVARIATE GARCH BASED ON PCA
The code takes a multiple returns vector and generate covariance martix. It has 4 different GRACH models and it uses the AIC/BIC test to select best fitted model for each serie.
Input:
X: NxM M series of length N of returns
NumFac: the munber of factor to be used in the CPA process. If NumFac<1 the percentage of varince will be used to determin the number of factors
Lag: Lag for the covariance forecast
Samp: The umber of periods from the last period to use to calculate the matrix
OUTPUT:
Cov:Covariance matrix
Corr: correlation matrix
Cov: forecast Covariance
PCorr:forecast correlation
PRt: forecast return
PRterr: forecast return error
NumFac: number of factors used in the PCA
COEFF: is a P-by-P matrix, each column containing coefficients
for one principal component.
SCORE: correspond to observations, columns to components.
ev: eigenvalues of the covariance matrix of X, in
LATENT.
Example: P is a NxM matrix of prices with N periods and M assets.
Rt=tick2ret(P);
[Cov Corr PCov PCorr PRt Model PRterr NumFac COEFF,SCORE,ev]=uni_multi_garch(Rt,0.8,1,N-1)
comments and corrections are welcome. I'm using this to calculate the variance of my portfolios and I have more than 3 years experiance of managing the the volatility of my portfolios using this code.
The code is based in the following paper:
Multivariate GARCH with Only Univariate
Estimation
Cite As
Tal Shir (2024). MULTIVARIATE GARCH BASED ON PCA (https://www.mathworks.com/matlabcentral/fileexchange/47071-multivariate-garch-based-on-pca), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- AI and Statistics > Statistics and Machine Learning Toolbox > Dimensionality Reduction and Feature Extraction >
- Computational Finance > Econometrics Toolbox > Conditional Variance Models >
- Computational Finance > Econometrics Toolbox > Multivariate Models >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.