100% found this document useful (3 votes)
624 views

Instant Download MATLAB Econometrics Toolbox User S Guide The Mathworks PDF All Chapters

s

Uploaded by

fearysetal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
624 views

Instant Download MATLAB Econometrics Toolbox User S Guide The Mathworks PDF All Chapters

s

Uploaded by

fearysetal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

Download the full version of the textbook now at textbookfull.

com

MATLAB Econometrics Toolbox User s Guide The


Mathworks

https://textbookfull.com/product/matlab-
econometrics-toolbox-user-s-guide-the-mathworks/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

MATLAB Bioinformatics Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-bioinformatics-toolbox-user-s-
guide-the-mathworks/

textbookfull.com

MATLAB Mapping Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-mapping-toolbox-user-s-guide-
the-mathworks/

textbookfull.com

MATLAB Optimization Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-optimization-toolbox-user-s-
guide-the-mathworks/

textbookfull.com

Alternative Energy Sources and Technologies Process Design


and Operation 1st Edition Mariano Martín (Eds.)

https://textbookfull.com/product/alternative-energy-sources-and-
technologies-process-design-and-operation-1st-edition-mariano-martin-
eds/
textbookfull.com
Articulated Motion and Deformable Objects 8th
International Conference AMDO 2014 Palma de Mallorca Spain
July 16 18 2014 Proceedings 1st Edition Francisco José
Perales
https://textbookfull.com/product/articulated-motion-and-deformable-
objects-8th-international-conference-amdo-2014-palma-de-mallorca-
spain-july-16-18-2014-proceedings-1st-edition-francisco-jose-perales/
textbookfull.com

Bone Health Assessment in Pediatrics Guidelines for


Clinical Practice 2nd Edition Ellen B. Fung

https://textbookfull.com/product/bone-health-assessment-in-pediatrics-
guidelines-for-clinical-practice-2nd-edition-ellen-b-fung/

textbookfull.com

A Guide to Bioethics 1st Edition Emmanuel A. Kornyo

https://textbookfull.com/product/a-guide-to-bioethics-1st-edition-
emmanuel-a-kornyo/

textbookfull.com

Resilience in Aging Concepts Research and Outcomes Barbara


Resnick

https://textbookfull.com/product/resilience-in-aging-concepts-
research-and-outcomes-barbara-resnick/

textbookfull.com

Intervertebral Disc Degeneration Allen Ho

https://textbookfull.com/product/intervertebral-disc-degeneration-
allen-ho/

textbookfull.com
Founding Feuds: The Rivalries, Clashes, and Conflicts That
Forged a Nation Paul Aron

https://textbookfull.com/product/founding-feuds-the-rivalries-clashes-
and-conflicts-that-forged-a-nation-paul-aron/

textbookfull.com
Econometrics Toolbox™
User's Guide

R2020a
How to Contact MathWorks

Latest news: www.mathworks.com

Sales and services: www.mathworks.com/sales_and_services

User community: www.mathworks.com/matlabcentral

Technical support: www.mathworks.com/support/contact_us

Phone: 508-647-7000

The MathWorks, Inc.


1 Apple Hill Drive
Natick, MA 01760-2098
Econometrics Toolbox™ User's Guide
© COPYRIGHT 1999–2020 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used or copied
only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form
without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through
the federal government of the United States. By accepting delivery of the Program or Documentation, the government
hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer
software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014.
Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain
to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and
Documentation by the federal government (or other entity acquiring for or through the federal government) and shall
supersede any conflicting contractual terms or conditions. If this License fails to meet the government's needs or is
inconsistent in any respect with federal procurement law, the government agrees to return the Program and
Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be
trademarks or registered trademarks of their respective holders.
Patents
MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for
more information.
Revision History
October 2008 Online only Version 1.0 (Release 2008b)
March 2009 Online only Revised for Version 1.1 (Release 2009a)
September 2009 Online only Revised for Version 1.2 (Release 2009b)
March 2010 Online only Revised for Version 1.3 (Release 2010a)
September 2010 Online only Revised for Version 1.4 (Release 2010b)
April 2011 Online only Revised for Version 2.0 (Release 2011a)
September 2011 Online only Revised for Version 2.0.1 (Release 2011b)
March 2012 Online only Revised for Version 2.1 (Release 2012a)
September 2012 Online only Revised for Version 2.2 (Release 2012b)
March 2013 Online only Revised for Version 2.3 (Release 2013a)
September 2013 Online only Revised for Version 2.4 (Release 2013b)
March 2014 Online Only Revised for Version 3.0 (Release 2014a)
October 2014 Online Only Revised for Version 3.1 (Release 2014b)
March 2015 Online Only Revised for Version 3.2 (Release 2015a)
September 2015 Online Only Revised for Version 3.3 (Release 2015b)
March 2016 Online Only Revised for Version 3.4 (Release 2016a)
September 2016 Online Only Revised for Version 3.5 (Release 2016b)
March 2017 Online Only Revised for Version 4.0 (Release 2017a)
September 2017 Online Only Revised for Version 4.1 (Release 2017b)
March 2018 Online Only Revised for Version 5.0 (Release 2018a)
September 2018 Online Only Revised for Version 5.1 (Release 2018b)
March 2019 Online Only Revised for Version 5.2 (Release 2019a)
September 2019 Online Only Revised for Version 5.3 (Release 2019b)
March 2020 Online Only Revised for Version 5.4 (Release 2020a)
Contents

Getting Started
1
Econometrics Toolbox Product Description . . . . . . . . . . . . . . . . . . . . . . . . 1-2

Econometric Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3


Model Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Econometrics Toolbox Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3

Econometrics Toolbox Model Objects, Properties, and Object Functions


.......................................................... 1-7
Model Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7
Model Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8
Specify Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10
Retrieve Model Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13
Modify Model Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-14
Object Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-15

Stochastic Process Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-16


What Is a Stochastic Process? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-16
Stationary Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-17
Linear Time Series Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-17
Unit Root Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-18
Lag Operator Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-19
Characteristic Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-20

Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-22

Data Preprocessing
2
Data Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Why Transform? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Common Data Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2

Trend-Stationary vs. Difference-Stationary Processes . . . . . . . . . . . . . . . . 2-6


Nonstationary Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
Trend Stationary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
Difference Stationary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7

Specify Lag Operator Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9


Lag Operator Polynomial of Coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
Difference Lag Operator Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11

iii
Nonseasonal Differencing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13

Nonseasonal and Seasonal Differencing . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16

Time Series Decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-19

Moving Average Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-21

Moving Average Trend Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-22

Parametric Trend Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-25

Hodrick-Prescott Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-30

Using the Hodrick-Prescott Filter to Reproduce Their Original Result


......................................................... 2-31

Seasonal Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-35


What Is a Seasonal Filter? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-35
Stable Seasonal Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-35
Sn × m seasonal filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-36

Seasonal Adjustment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-38


What Is Seasonal Adjustment? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-38
Deseasonalized Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-38
Seasonal Adjustment Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-38

Seasonal Adjustment Using a Stable Seasonal Filter . . . . . . . . . . . . . . . . 2-40

Seasonal Adjustment Using S(n,m) Seasonal Filters . . . . . . . . . . . . . . . . 2-46

Model Selection
3
Box-Jenkins Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2

Box-Jenkins Model Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4

Autocorrelation and Partial Autocorrelation . . . . . . . . . . . . . . . . . . . . . . 3-11


What Are Autocorrelation and Partial Autocorrelation? . . . . . . . . . . . . . . 3-11
Theoretical ACF and PACF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11
Sample ACF and PACF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11

Ljung-Box Q-Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13

Detect Autocorrelation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15


Compute Sample ACF and PACF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15
Conduct the Ljung-Box Q-Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17

Engle’s ARCH Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20

iv Contents
Detect ARCH Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-22
Test Autocorrelation of Squared Residuals . . . . . . . . . . . . . . . . . . . . . . . 3-22
Conduct Engle's ARCH Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-24

Unit Root Nonstationarity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27


What Is a Unit Root Test? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27
Modeling Unit Root Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27
Available Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-28
Testing for Unit Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-30

Unit Root Tests . . . . . . . . . . . . . . . . . . ............................ 3-32


Test Simulated Data for a Unit Root ............................ 3-32
Test Time Series Data for Unit Root ............................ 3-37
Test Stock Data for a Random Walk ............................ 3-39

Assess Stationarity of a Time Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-42

Information Criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-45

Model Comparison Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-46


Available Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-46
Likelihood Ratio Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-48
Lagrange Multiplier Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-48
Wald Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-48
Covariance Matrix Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-49

Conduct Lagrange Multiplier Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-50

