Products & Services Solutions Academia Support User Community Company

Learn more about Econometrics Toolbox   

Presample Data

About Presample Data

Because the mean equation and the variance equations can be recursive in nature, they require initial, or presample, data to initiate the simulation. This section explains the use of automatically generated and user-supplied presample data. It also discusses response tolerance and the minimization of transient effects for automatically generated presample data.

Automatically Generating Presample Data

When you allow garchsim to automatically generate required initial data:

Automatically Minimizing Transient Effects

garchsim generates output processes in a (approximately) steady state by attempting to eliminate transients in the data it simulates. It first estimates the number of observations needed for the transients to decay to some arbitrarily small value, subject to a 10000-observation maximum. It then generates a number of observations equal to the sum of this estimated value and the number of observations you request. garchsim then ignores the earlier estimated number of initial observations needed for the transients to decay sufficiently, and returns only the requested number of later observations.

To do this, garchsim interprets a GARCH(P,Q) or GJR(P,Q) conditional variance process as an ARMA(max(P,Q),P) model for the squared innovations. It also interprets an EGARCH(P,Q) process as an ARMA(P,Q) model for the log of the conditional variance. (See, for example, Bollerslev [6], p. 310.) It then interprets the ARMA model as the correlated output of a linear filter and estimates its impulse response. It does so by finding the magnitude of the largest eigenvalue of its autoregressive polynomial. Based on this eigenvalue, garchsim estimates the number of observations (subject to a maximum of 10000) needed for the magnitude of the impulse response (which begins at 1) to decay below the default response tolerance 0.01 (1 percent). If the conditional mean has an ARMA(R,M) component, then garchsim also estimates the number of observations needed for the impulse response to decay below the response tolerance. This number is also subject to a maximum of 10000.

The effect of transients in the simulation process parallels that in the estimation, or inference, process. Inferring Residuals provides an example of transient effects in the estimation process.

Specifying a Scalar Response Tolerance

This example compares simulated observations generated using the default response tolerance, 0.01, and a larger tolerance, 0.05, using the model from Process Simulation.

  1. Simulate a single path of 200 observations, using the default tolerance 0.01, and set the scalar integer random generator state to its initial state 0:

    strm = RandStream('mt19937ar','Seed',12321);
    RandStream.setDefaultStream(strm);
    [e,s,y] = garchsim(coeff,200,1000);
    [e1,s1,y1] = garchsim(coeff,200,1);
    garchplot(e1,s1,y1)

  2. Now repeat the simulation, specifying the scalar Tolerance argument as 0.05:

    strm = RandStream('mt19937ar','Seed',12321);
    RandStream.setDefaultStream(strm);
    [e5,s5,y5] = garchsim(coeff,200,1,[],[],0.05);
    garchplot(e5,s5,y5)

    The observations generated using the 0.05 response tolerance are the same as those generated for the default 0.01 tolerance, but shifted to the right. This is because fewer observations are required for the magnitude of the impulse response to decay below the larger 0.05 tolerance.

    If Tolerance is smaller than 0.01, garchsim might have to generate more observations. This could cause it to reach the 10000 observation transient decay period maximum, or run out of memory.

Storage Considerations

Depending on the values of the parameters in the simulated conditional mean and variance models, you may need long presample periods for the transients to die out. Although the simulation outputs relatively small matrices, the initial computation of these transients can consume large amounts of memory, leading to performance degradation. Because of this, garchsim imposes a maximum of 10000 observations to the transient decay period of each realization. The example in Simulating Multiple Paths, which simulates three 200-by-1000 element arrays, requires intermediate storage for many more than 200 observations.

Minimizing Transient Effects

If you suspect that transients persist in the simulated data garchsim returns, use one of the following methods to minimize their effect:

Oversampling.   Generate samples that are larger than you need, and delete observations from the beginning of each output series. For example, suppose you simulate 10 independent paths of 1000 observations each for {εt}, {σt}, and {yt}, starting from a known scalar random number state (12345).

  1. Generate 1200 observations:

    strm = RandStream('mt19937ar','Seed',12345);
    RandStream.setDefaultStream(strm);
    [e,s,y] =  garchsim(coeff,1200,10);

    garchsim generates sufficient presample data so that it can ignore initial samples that might be affected by transients. It then returns only the requested 1200 later observations.

  2. Further minimize the effect of transients by retaining only the last 1000 observations of interest:

    e = e(end-999:end,:);
    s = s(end-999:end,:);
    y = y(end-999:end,:);

Recycling Outputs.   Simulate the desired number of observations without explicitly providing presample data; that is, use garchsim to automatically generate the presample data. Then run the simulation again, using the simulated observations as the presample data. Repeat this process until you have sufficiently eliminated transient effects. For information about supplying presample data, see Running Simulations With User-Specified Presample Data.

Running Simulations With User-Specified Presample Data

To explicitly specify all required presample data, use the following time series input arrays:

When specified, garchsim uses these presample arrays to initiate the filtering process and form the conditioning set upon which the simulated realizations are based.

The PreInnovations, PreSigmas, and PreSeries arrays and their associated outputs are column-oriented. Each column of each array is associated with a distinct realization, or sample path. The first row of each array stores the oldest data, and the last row stores the most recent data.

You can specify these input arguments as matrices (with multiple columns), or as single-column vectors. The following table summarizes the minimum number of rows required to successfully initiate the simulation process.

Garchsim Input Argument

Minimum Number of Rows


GARCH(P,Q), GJR(P,Q)

EGARCH(P,Q)

PreInnovations

max(M,Q)

max(M,Q)

PreSigmas

P

max(P,Q)

PreSeries

R

R

If you specify these input arguments as matrices, garchsim uses each column to initiate simulation of the corresponding column of the Innovations, Sigmas, and Series outputs. Each of the presample inputs must have NUMPATHS columns.

If you specify these input arguments as column vectors, and NUMPATHS is greater than 1, garchsim performs dependent path simulation. In this case, garchsim applies the same vector to each column of the corresponding Innovations, Sigmas, and Series outputs. All simulated sample paths share a common conditioning set. Although all realizations evolve independently, they share common presample conditioning data. Dependent path simulation enables the simulated sample paths to evolve from a common starting point, and allows Monte Carlo simulation of forecasts and forecast error distributions. See Example Workflow.

If you specify at least one, but fewer than three, sets of presample data, garchsim does not attempt to derive presample observations for those you omit. When specifying your own presample data, include all required data for the given conditional mean and variance models. See the example Presample Data.

  


Free Interactive Computational Finance CD

View demos and recorded presentations led by industry experts.

Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS