[ Home | GAUSS | GAUSS Engine | GAUSS Apps | 3rd Party Apps | Keywords Index ]

FANPAC: Financial Modeling with GARCH

Risk Management, Volatility Estimation, and Value at Risk

FANPAC extends GAUSS through a cutting-edge implementation of GARCH to provide an efficient platform for volatility estimation in financial time series data for portfolio managers, institutional traders and financial analysts. Click here for the FANPAC Keywords quick reference guide.

GARCH and Multivariate GARCH

FANPAC incorporates a comprehensive suite of GARCH (Generalized Autoregressive Conditional Heteroskedastic) models for estimating volatility. Based on a powerful new implementation of nonlinear programming (NLP).

Features

  • Multivariate ARCH and GARCH models - Diagonal Vec, constant correlation Diagonal Vec, and BEKK models
  • Univariate OLS, ARIMA, ARCH, GARCH, exponential GARCH, integrated and fractionally integrated GARCH
  • Univariate and multivariate models in Normal or t distributions
  • Univariate and Diagonal Vec, multivariate ARCH and GARCH available "in-mean", i.e., conditional variances, standard deviations may be included in the mean equation
  • All univariate and Diagonal Vec multivariate ARCH and GARCH available "in-CV", i.e., regressors can be added to the conditional variance equation
  • Procedures for computing standardized residuals
  • Conditional variances, covariances matrices, forecasts and confidence limits by inversion of the Wald statistic

Portfolio Risk Analysis

The NLP (nonlinear programming module) in FANPAC is capable of solving the Markowitz mean/variance efficient frontier problem. And since it allows general nonlinear equality or inequality constraints, it is capable of solving much more complicated mean/variance analyses. The major shortcoming in computing the traditional efficient frontier has been in estimating the covariance matrix.

Traditional analysis assumes a constant covariance matrix across time which experience has shown not to the case. The multivariate GARCH model solves this problem. In the GARCH model the covariance matrix, or volatility matrix is allowed to vary with time. Research has shown that the GARCH model is quite successful fitting financial time series. With the multivariate ARCH/GARCH models in FANPAC, you can forecast the covariance matrix over the next period and use this estimate to generate investment portfolio weights that minimize your risk for a level of return, and give you an estimate of your value-at-risk.

In FANPAC, you are not limited to some preconceived ideas about risk analysis as you would find in a standard package. Risk management and analysis is presently in a state of intense development. With the tools in FANPAC you are in a position to forge your own methods of risk analysis at the level of the state of the art. Easy to use Keyword commands allow even the uninitiated immediate access to the power of this package. You can easily declare data sets, time series, independent variables, compute log-returns, perform estimation, print results, set global parameters, simulate time series, plot conditional variances and covariance matrices, time series, standardized residuals, QQ plots, autocorrelation and partial autocorrelation functions.
 
State-of-the-art Nonlinear Programming Optimization

The core of this time series package is a completely documented nonlinear programming suite. NLP does the hard work of generating the estimates of these models. GARCH models are very difficult to estimate but NLP has been especially designed for tough problems. It uses the Sequential Quadratic Programming method with BFGS and NEWTON descent methods and incorporates a Trust Region method. Special techniques have been designed to switch among the descent and line search methods to prevent the iterations from bogging down. 

NLP also contains a special method for handling ill-conditioned problems. When this feature is selected, NLP will automatically detect linear dependencies in the Hessian (or matrix of second derivatives with respect to parameters which is used in the iterations and in the calculation of the covariance matrix of the parameters). Linear equality constraints are added to the model to compensate for the linear dependency. 

At convergence, the linear dependency equality constraint is used in the calculation of the covariance matrix of the parameters, and is reported to the user.

Portfolio Allocation and Risk Analysis