Conduct Wald Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-53

Compare GARCH Models Using Likelihood Ratio Test . . . . . . . . . . . . . . . 3-55

Check Fit of Multiplicative ARIMA Model . . . . . . . . . . . . . . . . . . . . . . . . . 3-58

Goodness of Fit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-63

Residual Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-64


Check Residuals for Normality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-64
Check Residuals for Autocorrelation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-64
Check Residuals for Conditional Heteroscedasticity . . . . . . . . . . . . . . . . 3-64

Assess Predictive Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-66

Nonspherical Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-67


What Are Nonspherical Models? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-67

Plot a Confidence Band Using HAC Estimates . . . . . . . . . . . . . . . . . . . . . 3-68

Change the Bandwidth of a HAC Estimator . . . . . . . . . . . . . . . . . . . . . . . 3-75

Check Model Assumptions for Chow Test . . . . . . . . . . . . . . . . . . . . . . . . . 3-80

Power of the Chow Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-87

v
Econometric Modeler
4
Econometric Modeler App Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Prepare Data for Econometric Modeler App . . . . . . . . . . . . . . . . . . . . . . . 4-3
Import Time Series Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
Perform Exploratory Data Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
Fitting Models to Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
Conducting Goodness-of-Fit Checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-23
Finding Model with Best In-Sample Fit . . . . . . . . . . . . . . . . . . . . . . . . . . 4-29
Export Session Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-30

Specifying Lag Operator Polynomials Interactively . . . . . . . . . . . . . . . . . 4-37


Specify Lag Structure Using Lag Order Tab . . . . . . . . . . . . . . . . . . . . . . 4-38
Specify Lag Structure Using Lag Vector Tab . . . . . . . . . . . . . . . . . . . . . . 4-40

Prepare Time Series Data for Econometric Modeler App . . . . . . . . . . . . 4-43


Prepare Table of Multivariate Data for Import . . . . . . . . . . . . . . . . . . . . . 4-43
Prepare Numeric Vector for Import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-44

Import Time Series Data into Econometric Modeler App . . . . . . . . . . . . 4-46


Import Data from MATLAB Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . 4-46
Import Data from MAT-File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-47

Plot Time Series Data Using Econometric Modeler App . . . . . . . . . . . . . 4-50


Plot Univariate Time Series Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-50
Plot Multivariate Time Series and Correlations . . . . . . . . . . . . . . . . . . . . 4-51

Detect Serial Correlation Using Econometric Modeler App . . . . . . . . . . 4-56


Plot ACF and PACF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-56
Conduct Ljung-Box Q-Test for Significant Autocorrelation . . . . . . . . . . . . 4-58

Detect ARCH Effects Using Econometric Modeler App . . . . . . . . . . . . . . 4-62


Inspect Correlograms of Squared Residuals for ARCH Effects . . . . . . . . . 4-62
Conduct Ljung-Box Q-Test on Squared Residuals . . . . . . . . . . . . . . . . . . 4-65
Conduct Engle's ARCH Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-67

Assess Stationarity of Time Series Using Econometric Modeler . . . . . . . 4-70


Test Assuming Unit Root Null Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-70
Test Assuming Stationary Null Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-73
Test Assuming Random Walk Null Model . . . . . . . . . . . . . . . . . . . . . . . . 4-77

Assess Collinearity Among Multiple Series Using Econometric Modeler


App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-81

Transform Time Series Using Econometric Modeler App . . . . . . . . . . . . 4-84


Apply Log Transformation to Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-84
Stabilize Time Series Using Nonseasonal Differencing . . . . . . . . . . . . . . 4-88
Convert Prices to Returns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-91
Remove Seasonal Trend from Time Series Using Seasonal Difference . . . 4-94
Remove Deterministic Trend from Time Series . . . . . . . . . . . . . . . . . . . . 4-97

Implement Box-Jenkins Model Selection and Estimation Using


Econometric Modeler App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-99

vi Contents
Select ARCH Lags for GARCH Model Using Econometric Modeler App
........................................................ 4-109

Estimate Multiplicative ARIMA Model Using Econometric Modeler App


........................................................ 4-118

Perform ARIMA Model Residual Diagnostics Using Econometric Modeler


App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-128

Specify t Innovation Distribution Using Econometric Modeler App . . . 4-137

Compare Predictive Performance After Creating Models Using


Econometric Modeler App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-141

Estimate ARIMAX Model Using Econometric Modeler App . . . . . . . . . . 4-148

Estimate Regression Model with ARMA Errors Using Econometric


Modeler App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-156

Compare Conditional Variance Model Fit Statistics Using Econometric


Modeler App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-170

Perform GARCH Model Residual Diagnostics Using Econometric Modeler


App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-179

Share Results of Econometric Modeler App Session . . . . . . . . . . . . . . . 4-186

Time Series Regression Models


5
Time Series Regression Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3

Regression Models with Time Series Errors . . . . . . . . . . . . . . . . . . . . . . . . 5-5


What Are Regression Models with Time Series Errors? . . . . . . . . . . . . . . . 5-5
Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5

Create Regression Models with ARIMA Errors . . . . . . . . . . . . . . . . . . . . . . 5-8


Default Regression Model with ARIMA Errors Specifications . . . . . . . . . . 5-8
Specify regARIMA Models Using Name-Value Pair Arguments . . . . . . . . . . 5-9
Specify Linear Regression Models Using Econometric Modeler App . . . . 5-15

Specify the Default Regression Model with ARIMA Errors . . . . . . . . . . . 5-19

Modify regARIMA Model Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-21


Modify Properties Using Dot Notation . . . . . . . . . . . . . . . . . . . . . . . . . . 5-21
Nonmodifiable Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-23

Create Regression Models with AR Errors . . . . . . . . . . . . . . . . . . . . . . . . 5-26


Default Regression Model with AR Errors . . . . . . . . . . . . . . . . . . . . . . . . 5-26
AR Error Model Without an Intercept . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-27
AR Error Model with Nonconsecutive Lags . . . . . . . . . . . . . . . . . . . . . . . 5-27

vii
Known Parameter Values for a Regression Model with AR Errors . . . . . . 5-28
Regression Model with AR Errors and t Innovations . . . . . . . . . . . . . . . . 5-29

Create Regression Models with MA Errors . . . . . . . . . . . . . . . . . . . . . . . . 5-31


Default Regression Model with MA Errors . . . . . . . . . . . . . . . . . . . . . . . 5-31
MA Error Model Without an Intercept . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-32
MA Error Model with Nonconsecutive Lags . . . . . . . . . . . . . . . . . . . . . . 5-32
Known Parameter Values for a Regression Model with MA Errors . . . . . . 5-33
Regression Model with MA Errors and t Innovations . . . . . . . . . . . . . . . . 5-34

Create Regression Models with ARMA Errors . . . . . . . . . . . . . . . . . . . . . . 5-36


Default Regression Model with ARMA Errors . . . . . . . . . . . . . . . . . . . . . 5-36
ARMA Error Model Without an Intercept . . . . . . . . . . . . . . . . . . . . . . . . 5-37
ARMA Error Model with Nonconsecutive Lags . . . . . . . . . . . . . . . . . . . . 5-37
Known Parameter Values for a Regression Model with ARMA Errors . . . . 5-38
Regression Model with ARMA Errors and t Innovations . . . . . . . . . . . . . 5-38
Specify Regression Model with ARMA Errors Using Econometric Modeler
App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-40

Create Regression Models with ARIMA Errors . . . . . . . . . . . . . . . . . . . . . 5-44


Default Regression Model with ARIMA Errors . . . . . . . . . . . . . . . . . . . . . 5-44
ARIMA Error Model Without an Intercept . . . . . . . . . . . . . . . . . . . . . . . . 5-45
ARIMA Error Model with Nonconsecutive Lags . . . . . . . . . . . . . . . . . . . . 5-45
Known Parameter Values for a Regression Model with ARIMA Errors . . . 5-46
Regression Model with ARIMA Errors and t Innovations . . . . . . . . . . . . . 5-47

Create Regression Models with SARIMA Errors . . . . . . . . . . . . . . . . . . . . 5-49


SARMA Error Model Without an Intercept . . . . . . . . . . . . . . . . . . . . . . . 5-49
Known Parameter Values for a Regression Model with SARIMA Errors . . 5-50
Regression Model with SARIMA Errors and t Innovations . . . . . . . . . . . . 5-50

Specify Regression Model with SARIMA Errors . . . . . . . . . . . . . . . . . . . . 5-53

Specify ARIMA Error Model Innovation Distribution . . . . . . . . . . . . . . . . 5-60


