GARCH Toolbox    

Accessing Specification Structures

This section discusses:

Using garchset to Create a Specification Structure

The function garchset provides various options for creating and modifying a specification structure. Each of the following commands uses a different garchset syntax to create identical specification structures for the default model.

The first command explicitly sets all model orders: R, M, P, and Q. This command illustrates the most basic garchset calling syntax. It specifies the structure fields as parameter/value pairs, in which the parameter name is a MATLAB character string enclosed in single quotes, followed by its corresponding value. When calling garchset, you only need to type the leading characters that uniquely identify the parameter. As illustrated here, case is ignored for parameter names.

The second command sets model orders for a GARCH(1,1) variance process only, and relies on the ARMAX(0,0,?) default for the mean. The third command creates an initial structure, and then updates the existing structure with additional parameter/value pairs. The last command, with no input arguments, creates a structure for the default model. The last command also implies that the following commands produce exactly the same estimation results.

Retrieving Specification Structure Values

The function garchget retrieves the values contained in specification structure fields.

Use garchget to retrieve the estimated coefficients from coeff. Then use garchset to write those coefficients to a new specification structure, spec, that is almost identical to coeff. For both garchget and garchset, you only need to type the leading characters that uniquely identify the parameter. Case is ignored for parameter names.

In this example, garchset automatically generates the first six fields (i.e., Comment, R, M, P, Q, and Distribution). Specifically, garchset infers the comment and model orders (R, M, P, Q) from the corresponding coefficient vectors (AR, MA, ARCH, GARCH). The converse is not true. If you specify only the model orders, garchset creates the coefficient vectors as empty matrices ([]). If you later call garchfit, it estimates the coefficient vectors for models of the order you specify, and updates the AR, MA, ARCH, and GARCH fields with these values.

Accessing Fields Directly

In addition to using garchset and garchget to access the values of specification structure fields, you can also manipulate the fields of a structure directly. For example, the commands

both retrieve the order P in the structure spec. Similarly, the commands

both write the order P = 3.

The first command in each case uses a GARCH Toolbox function to retrieve or write the value of a field. In this case the toolbox performs error checking (e.g., to ensure compatibility between inputs and guarantee that ARMA models are stationary/invertible). You also have the convenience of partial field names and case insensitivity.

In each case, the second command manipulates the structure directly. Although this approach does not support partial field names and case insensitivity, it can be convenient when you work interactively at the MATLAB command line. However, it does not provide error checking. For this reason, you should avoid manipulating a specification structure directly when writing code.

Note that the call to garchset above fails in your example workspace because the corresponding coefficient vector, GARCH, has only one element. Setting spec.P = 3 directly succeeds but leaves you with an inconsistent specification structure.


  Valid Model Specifications Using the Specification Structure for Estimation, Simulation, and Forecasting