# GAUSS garchmFit Example

### Introduction

The following is an example of implementing the garchmFit procedure for estimating asymmetric garch-in-mean models. The example estimates the model

$$Y = X_{1} + X_{2}$$

## Setting up the estimation

GAUSS uses the internal sqpSolveMT optimization routine for estimation of all GARCH models. In some cases, optimization performance can be enhanced by using the optimization parameters stored in the sqpsolvemtControl structure. To avoid conflict with internal instances of the sqpsolveMTstructure these parameters are set using a user-defined procedure:

new;
library tsmt;

// Declare 'ctl' to be a garchControl struct
// and fill with default settings
struct garchControl ctl;
ctl = garchControlCreate();

// Assign pointer to procedure which
// sets the desired options for the internal
// optimization procedre, sqpSolveMT
ctl.sqpsolvemtControlProc = &sqp;

// Procedure to set 'sqpSolveMT' control settings
proc sqp(struct sqpsolvemtControl c0);
c0.printiters = 1;
c0.feasibletest = 0;
retp(c0);
endp;

## Estimate the model

This example uses previously simulated data stored in the GAUSS dataset "garchx.dat". The model can be estimated in a single line using the GAUSS formula string syntax. Because parameters in garchControl structure are changed from their default values, the control structure must be passed to the function:

new;
library tsmt;

// Get file name with full path
dataset = getGAUSSHome() \$+ "pkgs/tsmt/examples/garchx.dat";

// Estimate the model
call garchMFit(dataset, "Y ~ X1 + X2", 1, 1, ctl);

## Output

Normal Solution

AIC    1040.0499
lrs    1026.0499

Coefficients     lower cl     upper cl
beta0[1,1]        0.0292      -0.0307       0.0891
beta[1,1]         0.4028       0.3945       0.4111
beta[2,1]         0.5007       0.4922       0.5093
garch[1,1]        0.1153      -0.2116       0.4422
arch[1,1]         0.2582       0.1491       0.3673
delta[1,1]       -0.0704      -0.4923       0.3515
omega[1,1]        0.0138       0.0071       0.0204 

### Have a Specific Question?

Get a real answer from a real person

### Need Support?

Get help from our friendly experts.