About the Innovation Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-60
Innovation Distribution Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-61
Specify Innovation Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-61

Impulse Response of Regression Models with ARIMA Errors . . . . . . . . . 5-65

Plot Impulse Response of Regression Model with ARIMA Errors . . . . . . 5-66


Regression Model with AR Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-66
Regression Model with MA Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-67
Regression Model with ARMA Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-68
Regression Model with ARIMA Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-70

Maximum Likelihood Estimation of regARIMA Models . . . . . . . . . . . . . . 5-73


Innovation Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-73
Loglikelihood Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-73

regARIMA Model Estimation Using Equality Constraints . . . . . . . . . . . . 5-75

Presample Values for regARIMA Model Estimation . . . . . . . . . . . . . . . . 5-109

Initial Values for regARIMA Model Estimation . . . . . . . . . . . . . . . . . . . . 5-111

viii Contents
Optimization Settings for regARIMA Model Estimation . . . . . . . . . . . . 5-113
Optimization Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-113
Constraints on Regression Models with ARIMA Errors . . . . . . . . . . . . . 5-115

Estimate a Regression Model with ARIMA Errors . . . . . . . . . . . . . . . . . 5-116

Estimate a Regression Model with Multiplicative ARIMA Errors . . . . . 5-123

Select Regression Model with ARIMA Errors . . . . . . . . . . . . . . . . . . . . . 5-131

Choose Lags for ARMA Error Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-133

Intercept Identifiability in Regression Models with ARIMA Errors . . . 5-137


Intercept Identifiability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-137
Intercept Identifiability Illustration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-138

Alternative ARIMA Model Representations . . . . . . . . . . . . . . . . . . . . . . . 5-141


regARIMA to ARIMAX Model Conversion . . . . . . . . . . . . . . . . . . . . . . . 5-141
Illustrate regARIMA to ARIMAX Model Conversion . . . . . . . . . . . . . . . . 5-142

Simulate Regression Models with ARMA Errors . . . . . . . . . . . . . . . . . . . 5-147


Simulate an AR Error Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-147
Simulate an MA Error Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-153
Simulate an ARMA Error Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-159

Simulate Regression Models with Nonstationary Errors . . . . . . . . . . . . 5-166


Simulate a Regression Model with Nonstationary Errors . . . . . . . . . . . 5-166
Simulate a Regression Model with Nonstationary Exponential Errors . . 5-169

Simulate Regression Models with Multiplicative Seasonal Errors . . . . 5-174


Simulate a Regression Model with Stationary Multiplicative Seasonal Errors
.................................................... 5-174
Untitled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-176

Monte Carlo Simulation of Regression Models with ARIMA Errors . . . 5-179


What Is Monte Carlo Simulation? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-179
Generate Monte Carlo Sample Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-179
Monte Carlo Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-180

Presample Data for regARIMA Model Simulation . . . . . . . . . . . . . . . . . 5-182

Transient Effects in regARIMA Model Simulations . . . . . . . . . . . . . . . . 5-183


What Are Transient Effects? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-183
Illustration of Transient Effects on Regression . . . . . . . . . . . . . . . . . . . 5-183

Forecast a Regression Model with ARIMA Errors . . . . . . . . . . . . . . . . . . 5-191

Forecast a Regression Model with Multiplicative Seasonal ARIMA Errors


........................................................ 5-194

Verify Predictive Ability Robustness of a regARIMA Model . . . . . . . . . . 5-198

MMSE Forecasting Regression Models with ARIMA Errors . . . . . . . . . 5-200


What Are MMSE Forecasts? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-200
How forecast Generates MMSE Forecasts . . . . . . . . . . . . . . . . . . . . . . 5-200

ix
Forecast Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-202

Monte Carlo Forecasting of regARIMA Models . . . . . . . . . . . . . . . . . . . . 5-203


Monte Carlo Forecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-203
Advantage of Monte Carlo Forecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-203

Bayesian Linear Regression


6
Bayesian Linear Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Classical Versus Bayesian Analyses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Main Bayesian Analysis Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3
Posterior Estimation and Inference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4

Implement Bayesian Linear Regression . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10


Workflow for Standard Bayesian Linear Regression Models . . . . . . . . . . 6-10
Workflow for Bayesian Predictor Selection . . . . . . . . . . . . . . . . . . . . . . . 6-13

Specify Gradient for HMC Sampler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-18

Posterior Estimation and Simulation Diagnostics . . . . . . . . . . . . . . . . . . 6-27


Diagnose MCMC Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-27
Perform Sensitivity Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-34

Tune Slice Sampler For Posterior Estimation . . . . . . . . . . . . . . . . . . . . . . 6-36

Compare Robust Regression Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . 6-43

Bayesian Lasso Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-52

Bayesian Stochastic Search Variable Selection . . . . . . . . . . . . . . . . . . . . 6-63

Replacing Removed Syntaxes of estimate . . . . . . . . . . . . . . . . . . . . . . . . . 6-73


Replace Removed Syntax When Estimating Analytical Marginal Posterior
..................................................... 6-74
Replace Removed Syntax When Estimating Numerical Marginal Posterior
..................................................... 6-75
Replace Removed Syntax When Estimating Conditional Posterior . . . . . . 6-77

Conditional Mean Models


7
Conditional Mean Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
Unconditional vs. Conditional Mean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
Static vs. Dynamic Conditional Mean Models . . . . . . . . . . . . . . . . . . . . . . 7-3
Conditional Mean Models for Stationary Processes . . . . . . . . . . . . . . . . . . 7-3

Specify Conditional Mean Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5


Default ARIMA Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5

x Contents
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Specify Nonseasonal Models Using Name-Value Pairs . . . . . . . . . . . . . . . . 7-7
Specify Multiplicative Models Using Name-Value Pairs . . . . . . . . . . . . . . 7-11
Specify Conditional Mean Model Using Econometric Modeler App . . . . . 7-14

Autoregressive Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-17


AR(p) Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-17
Stationarity of the AR Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-17

AR Model Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-19


Default AR Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-19
AR Model with No Constant Term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-19
AR Model with Nonconsecutive Lags . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-20
ARMA Model with Known Parameter Values . . . . . . . . . . . . . . . . . . . . . . 7-21
AR Model with t Innovation Distribution . . . . . . . . . . . . . . . . . . . . . . . . . 7-22
Specify AR Model Using Econometric Modeler App . . . . . . . . . . . . . . . . 7-22

Moving Average Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-26


MA(q) Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-26
Invertibility of the MA Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-26

MA Model Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-28


Default MA Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-28
MA Model with No Constant Term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-28
MA Model with Nonconsecutive Lags . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-29
MA Model with Known Parameter Values . . . . . . . . . . . . . . . . . . . . . . . . 7-30
MA Model with t Innovation Distribution . . . . . . . . . . . . . . . . . . . . . . . . 7-31
Specify MA Model Using Econometric Modeler App . . . . . . . . . . . . . . . . 7-31

Autoregressive Moving Average Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-35


ARMA(p,q) Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-35
Stationarity and Invertibility of the ARMA Model . . . . . . . . . . . . . . . . . . 7-35

ARMA Model Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-37


Default ARMA Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-37
ARMA Model with No Constant Term . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-37
ARMA Model with Known Parameter Values . . . . . . . . . . . . . . . . . . . . . . 7-38
Specify ARMA Model Using Econometric Modeler App . . . . . . . . . . . . . . 7-39

ARIMA Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-42

ARIMA Model Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-44


Default ARIMA Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-44
ARIMA Model with Known Parameter Values . . . . . . . . . . . . . . . . . . . . . 7-45
Specify ARIMA Model Using Econometric Modeler App . . . . . . . . . . . . . 7-45

Multiplicative ARIMA Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-49

Multiplicative ARIMA Model Specifications . . . . . . . . . . . . . . . . . . . . . . . 7-51


Seasonal ARIMA Model with No Constant Term . . . . . . . . . . . . . . . . . . . 7-51
Seasonal ARIMA Model with Known Parameter Values . . . . . . . . . . . . . . 7-52
Specify Multiplicative ARIMA Model Using Econometric Modeler App . . 7-53

Specify Multiplicative ARIMA Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-58

xi
ARIMA Model Including Exogenous Covariates . . . . . . . . . . . . . . . . . . . . 7-62
ARIMAX(p,D,q) Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-62
Conventions and Extensions of the ARIMAX Model . . . . . . . . . . . . . . . . . 7-62

ARIMAX Model Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-64


Create ARIMAX Model Using Name-Value Pairs . . . . . . . . . . . . . . . . . . . 7-64
Specify ARMAX Model Using Dot Notation . . . . . . . . . . . . . . . . . . . . . . . 7-65
Specify ARIMAX or SARIMAX Model Using Econometric Modeler App . . 7-66

