Products & Services Solutions Academia Support User Community Company

Learn more about Econometrics Toolbox   

Process Simulation

Introduction

Given models for the conditional mean and variance, as described in Conditional Mean and Variance Models, the garchsim function can simulate one or more sample paths for return series, innovations, and conditional standard deviation processes.

The section Example: Using the Default Model uses the default GARCH(1,1) model to model the Deutschmark/British pound foreign-exchange series. These examples use the resulting model

to simulate sample paths for return series, innovations, and conditional standard deviation processes.

Preparing the Example Data

Restore your workspace as needed. Due to space constraints, this example shows only part of the output of the estimation:

load garchdata
dem2gbp = price2ret(DEM2GBP);
[coeff,errors,LLF,innovations,sigmas] = garchfit(dem2gbp);
coeff

coeff = 
          Comment: 'Mean: ARMAX(0,0,0); Variance: GARCH(1,1) '
     Distribution: 'Gaussian'
                C: -6.3728e-005
    VarianceModel: 'GARCH'
                P: 1
                Q: 1
                K: 9.9718e-007
            GARCH: 0.8146
             ARCH: 0.1472

Simulating Single Paths

  1. Generate a single path of 1000 observations starting from the initial MATLAB random number generator state. Assuming 250 trading days per year, this represents roughly fours years' worth of daily data:

    strm = RandStream('mt19937ar','Seed',12321);
    RandStream.setDefaultStream(strm);
    [e,s,y] = garchsim(coeff,1000);

      Tip   For information about how to generate coeff for use in this example, see Introduction.

    The result is a single realization of 1000 observations each for the innovations {εt}, conditional standard deviations {σt}, and returns {yt} processes. The output variables e, s, and y represent these processes.

  2. Plot the garchsim output data.

    garchplot(e,s,y)

      Note   If you do not specify the number of observations, the default is 100. For example, the command

      [e,s,y] = garchsim(coeff)

      produces a single path of 100 observations.

Simulating Multiple Paths

In some cases, you may need multiple realizations. Use the same model as in Simulating Single Paths to simulate 1000 paths of 200 observations each:

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

The {εt}, {σt}, and {yt} processes are 200-by-1000 element matrices. These arrays that require large amounts of memory. Because of the way the Econometrics Toolbox software manages transients, simulating this data requires more memory than the 4800000 bytes indicated in the Workspace Browser.

For more information about transients, see Automatically Generating 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