The availability of multivariate GARCH models solves a very significant problem in investment portfolio management. The Markowitz mean/variance method is a standard model for optimizing portfolio allocation. In this method allocation is described by a weight matrix, w. Risk is measured as the square root of w' Sigma w where Sigma is the covariance matrix of the individual investment returns, and portfolio return is w' mu where mu is the vector of mean returns. An "efficient frontier" is computed by finding weights that minimize risk subject to a specified portfolio return. The efficient frontier is the plot of portfolio returns against the risk. 

This allocation method has heretofore received little attention, however, because of certain difficulties in estimating the moments of the investment returns. Conventional methods essentially assumed constant moments across the window of analysis. To get reasonable results, investigators were forced to analyze monthly returns. But this created rank problems for large portfolios, i.e., to get an invertable covariance matrix for a portfolio of, say, 100 stocks required a minimum of 101 observations, or more than 8 years of data. 

These problems have been strongly mitigated by the ability of the multivariate GARCH model to allow the covariance matrix to vary with time. It is now possible to get good results with daily data decreasing the length of the time series required for the analysis. The discussion continues among investigators as to the best model for explaining portfolio time series, some arguing for stochastic volatility models and others proposing one or another variation on the basic GARCH model. But there is plenty of evidence to suggest that the simple GARCH model is a very good approximation from which one can draw fruitful results. 

For example, suppose we are considering a portfolio composed of seven technology stocks, AMZN, LCOS, SEEK, YHOO, CPWR, MSFT, and SUNW. This grouping includes four internet stocks and three computer stocks. The following analysis includes prices on these stocks from May 15, 1997 to October 6, 1997. We conduct an estimation of the annualized log returns (i.e., log of ratio of price at time t divided by price at time t-1 times 251 which is the number of trading days in a year) employing a Diagonal Vec multivariate GARCH(1,1) model with constant correlation and assuming a multivariate t distribution. The command file for this problem using FANPAC keyword functions looks like this: 

library fanpac,pgraph;
session mult 'mult test';
setDataSet stocks;
setSeries AMZN LCOS SEEK YHOO CPWR MSFT SUNW;
computeLogReturns 251; 
estimate mrun cdvtgarch(1,1); 
forecast 1; showresults; 

The list of estimated parameters includes the correlation matrix, and the forecast includes the estimated mean returns and conditional variances for each of the stocks for the next period, in this case October 7, 1997: 

Suppose our current allocation is 25% each in AMZN, YHOO, MSFT, and SUNW. Given this allocation our forecast portfolio risk and return is: 

portfolio mean return 0.4156
portfolio standard deviation 1.5223 

The distribution of the portfolio mean return is Student's t with degrees of freedom equal to the number of stocks times the degrees of freedom from the estimation, 5.298. If our mean return is drawn from this distribution, 95% of the possible returns will be between -2.6686 and 3.4998. 100*(exp(-2.6686/251)-1) = -1.08 can be interpreted as the next day's percent loss given a 95% worst case scenario. 100*(exp(-2.6686)-1) = -93.43 is an approximate annualized loss, in other words, we can expect to lose about 99% of our portfolio if the worst case persists throughout the year. 

The Optimal Allocation

The calculation of the efficient frontier requires solving a quadratic programming problem. This is easily handled using the NLP procedures in FANPAC. The frontier for the forecast covariance matrix and means of the log returns is presented in this graph. 

The solid blue curve represents the frontier with the scale on the vertical axis interpreted as portfolio return, while the dotted lines for the stocks represent the proportions of each stock in the efficient portfolio given the portfolio risk, interpreting the scale on the vertical axis as a proportion. 

The portfolio return for our original allocation was .3354 and the associated portfolio risk was 2.6516. The risk for an efficient allocation given the same return, however, is 2.0367, as we can see from the plot. The efficient allocation for mean .3354 and risk 2.0367 is: 

For the efficient portfolio we must reduce our holdings in AMZN, YHOO, MSFT, and SUNW, and put most of that into CPWR. 