Modify Properties of Conditional Mean Model Objects . . . . . . . . . . . . . . 7-70


Dot Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-70
Nonmodifiable Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-73

Specify Conditional Mean Model Innovation Distribution . . . . . . . . . . . . 7-75


About the Innovation Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-75
Choices for the Variance Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-75
Choices for the Innovation Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . 7-75
Specify the Innovation Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-76
Modify the Innovation Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-78

Specify Conditional Mean and Variance Models . . . . . . . . . . . . . . . . . . . . 7-80

Impulse Response Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-84

Plot the Impulse Response Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-85


Moving Average Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-85
Autoregressive Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-86
ARMA Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-87

Box-Jenkins Differencing vs. ARIMA Estimation . . . . . . . . . . . . . . . . . . . 7-89

Maximum Likelihood Estimation for Conditional Mean Models . . . . . . . 7-92


Innovation Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-92
Loglikelihood Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-92

Conditional Mean Model Estimation with Equality Constraints . . . . . . . 7-94

Presample Data for Conditional Mean Model Estimation . . . . . . . . . . . . 7-95

Initial Values for Conditional Mean Model Estimation . . . . . . . . . . . . . . 7-97

Optimization Settings for Conditional Mean Model Estimation . . . . . . . 7-99


Optimization Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-99
Conditional Mean Model Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . 7-101

Estimate Multiplicative ARIMA Model . . . . . . . . . . . . . . . . . . . . . . . . . . 7-102

Model Seasonal Lag Effects Using Indicator Variables . . . . . . . . . . . . . 7-105

Forecast IGD Rate from ARX Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-109

Estimate Conditional Mean and Variance Model . . . . . . . . . . . . . . . . . . 7-115

Choose ARMA Lags Using BIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-120

xii Contents
Infer Residuals for Diagnostic Checking . . . . . . . . . . . . . . . . . . . . . . . . . 7-123

Monte Carlo Simulation of Conditional Mean Models . . . . . . . . . . . . . . 7-128


What Is Monte Carlo Simulation? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-128
Generate Monte Carlo Sample Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-128
Monte Carlo Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-129

Presample Data for Conditional Mean Model Simulation . . . . . . . . . . . 7-130

Transient Effects in Conditional Mean Model Simulations . . . . . . . . . . 7-131

Simulate Stationary Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-132


Simulate AR Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-132
Simulate MA Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-136

Simulate Trend-Stationary and Difference-Stationary Processes . . . . . 7-140

Simulate Multiplicative ARIMA Models . . . . . . . . . . . . . . . . . . . . . . . . . 7-144

Simulate Conditional Mean and Variance Models . . . . . . . . . . . . . . . . . 7-147

Monte Carlo Forecasting of Conditional Mean Models . . . . . . . . . . . . . 7-151


Monte Carlo Forecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-151
Advantage of Monte Carlo Forecasting . . . . . . . . . . . . . . . . . . . . . . . . . 7-151

MMSE Forecasting of Conditional Mean Models . . . . . . . . . . . . . . . . . . 7-152


What Are MMSE Forecasts? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-152
How forecast Generates MMSE Forecasts . . . . . . . . . . . . . . . . . . . . . . 7-152
Forecast Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-153

Convergence of AR Forecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-155

Forecast Multiplicative ARIMA Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-159

Specify Presample and Forecast Period Data To Forecast ARIMAX Model


........................................................ 7-162

Forecast Conditional Mean and Variance Model . . . . . . . . . . . . . . . . . . . 7-166

Model and Simulate Electricity Spot Prices Using the Skew-Normal


Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-169

Conditional Variance Models


8
Conditional Variance Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
General Conditional Variance Model Definition . . . . . . . . . . . . . . . . . . . . . 8-2
GARCH Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3
EGARCH Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3
GJR Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4

xiii
Specify GARCH Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6
Default GARCH Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6
Specify Default GARCH Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7
Using Name-Value Pair Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8
Specify GARCH Model Using Econometric Modeler App . . . . . . . . . . . . . 8-11
Specify GARCH Model with Mean Offset . . . . . . . . . . . . . . . . . . . . . . . . . 8-13
Specify GARCH Model with Known Parameter Values . . . . . . . . . . . . . . . 8-14
Specify GARCH Model with t Innovation Distribution . . . . . . . . . . . . . . . 8-14
Specify GARCH Model with Nonconsecutive Lags . . . . . . . . . . . . . . . . . . 8-15

Specify EGARCH Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-17


Default EGARCH Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-17
Specify Default EGARCH Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-19
Using Name-Value Pair Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-19
Specify EGARCH Model Using Econometric Modeler App . . . . . . . . . . . . 8-22
Specify EGARCH Model with Mean Offset . . . . . . . . . . . . . . . . . . . . . . . . 8-24
Specify EGARCH Model with Nonconsecutive Lags . . . . . . . . . . . . . . . . . 8-24
Specify EGARCH Model with Known Parameter Values . . . . . . . . . . . . . . 8-25
Specify EGARCH Model with t Innovation Distribution . . . . . . . . . . . . . . 8-26

Specify GJR Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-28


Default GJR Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-28
Specify Default GJR Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-29
Using Name-Value Pair Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-30
Specify GJR Model Using Econometric Modeler App . . . . . . . . . . . . . . . . 8-33
Specify GJR Model with Mean Offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-35
Specify GJR Model with Nonconsecutive Lags . . . . . . . . . . . . . . . . . . . . . 8-35
Specify GJR Model with Known Parameter Values . . . . . . . . . . . . . . . . . . 8-36
Specify GJR Model with t Innovation Distribution . . . . . . . . . . . . . . . . . . 8-37

Modify Properties of Conditional Variance Models . . . . . . . . . . . . . . . . . 8-39


Dot Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-39
Nonmodifiable Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-41

Specify the Conditional Variance Model Innovation Distribution . . . . . . 8-44

Specify Conditional Variance Model For Exchange Rates . . . . . . . . . . . . 8-47

Maximum Likelihood Estimation for Conditional Variance Models . . . . 8-52


Innovation Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-52
Loglikelihood Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-52

Conditional Variance Model Estimation with Equality Constraints . . . . 8-54

Presample Data for Conditional Variance Model Estimation . . . . . . . . . . 8-55

Initial Values for Conditional Variance Model Estimation . . . . . . . . . . . . 8-57

Optimization Settings for Conditional Variance Model Estimation . . . . 8-58


Optimization Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-58
Conditional Variance Model Constraints . . . . . . . . . . . . . . . . . . . . . . . . . 8-60

Infer Conditional Variances and Residuals . . . . . . . . . . . . . . . . . . . . . . . . 8-62

Likelihood Ratio Test for Conditional Variance Models . . . . . . . . . . . . . . 8-66

xiv Contents
Compare Conditional Variance Models Using Information Criteria . . . . 8-69

Monte Carlo Simulation of Conditional Variance Models . . . . . . . . . . . . 8-72


What Is Monte Carlo Simulation? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-72
Generate Monte Carlo Sample Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-72
Monte Carlo Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-73

Presample Data for Conditional Variance Model Simulation . . . . . . . . . . 8-75

Simulate GARCH Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-76

Assess EGARCH Forecast Bias Using Simulations . . . . . . . . . . . . . . . . . . 8-81

Simulate Conditional Variance Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-86

Monte Carlo Forecasting of Conditional Variance Models . . . . . . . . . . . . 8-89


Monte Carlo Forecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-89
Advantage of Monte Carlo Forecasting . . . . . . . . . . . . . . . . . . . . . . . . . . 8-89

MMSE Forecasting of Conditional Variance Models . . . . . . . . . . . . . . . . . 8-90


What Are MMSE Forecasts? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-90
EGARCH MMSE Forecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-90
How forecast Generates MMSE Forecasts . . . . . . . . . . . . . . . . . . . . . . . 8-90

Forecast GJR Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-94

Forecast a Conditional Variance Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-97

Converting from GARCH Functions to Model Objects . . . . . . . . . . . . . . . 8-99

Multivariate Time Series Models


9
Vector Autoregression (VAR) Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3
Types of Stationary Multivariate Time Series Models . . . . . . . . . . . . . . . . 9-3
Lag Operator Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5
Stable and Invertible Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6
Models with Regression Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6
VAR Model Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7

Multivariate Time Series Data Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-10


Multivariate Time Series Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-10
Load Multivariate Economic Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-10
Multivariate Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12
Preprocess Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-14
Time Base Partitions for Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-15
Partition Multivariate Time Series Data for Estimation . . . . . . . . . . . . . . 9-17

