Products & Services Solutions Academia Support User Community Company

Learn more about Econometrics Toolbox   

Ordinary Least Squares Regression

This example illustrates an ordinary least squares regression, by simulating a return series that scales the daily return values of the New York Stock Exchange Composite Index. It also provides an example of a constant conditional variance model.

  1. Load the NYSE data set and convert the price series to a return series:

    load garchdata
    nyse = price2ret(NYSE);
  2. Create a specification structure. Set the Display flag to 'off' to suppress the optimization details that garchfit usually displays:

    spec = garchset('P',0,'Q',0,'C',0,...
                    'Regress',1.2,...
                    'K',0.00015,...
                    'Display','off')
    spec = 
              Comment: 'Mean: ARMAX(0,0,?); Variance: GARCH(0,0)'
         Distribution: 'Gaussian'
                    C: 0
              Regress: 1.2000
        VarianceModel: 'GARCH'
                    K: 1.5000e-004
              Display: 'off'
    
  3. Simulate a single realization of 2000 observations, fit the model, and examine the results:

    strm = RandStream('mt19937ar','Seed',2269);
    RandStream.setDefaultStream(strm);
    [e,s,y]        = garchsim(spec,2000,1,[],nyse);
    [coeff,errors] = garchfit(spec,y,nyse);
    garchdisp(coeff,errors)
     
        Mean: ARMAX(0,0,1); Variance: GARCH(0,0)
     
      Conditional Probability Distribution: Gaussian
      Number of Model Parameters Estimated: 3
    
                                   Standard          T     
      Parameter       Value          Error       Statistic 
     -----------   -----------   ------------   -----------
               C    -0.00022331    0.00028146      -0.7934
      Regress(1)    1.2084         0.03006         40.2005
               K    0.0001581      5.1417e-006     30.7479

    These estimation results are just the ordinary least squares (OLS) regression results. In fact, in the absence of GARCH effects and assuming Gaussian innovations, maximum likelihood estimation and least squares regression are the same thing.

      Note   This example appears purely for illustrative purposes. Although you can use the Econometrics Toolbox software to perform OLS, to do so is computationally inefficient and not recommended.

  


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