We reduce our risk by nearly 25% by re-allocating to the efficient portfolio. The one day and annualized percent losses for this portfolio are -.70% and 82.67% respectively, a distinct improvement over the original portfolio.

Univariate Time Series Models

Univariate time series models in FANPAC include ARIMA, ARCH, and GARCH models. All of these models are available assuming either Normal or Student's t distributions, except for the EGARCH model which assumes a form of the generalized error distribution.

Constraints

The power of the NLP optimization module used by FANPAC for the estimation permits any type of constraint to be placed on these models. The important types are those placed to enforce stationarity, and those placed in ARCH/ GARCH models to guarantee positive conditional variances, or positive definite conditional variance-covariance matrices in the case of multivariate models. 

CPWR prices May 15, 1997 to November 9, 1998

For multivariate models, the eigenvalues of the conditional variance-covariance matrices are constrained to be greater than a small number. For GARCH(1,q) and GARCH(2,q) models, the Nelson & Cao constraints (D.B. Nelson and C.Q. Cao, "Inequality constraints in the univariate GARCH model", JBES, 10:229-235) can be placed which guarantee positive conditional variances in the population, not just the sample. For other univariate models, constraints are enforced to guarantee positivity in the sample. 

For stationarity, nonlinear inequality constraints can be placed to force roots of the characteristic polynomials to be outside the unit circle. These constraints are placed by default on all ARIMA, ARCH, and GARCH models.However, they may be deleted by the user for particular models. 

Constraints to enforce positivity of conditional variances is necessary for the calculation of the log-likelihood. Stationarity constraints, on the other hand, aren't necessary to achieve a solution. Some software packages won't inform the user that the roots fail to support a stationarity assumption. Other packages impose unnecessarily restrictive constraints on parameters which causes the models to fit poorly and to be hard to estimate. 

The default constraints in FANPAC are the least restrictive that also satisfy stationarity requirements. You may choose the more restrictive constraints, or none at all. 
 
Independent Variables

Independent variables can also be added to either the mean equation (i.e., in mean) or the conditional variance equation (i.e., in CV). This latter feature is made possible by the NLP optimization module used by FANPAC to estimate these models. NLP allows general nonlinear inequality constraints to be placed on parameters. This capability is used by FANPAC to constrain conditional variances to be positive. This allows independent variables to be added to the conditional variance equation without regard to the nonnegativity of the conditional variances since NLP will find the best fitting parameter estimates subject to that condition. 

CPWR Log Returns

In this example, CPWR (Compuware) stock prices for May 15, 1997 through November 9, 1998 are analyzed in three types of GARCH(3,3) models: without independent variables (RUN1),with volume (scaled to units of 10,000 shares) in the mean equation (RUN2), with volume in the conditional variance equation (RUN3), and with volume squared in the conditional variance equation (RUN4). 

Conditional Variances

As can be seen in Table 1, the best fitting model is one with the volume squared in the conditional variance equation. This supports the reasonable hypothesis that a portion of the heteroskedasticity in log returns is due to volume. 

An analysis of the distributional properties of the time series of CPWR log-returns indicates that the fourth model convincingly reduces the rather severe skew and kurtosis. 

The Ljung-Box test is marginal, suggesting perhaps that we look at some lagged effects in the time series.

Multivariate Time Series Models

FANPAC provides three types of multivariate ARCH/GARCH models: Diagonal Vec, constant correlation Diagonal Vec, and BEKK. Most of these models also permit including independent variables in the mean and conditional variance equations. 

Constraints are imposed to ensure the positive definiteness of the conditional variance-covariance matrices For ARCH (1,1) and GARCH(1,1) Diagonal Vec models, roots of characteristic polynomials are constrained to be outside the unit circle. 

For example, consider a Diagonal Vec model of AMZN (Amazon.com) and SEEK (Infoseek) annualized daily log returns from May 15, 1997 to March 15, 1998 assuming a Student's t distribution.

Platform: Windows, LINUX and UNIX.