Vector Autoregression (VAR) Model Creation . . . . . . . . . . . . . . . . . . . . . . 9-19


Create VAR Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19
Fully Specified Model Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-20
Model Template for Unrestricted Estimation . . . . . . . . . . . . . . . . . . . . . . 9-22

xv
Partially Specified Model Object for Restricted Estimation . . . . . . . . . . . 9-23
Display and Change Model Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-23
Select Appropriate Lag Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-26

Create and Adjust VAR Model Using Shorthand Syntax . . . . . . . . . . . . . . 9-29

Create and Adjust VAR Model Using Longhand Syntax . . . . . . . . . . . . . . 9-31

VAR Model Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-33


Preparing VAR Models for Fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-33
Fitting Models to Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-33
Examining the Stability of a Fitted Model . . . . . . . . . . . . . . . . . . . . . . . . 9-34

Convert VARMA Model to VAR Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-36

Fit VAR Model of CPI and Unemployment Rate . . . . . . . . . . . . . . . . . . . . 9-37

Fit VAR Model to Simulated Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-41

VAR Model Forecasting, Simulation, and Analysis . . . . . . . . . . . . . . . . . . 9-43


VAR Model Forecasting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-43
Data Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-45
Calculating Impulse Responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-45

Generate VAR Model Impulse Responses . . . . . . . . . . . . . . . . . . . . . . . . . 9-47

Compare Generalized and Orthogonalized Impulse Response Functions


......................................................... 9-51

Forecast VAR Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-59

Forecast VAR Model Using Monte Carlo Simulation . . . . . . . . . . . . . . . . 9-62

Forecast VAR Model Conditional Responses . . . . . . . . . . . . . . . . . . . . . . . 9-65

Implement Seemingly Unrelated Regression . . . . . . . . . . . . . . . . . . . . . . 9-69

Estimate Capital Asset Pricing Model Using SUR . . . . . . . . . . . . . . . . . . 9-74

Simulate Responses of Estimated VARX Model . . . . . . . . . . . . . . . . . . . . 9-77

Simulate VAR Model Conditional Responses . . . . . . . . . . . . . . . . . . . . . . 9-84

Simulate Responses Using filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-88

VAR Model Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-90

Convert from vgx Functions to Model Objects . . . . . . . . . . . . . . . . . . . . 9-104

Cointegration and Error Correction Analysis . . . . . . . . . . . . . . . . . . . . . 9-107


Integration and Cointegration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-107
Cointegration and Error Correction . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-107
The Role of Deterministic Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-108
Cointegration Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-109

xvi Contents
Determine Cointegration Rank of VEC Model . . . . . . . . . . . . . . . . . . . . 9-111

Identifying Single Cointegrating Relations . . . . . . . . . . . . . . . . . . . . . . . 9-113


The Engle-Granger Test for Cointegration . . . . . . . . . . . . . . . . . . . . . . . 9-113
Limitations of the Engle-Granger Test . . . . . . . . . . . . . . . . . . . . . . . . . . 9-113

Test for Cointegration Using the Engle-Granger Test . . . . . . . . . . . . . . 9-116

Estimate VEC Model Parameters Using egcitest . . . . . . . . . . . . . . . . . . 9-120

VEC Model Monte Carlo Forecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-123

Generate VEC Model Impulse Responses . . . . . . . . . . . . . . . . . . . . . . . . 9-131

Identifying Multiple Cointegrating Relations . . . . . . . . . . . . . . . . . . . . . 9-135

Test for Cointegration Using the Johansen Test . . . . . . . . . . . . . . . . . . . 9-136

Estimate VEC Model Parameters Using jcitest . . . . . . . . . . . . . . . . . . . . 9-138

Compare Approaches to Cointegration Analysis . . . . . . . . . . . . . . . . . . . 9-141

Testing Cointegrating Vectors and Adjustment Speeds . . . . . . . . . . . . . 9-144

Test Cointegrating Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-145

Test Adjustment Speeds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-147

Structural Change Models


10
Discrete-Time Markov Chains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2
What Are Discrete-Time Markov Chains? . . . . . . . . . . . . . . . . . . . . . . . . 10-2
Discrete-Time Markov Chain Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3

Markov Chain Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-8


Discrete-Time Markov Chain Object Framework Overview . . . . . . . . . . . 10-8
Markov Chain Analysis Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-11

Create and Modify Markov Chain Model Objects . . . . . . . . . . . . . . . . . . 10-17


Create Markov Chain from Stochastic Transition Matrix . . . . . . . . . . . . 10-17
Create Markov Chain from Random Transition Matrix . . . . . . . . . . . . . 10-19
Specify Structure for Random Markov Chain . . . . . . . . . . . . . . . . . . . . 10-20

Work with State Transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-23

Visualize Markov Chain Structure and Evolution . . . . . . . . . . . . . . . . . . 10-27

Determine Asymptotic Behavior of Markov Chain . . . . . . . . . . . . . . . . . 10-39

Identify Classes in Markov Chain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-47

xvii
Compare Markov Chain Mixing Times . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-50

Simulate Random Walks Through Markov Chain . . . . . . . . . . . . . . . . . . 10-59

Compute State Distribution of Markov Chain at Each Time Step . . . . . 10-66

State-Space Models
11
What Are State-Space Models? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3
Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3
State-Space Model Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-5

What Is the Kalman Filter? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-7


Standard Kalman Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-7
State Forecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8
Filtered States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8
Smoothed States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-9
Smoothed State Disturbances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-9
Forecasted Observations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-10
Smoothed Observation Innovations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-10
Kalman Gain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-11
Backward Recursion of the Kalman Filter . . . . . . . . . . . . . . . . . . . . . . . 11-11
Diffuse Kalman Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-12

Explicitly Create State-Space Model Containing Known Parameter Values


........................................................ 11-13

Create State-Space Model with Unknown Parameters . . . . . . . . . . . . . . 11-15


Explicitly Create State-Space Model Containing Unknown Parameters
.................................................... 11-15
Implicitly Create Time-Invariant State-Space Model . . . . . . . . . . . . . . . 11-16

Create State-Space Model Containing ARMA State . . . . . . . . . . . . . . . . 11-18

Implicitly Create State-Space Model Containing Regression Component


........................................................ 11-21

Implicitly Create Diffuse State-Space Model Containing Regression


Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-23

Implicitly Create Time-Varying State-Space Model . . . . . . . . . . . . . . . . 11-25

Implicitly Create Time-Varying Diffuse State-Space Model . . . . . . . . . . 11-27

Create State-Space Model with Random State Coefficient . . . . . . . . . . 11-30

Estimate Time-Invariant State-Space Model . . . . . . . . . . . . . . . . . . . . . . 11-32

Estimate Time-Varying State-Space Model . . . . . . . . . . . . . . . . . . . . . . . 11-35

xviii Contents
Estimate Time-Varying Diffuse State-Space Model . . . . . . . . . . . . . . . . . 11-39

Estimate State-Space Model Containing Regression Component . . . . . 11-43

Filter States of State-Space Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-45

Filter Time-Varying State-Space Model . . . . . . . . . . . . . . . . . . . . . . . . . . 11-48

Filter Time-Varying Diffuse State-Space Model . . . . . . . . . . . . . . . . . . . 11-53

Filter States of State-Space Model Containing Regression Component


........................................................ 11-59

Smooth States of State-Space Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-62

Smooth Time-Varying State-Space Model . . . . . . . . . . . . . . . . . . . . . . . . 11-65

Smooth Time-Varying Diffuse State-Space Model . . . . . . . . . . . . . . . . . . 11-71

Smooth States of State-Space Model Containing Regression Component


........................................................ 11-77

Simulate States and Observations of Time-Invariant State-Space Model


........................................................ 11-80

Simulate Time-Varying State-Space Model . . . . . . . . . . . . . . . . . . . . . . . 11-83

Simulate States of Time-Varying State-Space Model Using Simulation


Smoother . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-87

Estimate Random Parameter of State-Space Model . . . . . . . . . . . . . . . . 11-90

Forecast State-Space Model Using Monte-Carlo Methods . . . . . . . . . . . 11-97

Forecast State-Space Model Observations . . . . . . . . . . . . . . . . . . . . . . 11-103

Forecast Observations of State-Space Model Containing Regression


Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-106

Forecast Time-Varying State-Space Model . . . . . . . . . . . . . . . . . . . . . . 11-110

Forecast State-Space Model Containing Regime Change in the Forecast


Horizon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-114

Forecast Time-Varying Diffuse State-Space Model . . . . . . . . . . . . . . . . 11-119

Compare Simulation Smoother to Smoothed States . . . . . . . . . . . . . . 11-123

Rolling-Window Analysis of Time-Series Models . . . . . . . . . . . . . . . . . 11-128


Rolling-Window Analysis for Parameter Stability . . . . . . . . . . . . . . . . . 11-128
Rolling Window Analysis for Predictive Performance . . . . . . . . . . . . . . 11-128

Assess State-Space Model Stability Using Rolling Window Analysis . 11-131


Assess Model Stability Using Rolling Window Analysis . . . . . . . . . . . . 11-131

xix
Assess Stability of Implicitly Created State-Space Model . . . . . . . . . . 11-134

Choose State-Space Model Specification Using Backtesting . . . . . . . . 11-138

Functions
12

Appendices
A
Data Sets and Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2

Glossary

xx Contents
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
1

Getting Started

• “Econometrics Toolbox Product Description” on page 1-2


• “Econometric Modeling” on page 1-3
• “Econometrics Toolbox Model Objects, Properties, and Object Functions” on page 1-7
• “Stochastic Process Characteristics” on page 1-16
• “Bibliography” on page 1-22
1 Getting Started

Econometrics Toolbox Product Description


Model and analyze financial and economic systems using statistical methods

Econometrics Toolbox provides functions for modeling and analyzing time series data. It offers a wide
range of diagnostic tests for model selection, including tests for impulse analysis, unit roots and
stationarity, cointegration, and structural change. You can estimate, simulate, and forecast economic
systems using a variety of models, including, regression, ARIMA, state space, GARCH, multivariate
VAR and VEC, and switching models representing dynamic shifts in data. The toolbox also provides
Bayesian and Markov-based tools for developing time-varying models that learn from new data.

1-2
Econometric Modeling

Econometric Modeling
In this section...
“Model Selection” on page 1-3
“Econometrics Toolbox Features” on page 1-3

Model Selection
A probabilistic time series model is necessary for a wide variety of analysis goals, including
regression inference, forecasting, and Monte Carlo simulation. When selecting a model, aim to find
the most parsimonious model that adequately describes your data. A simple model is easier to
estimate, forecast, and interpret.

• Specification tests help you identify one or more model families that could plausibly describe the
data generating process.
• Model comparisons help you compare the fit of competing models, with penalties for complexity.
• Goodness-of-fit checks help you assess the in-sample adequacy of your model, verify that all model
assumptions hold, and evaluate out-of-sample forecast performance.

Model selection is an iterative process. When goodness-of-fit checks suggest model assumptions are
not satisfied—or the predictive performance of the model is not satisfactory—consider making model
adjustments. Additional specification tests, model comparisons, and goodness-of-fit checks help guide
this process.

Econometrics Toolbox Features


Modeling Features Related Functions
Questions
What is the • The conditional mean and variance models, regression • arima
dimension of my models with ARIMA errors, and Bayesian linear regression • bayeslm
response variable? models in this toolbox are for modeling univariate,
discrete-time data. • egarch

• Separate models are available for multivariate, discrete- • egcitest


time data, such as VAR and VEC models. • dssm
• State-space models support univariate or multivariate • garch
response variables. • gjr
• jcontest
• regARIMA
• ssm
• varm
Is my time series • Stationarity tests are available. If your data is not • arima
stationary? stationary, consider transforming your data. Stationarity is • i10test
the foundation of many time series models.
• kpsstest
• Or, consider using a nonstationary ARIMA model if there
is evidence of a unit root in your data. • lmctest

1-3
1 Getting Started

Modeling Features Related Functions


Questions
Does my time series • Unit root tests are available. Evidence in favor of a unit • adftest
have a unit root? root suggests your data is difference stationary. • arima
• You can difference a series with a unit root until it is • i10test
stationary, or model it using a nonstationary ARIMA
model. • pptest
• vratiotest
How can I handle • You can deseasonalize (seasonally adjust) your data. Use • arima
seasonal effects? seasonal filters or regression models to estimate the • regARIMA
seasonal component.
• Seasonal ARIMA models use seasonal differencing to
remove seasonal effects. You can also include seasonal
lags to model seasonal autocorrelation (both additively
and multiplicatively).
Is my data • Sample autocorrelation and partial autocorrelation • arima
autocorrelated? functions help identify autocorrelation. • autocorr
• Conduct a Ljung-Box Q-test to test autocorrelations at • fgls
several lags jointly.
• hac
• If autocorrelation is present, consider using a conditional
mean model. • lbqtest

• For regression models with autocorrelated errors, • parcorr


consider using FGLS or HAC estimators. If the error • regARIMA
model structure is an ARIMA model, consider using a
regression model with ARIMA errors.
What if my data is • Looking for autocorrelation in the squared residual series • archtest
heteroscedastic is one way to detect conditional heteroscedasticity. • egarch
(exhibits volatility • Engle’s ARCH test evaluates evidence against the null of • fgls
clustering)? independent innovations in favor of an ARCH model
alternative. • garch

• To model conditional heteroscedasticity, consider using a • gjr


conditional variance model. • hac
• For regression models that exhibit heteroscedastic errors,
consider using FGLS or HAC estimators.
Is there an • You can use a Student’s t distribution to model fatter tails • arima
alternative to a than a Gaussian distribution (excess kurtosis). • egarch
Gaussian innovation • You can specify a t innovation distribution for all
distribution for • garch
conditional mean and variance models, and ARIMA error
leptokurtic data? models in Econometrics Toolbox. • gjr

• You can estimate the degrees of freedom of the t • regARIMA


distribution along with other model parameters.

1-4
Econometric Modeling

Modeling Features Related Functions


Questions
How do I decide • You can compare nested models using misspecification • aicbic
between several tests, such as the likelihood ratio test, Wald’s test, or • lmtest
model fits? Lagrange multiplier test.
• lratiotest
• Information criteria, such as AIC or BIC, compare model
fit with a penalty for complexity. • waldtest
Do I have two or • The Johansen and Engle-Granger cointegration tests • egcitest
more time series that assess evidence of cointegration. • jcitest
are cointegrated? • Consider using the VEC model for modeling multivariate, • jcontest
cointegrated series.
• Also consider cointegration when regressing time series.
If present, it can introduce spurious regression effects.
What if I want to • ARIMAX, VARX, regression models with ARIMA errors, • arima
include predictor and Bayesian linear regression models are available in • bayeslm
variables? this toolbox.
• dssm
• State-space models support predictor data.
• ssm
• regARIMA
• varm
What if I want to • Regression models with ARIMA errors are available in this • bayeslm
implement toolbox. • fgls
regression, but the • Regress robustly using FGLS or HAC estimators.
classical linear • hac
model assumptions • Use Bayesian linear regression. • mvregress
might not apply? • For a series of examples on time series regression • regARIMA
techniques that illustrate common principles and tasks in
time series regression modeling, see Econometrics
Toolbox Examples.
• For more regression options, see Statistics and Machine
Learning Toolbox™ documentation.
What if observations Standard, linear state-space modeling is available in this • dssm
of a dynamic process toolbox. • ssm
include
measurement error?

See Also

Related Examples
• “Box-Jenkins Model Selection” on page 3-4
• “Detect Autocorrelation” on page 3-15
• “Detect ARCH Effects” on page 3-22
• “Unit Root Tests” on page 3-32
• “Time Series Regression I: Linear Models”

1-5
Random documents with unrelated
content Scribd suggests to you:
Toda a cousa negra é preta,
Papel é de trapos velhos,
Olhos do. são besbelhos,
Bordão de velho é moleta:
O mascarado é careta,
Tabaco é fumo pizado,
Peixe de moquem é assado,
O pirão duro é taipeiro,
Mareta em mar é carneiro,
Rapadura é mel coalhado.

Quem não tem juizo é tolo,


Quem morre fica sem vida,
Perna delgada é comprida,
Reposto de jogo é bôlo:
Negro ladino é creoulo,
Sebo de vacca é gordura,
Figado e bofes forçura,
Manteiga é nata de leite,
É oleo todo o azeite,
E todo o vigario é cura.

Sem a lingua não se falla,


Quem não come morre á fome,
A empinge toda come,
O surrão de couro é mala:
Palalá é... rala,
O tatú tem casca dura,
O salgado faz secura,
Arroz sem casca é pilado,
As sôpas são pão molhado,
O ferrolho é fechadura.
Os bancos servem de assento,
Leicenço tem carnegão,
Homem de villa é villão,
As pennas voam com vento:
O adro da egreja é bento,
A camisa é roupa branca,
Pau que fecha a porta é tranca,
Tem ventas todo o nariz,
Toda a batata é raiz,
A cara feia é carranca.

A farinha do Brazil
Primeiro foi mandioca,
Milho estalado é pipoca,
O gato todo é subtil:
Tres barris e um barril
Enchem todos uma pipa,
Não se faz casa sem ripa,
Ou vara com seu sipó,
Quem não tem ninguem é só,
Todo o bom cavallo esquipa.

Sempre é boa a espada nova,


Mas a velha é saramago,
Homem que gagueja é gago,
Toda a banana é pacova:
Quem morreu vai para a cova,
Olho do .. é mataco:
Agua de flor do sovaco
Deu sempre vida a um morto,
O que tem um olho é torto,
Guariba não é macaco.
Solimão e rozalgar
Matam, porque são veneno,
Grande doutor foi Galeno,
O fazer curso é purgar:
Fallar por solfa é cantar,
Na botica ha trementina,
Criança femea é menina,
.... ..... ..
Mascarado é papa-angú,
Oleo de pinha é resina.

Tabaco pobre é macaya.


Ave sem penna é morcego,
Toda a agua do Mondego
Desemboca pela praia:
Quem é mulher veste saia,
Os homens vestem calções,
Têm os negros seus bordões,
E cinco palmos a vara,
Tantas arrobas de tara
Tem cada um dos caixões.

Aguardente é geribita,
...dura é .....,
A ...... é pismam
E todo o listão é fita:
A colera logo irrita,
Ganhamú é caranguejo,
Não é sancto São Serejo,
Mas no ceu moram os sanctos;
Todas as casas têm cantos,
Do leite se faz o queijo.
Nos trunfos ha basto e sota,
Dará cartas quem foi mão,
A mulher tem seu pampam,
Pelo pé se calça a bota:
Quem não tem voto não vota,
O que deu cartas é pé,
O escrivão porta por fé,
Obra grosseira é do Porto,
Todo o defuncto está morto,
Vaza e mais enche a maré.

Almorreimas é quentura,
As redes têm seus cadilhos,
Zebedeu foi pae de filhos,
Quem morreu, já não tem cura:
........................
.......................
Jogo de trez é a espadilha,
Ao de dous lhe chamam zanga,
Camisa tem sua manga,
Não ha navio sem quilha.

Faz pasteis o pasteleiro,


Toda a virgem é donzella,
No Brazil ha já cannella,
Todo o frade é redoleiro.
Bate no ferro o ferreiro
E o marido na mulher,
Porque um e mais outro quer,
E gostam da tal asneira,
E não ha mister peneira
Quem farinha não tiver
Todas as côres são tintas,
Duro pau é supipira,
Quem é manso não tem ira,
Do zengá se fazem cintas:
Portugal tem ricas quintas,
E cada uma tem seu dono,
O que quer dormir tem somno,
O que dorme está dormindo,
O que veio tem já vindo
E toda a solfa tem tono.

Ha pelo entrudo filhozes,


Não ha carne na quaresma,
É todo o fedelho—lesma,
No poder os reis são crozes:
Quem tem dente come nozes,
O que quebra está quebrando,
Quem come está manducando,
O que corre vai correndo,
O que bebe está bebendo
E quem joga está jogando.

Dico vere veritates,


Crede mihi, vou fallando,
E quanto mais for andando,
Magis dicam asnitates:
No Recife ha mil mascates
Sobreposse mercadores,
Geme quem padece dores,
É o ... todo vento,
Freiras moram no convento,
E quem quer tem seus amores.
As madrinhas são comadres,
Chocolate tem cacau
Passa dez não é pacau,
Clerigos todos são padres:
É cego não ver por grades,
O limão todo é azedo,
O que tem pavor tem medo,
É boa a mulher que ....,
Não é boa a ... mole,
A pedra grande é penedo.

Quem tem boca vai a Roma,


Quem tem sangue faz chouriços,
As abelhas têm cortiços,
A zabelê sua coma:
O ruim assucar é broma,
A canada tem quartilho,
Não tem pé a mão de milho,
Coruja não é canario,
Livro velho é calendario,
O maná não é quintilho.

É o memento lembrança
Das almas do outro mundo,
A panella tem seu fundo,
E quem herdou teve herança:
É zombar estar de chança,
Muitos filhos tem Antonio
Nunes, do seu matrimonio,
Que dos outros não sabemos;
Aposto que já entendemos
Em que é purga o antimonio.
Os sapatos levam sola,
A carne de boi é vacca,
A ... em criança é caca,
É redonda toda a bola:
Passarinho na gaiola
Está prezo na cadeia,
O gatinho bravo meia,
São frades os franciscanos,
O homem velho já tem annos,
A formosa não é feia.

Quem vai só—vai solitario,


Quem tem fome excusa môlho,
O ... tem no meio ôlho,
Tem a mulher ordinario:
Chama-se a pessa Calvario;
Cidades tem Portugal,
Ouro é o que ouro val,
Pratos de côr tem rabique,
Não se faz renda sem pique,
Todo o salgado tem sal.

Peccados mortaes são septe,


E dez são os mandamentos,
Septe são os Sacramentos,
O estojo tem canivete:
Os frades com seu topete
Não pagam luguel de cazas,
Os anjinhos levam azas,
Cães de fila todos mordem,
Sacramento sexto é ordem,
Ganhou o que fez mais vazas.
Estas pois e outras verdades,
Amigo, que aqui vos digo,
São as de que sou amigo;
.........................
O mais são só asnidades
D’esses que dizem rodeios,
Porque só por estes meios
Se falla bem portuguez;
Tudo o mais é ser francez,
E trazer na boca freios.
JUSTIÇA
QUE FAZ O P. NA HONRA HYPOCRITA PELOS ESTRAGOS QUE
ANDA FAZENDO NA VERDADEIRA HONRA

Uma cidade tão nobre[2],


Uma gente tão honrada,
Veja-se um dia louvada
Desde o mais rico ao mais pobre:
Cada pessoa o seu cobre;
Mas si o diabo me atiça,
Que indo a fazer-lhes justiça,
Algum saia a justiçar,
Não me poderão negar
Que por direito e por lei
Esta é a justiça que manda El-Rei.

[2] Lisboa.

O fidalgo de solar
Se dá por envergonhado
De um tostão pedir prestado
Para o ventre sustentar:
Diz que antes o quer furtar,
Por manter a negra honra,
Que passar pela deshonra
De que lh’o neguem talvez:
Mas si o vires nas galés
Com honras de vice-rei,
Esta é a justiça que manda El-Rei.
A donzella embiocada,
Mal trajada, peior comida,
Antes quer na sua vida
Ter saia que ser honrada:
É publica amancebada
Por manter a negra honrinha,
E si lh’o chama a visinha,
E lh’o ouve a clerizia,
Dão com ella na enxovia,
E paga a pena da lei:
Esta é a justiça que manda El-Rei.

A casada com adorno,


E o marido mal vestido,
Crêde que este tal marido
Pentêa monho de ...
Si disser pelo contorno
Que si soffre a frei Thomaz,
Por manter a honrinha o faz;
Esperae pela pancada,
Que com carocha pintada
De Angola ha de ser vis-rei:
Esta é a justiça que manda El-Rei.

Os lettrados peralvilhos,
Citando o mesmo doutor
A favor do réu e auctor,
Comem de ambos os carrilhos:
Si se diz pelos corrilhos
Sua prevaricação,
A desculpa que vos dão
É a honra de seus parentes;
E entonces os requerentes
Fogem d’esta infame grei:
Esta é a justiça que manda El-Rei.
O clerigo julgador,
Que’as causas julga sem pejo,
Não reparando que eu vejo
Que erra a lei e erra o doutor:
Quando vem do monsenhor
A sentença revogada,
Por saber que foi comprada
Pelo gimbo ou pelo abraço,
Responde o padre madraço:
Minha honra é minha lei;
Esta é a justiça que manda El-Rei.

O mercador avarento
Quando a sua conta extende,
No que compra e no que vende
Tira duzentos por cento:
Não é elle tão jumento
Que não saiba que em Lisboa
Se lhe ha de dar na gamboa;
Mas comido já o dinheiro,
Diz que a honra está primeiro,
E que honrado a toda a lei.
Esta é a justiça que manda El-Rei.

A viuva auctorisada,
Que não possue vintem,
Porque o marido de bem
Deixou a casa empenhada:
Alli entra a fradalhada,
Qual formiga em correição,
Dizendo que á casa vão
Manter a honra da casa;
Si a vires arder em brasa,
Que ardeu a honra entendei.
Esta é a justiça que manda El-Rei.
O Adonis da manhãa,
O Cupido em todo o dia,
Que anda correndo a coxia
Com recadinhos á irmãa,
E si lhe cortam a lãa
Diz que anda naquelle andar
Pela honra conservar
Bem tractado e bem vestido;
Eu o verei tão despido,
Que até as costas lhe verei.
Esta é a justiça que manda El-Rei.

Si vires um dom abbade


Sôbre o pulpito cioso,
Não lhe chameis religioso,
Chamae-lhe embora de frade:
E si o tal Paternidade
Rouba as rendas do convento,
Para acudir ao sustento
Da ..., como da peita
Com que livra de suspeita
Do Geral, do Vice-Rei,
Esta é a justiça que manda El-Rei.
DIALOGO
ENTRE O DEMONIO E A ALMA

Cantavam naquelle tempo os chulos da Bahia certas


cantigas por uma toada triste que rematava, dizendo:
«Banguê, que será de ti?» Mas outros mais piedosos
reduziam a mesma canção ao Divino finalizando assim: «Meu
Deus, que será de mim?» E o P. entre o temporal e o eterno
de uma o outra chularia introduziu uma alma christãa
resistindo ás tentações do demonio com a glosa de ambos os
extremos:

Meu Deus, que será de mim?


Banguê, que será de ti?

Alma—Si o descuido do futuro


E a lembrança do presente
É em mim tão continente,
Como do mundo murmuro?
Será porque não procuro
Temer do principio o fim?
Será porque sigo assim
Cegamente o meu peccado?
Mas si me vir condemnado,
Meu Deus, que será de mim?
Dem.—Si não segues meus enganos
E meus deleites não segues,
Temo que nunca socegues
No florido de teus annos:
Vê como vivem ufanos
Os descuidados de si:
Canta, baila, folga e ri;
Porque os que não se alegraram,
Dous infernos militaram:
Banguê, que será de ti?

Alma—Si para o céu me creastes,


Meu Deus, á imagem vossa,
Como é possivel que possa
Fugir-vos, pois me buscastes?
E si para mim tractastes
O melhor remedio e fim;
Eu, como ingrato Caim,
D’este bem tão esquecido,
Tendo-vos tão offendido,
Meu Deus, que será de mim?

Dem.—Todo o cantar allivia


E todo o folgar alegra,
Toda a branca, parda e negra
Tem sua hora de folia:
Só tu na melancolia
Tens allivio? Canta aqui
E torna a cantar alli,
Que d’esse modo o practicam
Os que alegres prognosticam
Banguê, que será de ti?
Alma—Eu para vós—offensor,
Vós para mim—derretido?
Eu—de vós tão esquecido,
E vós de mim—Redemptor?
Ai como sinto, Senhor,
De tão mau principio o fim,
Si me não valeis assim,
Como áquelle que na cruz
Feristes com vossa luz?
Meu Deus, que será de mim?

Dem.—Como assim na flor dos annos


Colhes o fructo amargoso?
Não vês que todo o penoso
É causa de muitos damnos?
Deixa, deixa desenganos,
Segue os deleites, que aqui
Te offereço, porque alli
Os mais que cantando vão,
Dizem na triste canção:
Banguê, que será de ti?

Alma—Quem vos offendeu, Senhor?


Uma creatura vossa?
Como é possivel que eu possa
Offender meu Creador?
Triste de mim peccador,
Si a gloria que daes sem fim,
Perdida num Serafim
Se perder em mim tambem?
Si eu perder tamanho bem,
Meu Deus, que será de mim?
Dem.—Si a tua culpa merece
Do teu Deus toda a esquivança,
Folga no mundo e descança
Que o arrepender aborrece:
Si o peccado te entristece,
Como já em outros vi,
Te prometto desde aqui
Que os mais da tua facção
E tu no inferno dirão:
Banguê, que será de ti?
CONTRA
OS INGRATOS MURMURADORES DO BEM QUE
ACTUALMENTE RECEBEM DA MÃE UNIVERSAL, QUE OS
AFFAGA, SE QUEIXA A BAHIA, CONFESSANDO-SE DAS
CULPAS, QUE LHE DÃO, PELOS PRECEITOS DO DECALOGO

ROMANCE

Já que me põem a tormento


Murmuradores noviços,
Carregando sobre mim
Suas culpas e delictos;
Por credito do meu nome,
E não por temer castigo,
Confessar quero os peccados
Que faço, e que patrocino.
E si alguem tiver a mal
Descobrir este sigillo,
Não me infame que eu serei
Pedra em poço, ou seixo em rio.
Sabei, céu, sabei estrellas,
Escutae, flores e lirios,
Montes, serras, peixes, aves,
Lua, sol, mortos e vivos,
Que não ha nem póde haver,
Desde o Sul ao Norte frio,
Cidade com mais maldades,
Nem provincia com mais vicios,
Do que sou eu, porque em mim
Recopilados e unidos
Estão junctos quantos têm
Mundos e reinos distinctos.
Tenho Turcos, tenho Persas,
Homens de nação impios,
Mogores, Armenios, Gregos,
Infieis e outros gentios.
Tenho ousados Mermidonios,
Tenho Judeus, tenho Assyrios,
E de quantas seitas ha
Muito tenho, e muito abrigo.
E sinão digam aquelles
Presados de vingativos,
Que sanctidade têm mais
Que um Turco e que um Mohabito!
Digam idolatras falsos,
Que estou vendo de continuo
Adorarem ao dinheiro,
Gula, ambição e amoricos!
Quantos com capa christãa
Professam o judaismo,
Mostrando hypocritamente
Devoção á Lei de Christo!
Quantos com pelle de ovelha
São lobos enfurecidos,
Ladrões, falsos, aleivosos,
Embusteiros e assassinos!
Estes por seu mau viver,
Sempre pessimo e nocivo,
São os que me accusam damnos,
E põem labéos inauditos.
Mas o que mais me atormenta
É ver que os contemplativos,
Sabendo a minha innocencia,
Dão a seu mentir ouvidos.
Até os mesmos culpados
Têm tomado por capricho,
Para mais me difamarem
Pôrem pela praça escriptos,
Onde escrevem sem vergonha,
Não só brancos, mas mestiços,
Que para os bons sou inferno,
E para os mais paraizo.
Oh velhacos insolentes,
Ingratos, mal procedidos!
Si eu sou essa que dizeis,
Porque não largais meu sitio?
Porque habitais em tal terra,
Podendo em melhor abrigo?
Eu pego em vós? eu vos rogo?
Respondei: dizei, maldictos?
Mandei acaso chamar-vos,
Ou por carta, ou por aviso?
Não viestes para aqui
Por vosso livre alvedrio?
A todos não dei entrada,
Tractando-vos como a filhos?
Que razão tendes agora
De difamar-me atrevidos?
Meus males de quem procedem?
Não é de vós? claro é isso:
Que eu não faço mal a nada
Por ser terra e matto arisco.
Si me lançais má semente
Como quereis fructo limpo?
Lançae-a boa, e vereis
Si vos dou cachos optimos.
Eu me lembro que algum tempo,
Isto foi no meu principio,
A semente que me davam
Era boa e de bom trigo.
Por cuja causa meus campos
Produziam pomos lindos,
De que ainda se conservam
Alguns remotos indicios.
Mas depois que vós viestes
Carregados, como ouriços,
De sementes invejosas
E legumes de maus vicios;
Logo declinei comvosco,
E tal volta tenho tido,
Que o que produzia rozas
Hoje só produz espinhos.
Mas para que se conheça
Si fallo verdade ou minto,
E quanto os vossos enganos
Têm difamado meu brio:
Confessar quero de plano
O que encubro por servir-vos,
E saiba quem me moteja
Os premios que ganho nisso.
Já que fui tão pouco attenta,
Que a luz da razão e o sizo
Não só quiz cegar por gosto,
Mas ser do mundo ludibrio.
Vós me ensinastes a ser
Das inconstancias archivo,
Pois nem as pedras que gero
Guardam fé aos edificios.
Por vosso respeito dei
Campo franco e grande auxilio
Para que se quebrantassem
Os mandamentos divinos.
Cada um por suas obras
Verá contra quem me explico,
Sem andar excogitando
Para quem se aponta o tiro.

PRECEITO I

Que de quilombos que tenho.


Com mestres superlativos,
Nos quaes se ensina de noite
Os calundús e feitiços!

You might also like