Postestimation commands predict estat Remarks and examples Stored results Methods and formulas

Similar documents
Title. Description. stata.com. Special-interest postestimation commands. asmprobit postestimation Postestimation tools for asmprobit

Estimating Markov-switching regression models in Stata

Description Syntax for predict Menu for predict Options for predict Remarks and examples Methods and formulas References Also see

Title. Description. Remarks and examples. stata.com. stata.com. Introduction to DSGE models. intro 1 Introduction to DSGEs and dsge

Description Syntax for predict Menu for predict Options for predict Remarks and examples Methods and formulas References Also see

Empirical Asset Pricing

point estimates, standard errors, testing, and inference for nonlinear combinations

ECON/FIN 250: Forecasting in Finance and Economics: Section 8: Forecast Examples: Part 1

Dynamic stochastic general equilibrium models in Stata 15

Introduction to Markov-switching regression models using the mswitch command

Title. Description. Special-interest postestimation commands. xtmelogit postestimation Postestimation tools for xtmelogit

Introduction to Econometrics

options description set confidence level; default is level(95) maximum number of iterations post estimation results

STATA LINEARIZED DYNAMIC STOCHASTIC GENERAL EQUILIBRIUM REFERENCE MANUAL

The following postestimation commands are of special interest after discrim qda: The following standard postestimation commands are also available:

Unemployment Rate Example

Title. Description. var intro Introduction to vector autoregressive models

A Comparison of Business Cycle Regime Nowcasting Performance between Real-time and Revised Data. By Arabinda Basistha (West Virginia University)

Postestimation commands predict estat Remarks and examples Stored results Methods and formulas

Title. Syntax. Description. Options. stata.com. forecast estimates Add estimation results to a forecast model

Vector Autoregressive Model. Vector Autoregressions II. Estimation of Vector Autoregressions II. Estimation of Vector Autoregressions I.

Why Has the U.S. Economy Stagnated Since the Great Recession?

MLMED. User Guide. Nicholas J. Rockwood The Ohio State University Beta Version May, 2017

ARIMA Modelling and Forecasting

News Shocks: Different Effects in Boom and Recession?

Testing for Regime Switching in Singaporean Business Cycles

Vector Autogregression and Impulse Response Functions

4. MA(2) +drift: y t = µ + ɛ t + θ 1 ɛ t 1 + θ 2 ɛ t 2. Mean: where θ(l) = 1 + θ 1 L + θ 2 L 2. Therefore,

Testing for spectral Granger causality

Title. Description. Quick start. Menu. stata.com. xtcointtest Panel-data cointegration tests

Non-Markovian Regime Switching with Endogenous States and Time-Varying State Strengths

7 Introduction to Time Series

Lecture#17. Time series III

Measures of Fit from AR(p)

A Horse-Race Contest of Selected Economic Indicators & Their Potential Prediction Abilities on GDP

Testing methodology. It often the case that we try to determine the form of the model on the basis of data

Syntax Description Options Remarks and examples Stored results Methods and formulas References Also see

Dynamic Panels. Chapter Introduction Autoregressive Model

Answer all questions from part I. Answer two question from part II.a, and one question from part II.b.

Switching Regime Estimation

Case of single exogenous (iv) variable (with single or multiple mediators) iv à med à dv. = β 0. iv i. med i + α 1

Econometría 2: Análisis de series de Tiempo

Comment on A Comparison of Two Business Cycle Dating Methods. James D. Hamilton

ARDL Cointegration Tests for Beginner

Description Remarks and examples Also see

10) Time series econometrics

G. S. Maddala Kajal Lahiri. WILEY A John Wiley and Sons, Ltd., Publication

Scenario 5: Internet Usage Solution. θ j

Outline. 11. Time Series Analysis. Basic Regression. Differences between Time Series and Cross Section

7 Introduction to Time Series Time Series vs. Cross-Sectional Data Detrending Time Series... 15

Description Quick start Menu Syntax Options Remarks and examples Stored results Methods and formulas Acknowledgment References Also see

Univariate ARIMA Models

ECON 312 FINAL PROJECT

CENTRE FOR APPLIED MACROECONOMIC ANALYSIS

Time Series Analysis. James D. Hamilton PRINCETON UNIVERSITY PRESS PRINCETON, NEW JERSEY

AR, MA and ARMA models

Instrumental Variables, Simultaneous and Systems of Equations

IDENTIFYING BUSINESS CYCLE TURNING POINTS IN CROATIA

Multivariate Markov Switching With Weighted Regime Determination: Giving France More Weight than Finland

xtdpdqml: Quasi-maximum likelihood estimation of linear dynamic short-t panel data models

10. Time series regression and forecasting

9) Time series econometrics

Implementing Conditional Tests with Correct Size in the Simultaneous Equations Model

Box-Jenkins ARIMA Advanced Time Series

OLSQ. Function: Usage:

TIME SERIES ANALYSIS AND FORECASTING USING THE STATISTICAL MODEL ARIMA

Econometrics. 9) Heteroscedasticity and autocorrelation

Autoregressive and Moving-Average Models

LATVIAN GDP: TIME SERIES FORECASTING USING VECTOR AUTO REGRESSION

Description Remarks and examples Also see

Oil price and macroeconomy in Russia. Abstract

Markov-Switching Models with Endogenous Explanatory Variables. Chang-Jin Kim 1

Modelling and forecasting of offshore wind power fluctuations with Markov-Switching models

Financial Econometrics

Description Remarks and examples Reference Also see

Lecture 9: Markov Switching Models

The following postestimation commands are of special interest after ca and camat: biplot of row and column points

Problem Set 2: Box-Jenkins methodology

GMM Estimation in Stata

Confidence intervals for the variance component of random-effects linear models

Working with Stata Inference on the mean

Author: Yesuf M. Awel 1c. Affiliation: 1 PhD, Economist-Consultant; P.O Box , Addis Ababa, Ethiopia. c.

Title. Description. Remarks and examples. stata.com. stata.com. Variable notation. methods and formulas for sem Methods and formulas for sem

A Robust Test for Weak Instruments in Stata

Forecasting the unemployment rate when the forecast loss function is asymmetric. Jing Tian

ECON2228 Notes 10. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 48

Chapter 14: Time Series: Regression & Forecasting

Time Series Analysis -- An Introduction -- AMS 586

Inference in VARs with Conditional Heteroskedasticity of Unknown Form

Econ 423 Lecture Notes

Identifying the Monetary Policy Shock Christiano et al. (1999)

Longitudinal Data Analysis Using Stata Paul D. Allison, Ph.D. Upcoming Seminar: May 18-19, 2017, Chicago, Illinois

Introduction to Eco n o m et rics

Mixing the Ingredients: Business cycles, Technology Shocks, Productivity Slowdown and the Great Moderation

Economics 471: Econometrics Department of Economics, Finance and Legal Studies University of Alabama

Using the same data as before, here is part of the output we get in Stata when we do a logistic regression of Grade on Gpa, Tuce and Psi.

ECON2228 Notes 10. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 54

Are recoveries all the same?

Introduction to Time Series Regression and Forecasting

Likelihood Ratio Test and Information Criteria for Markov Switching Var Models: An Application to the Italian Macroeconomy

Transcription:

Title stata.com mswitch postestimation Postestimation tools for mswitch Postestimation commands predict estat Remarks and examples Stored results Methods and formulas References Also see Postestimation commands The following postestimation commands are of special interest after mswitch: Command Description estat transition display transition probabilities in a table estat duration display expected duration of states in a table The following standard postestimation commands are also available: Command Description contrast contrasts and ANOVA-style joint tests of estimates estat ic Akaike s and Schwarz s Bayesian information criteria (AIC and BIC) estat summarize summary statistics for the estimation sample estat vce variance covariance matrix of the estimators (VCE) estimates cataloging estimation results forecast dynamic forecasts and simulations lincom point estimates, standard errors, testing, and inference for linear combinations of coefficients lrtest likelihood-ratio test nlcom point estimates, standard errors, testing, and inference for nonlinear combinations of coefficients predict predictions, residuals, influence statistics, and other diagnostic measures predictnl point estimates, standard errors, testing, and inference for generalized predictions pwcompare pairwise comparisons of estimates test Wald tests of simple and composite linear hypotheses testnl Wald tests of nonlinear hypotheses 1

2 mswitch postestimation Postestimation tools for mswitch predict Description for predict predict creates new variables containing predictions such as predicted values, probabilities, residuals, and standardized residuals. Menu for predict Statistics > Postestimation Syntax for predict predict [ type ] { stub* newvarlist } [ if ] [ in ] [, statistic options ] statistic Main yhat xb pr residuals rstandard Description predicted values; the default equation-specific predicted values; default is predicted values for the first equation compute probabilities of being in a given state; default is one-step-ahead probabilities residuals standardized residuals These statistics are available both in and out of sample; type predict... if e(sample)... if wanted only for the estimation sample. options Options smethod(method) rmse(stub* newvarlist) dynamic(time constant) equation(eqnames) Description method for predicting unobserved states; specify one of onestep, filter, or smooth; default is smethod(onestep) put estimated root mean squared errors of predicted statistics in new variables begin dynamic forecast at specified time names of equations for which predictions are to be made method onestep filter smooth Description predict using past information predict using past and contemporaneous information predict using all sample information

mswitch postestimation Postestimation tools for mswitch 3 Options for predict Main yhat, xb, pr, residuals, and rstandard specify the statistic to be predicted. yhat, the default, calculates the weighted and state-specific linear predictions of the observed variables. xb calculates the equation-specific linear predictions of the observed variables. pr calculates the probabilities of being in a given state. residuals calculates the residuals in the equations for observable variables. rstandard calculates the standardized residuals, which are the residuals normalized to have unit variances. Options smethod(method) specifies the method for predicting the unobserved states; smethod(onestep), smethod(filter), and smethod(smooth) allow different amounts of information on the dependent variables to be used in predicting the states at each time period. smethod() may not be specified with xb. smethod(onestep), the default, causes predict to estimate the states at each time period using previous information on the dependent variables. The nonlinear filter is performed on previous periods, but only the one-step predictions are made for the current period. smethod(filter) causes predict to estimate the states at each time period using previous and contemporaneous data by using the nonlinear filter. The filtering is performed on previous periods and the current period. smethod(smooth) causes predict to estimate the states at each time period using all sample data by using the smoothing algorithm. rmse(stub* newvarlist) puts the root mean squared errors of the predicted statistics into the specified new variables. The root mean squared errors measure the variances due to the disturbances but do not account for estimation error. dynamic(time constant) specifies when predict starts producing dynamic forecasts. The specified time constant must be in the scale of the time variable specified in tsset, and the time constant must be inside a sample for which observations on the dependent variables are available. For example, dynamic(tq(2014q4)) causes dynamic predictions to begin in the fourth quarter of 2014, assuming that the time variable is quarterly; see [D] datetime. If the model contains exogenous variables, they must be present for the whole predicted sample. dynamic() may not be specified with xb, pr, residuals, or rstandard. equation(eqnames) specifies the equations for which the predictions are to be calculated. If you do not specify equation() or stub*, the results are the same as if you had specified the name of the first equation for the predicted statistic. equation() may be specified with xb only. You specify a list of equation names, such as equation(income consumption) or equation(factor1 factor2), to identify the equations. equation() may not be specified with stub*.

estat 4 mswitch postestimation Postestimation tools for mswitch Description for estat estat transition displays all of the transition probabilities in tabular form. estat duration computes the expected duration that the process spends in each state and displays the results in a table. Menu for estat Statistics > Postestimation Syntax for estat Display transition probabilities in a table estat transition [, level(#) ] Display expected duration of states in a table estat duration [, level(#) ] Option for estat level(#) specifies the confidence level, as a percentage, for confidence intervals. The default is level(95) or as set by set level; see [U] 20.8 Specifying the width of confidence intervals. Remarks and examples Remarks are presented under the following headings: One-step predictions Dynamic predictions Model fit and state predictions stata.com We assume that you have already read [TS] mswitch. In this entry, we illustrate some of the features of predict after using mswitch to estimate the parameters of a Markov-switching model. All the predictions after mswitch depend on the unobserved states, which are estimated recursively using a nonlinear filter. Changing the sample can alter the state estimates, which can change all other predictions. One-step predictions One-step predictions in a Markov-switching model are the forecasted values of the dependent variable using one-step-ahead predicted probabilities.

mswitch postestimation Postestimation tools for mswitch 5 Example 1: One-step predictions for a series In example 3 of [TS] mswitch, we estimated the parameters of a Markov-switching dynamic regression for the federal funds rate fedfunds as a function of its lag, the output gap ogap, and inflation.. use http://www.stata-press.com/data/r15/usmacro (Federal Reserve Economic Data - St. Louis Fed). mswitch dr fedfunds, switch(l.fedfunds ogap inflation) (output omitted ) We obtain the one-step predictions for the dependent variable using the default settings for predict. The predictions are stored in the new variable fedf.. predict fedf (option yhat assumed; predicted values) Next, we graph the actual values, fedfunds, and predicted values, fedf, using tsline. We change the label for fedf to Predicted values ; see [TS] tsline.. tsline fedfunds fedf, legend(label(2 "Predicted values")) 0 5 10 15 20 1950q1 1960q1 1970q1 1980q1 1990q1 2000q1 2010q1 date (quarters) Federal funds rate Predicted values The graph shows that one-step-ahead predictions account for large swings in the federal funds rate. Example 2: State-specific one-step predictions Continuing example 1, we may also wish to obtain state-specific predictions. This allows us to compare the predictions obtained for different states. Note that this time, we specify fedf* rather than fedf so that predict generates two state-specific predictions with the prefix fedf instead of a single weighted prediction. Also note that the predicted values obtained in example 1 are the weighted average of the state-specific predictions, the weights being the one-step-ahead probabilities.

6 mswitch postestimation Postestimation tools for mswitch. predict fedf* (option yhat assumed; predicted values). tsline fedf1 fedf2, legend(label(1 "State 1 predictions") > label(2 "State 2 predictions")) 0 5 10 15 20 1950q1 1960q1 1970q1 1980q1 1990q1 2000q1 2010q1 date (quarters) State 1 predictions State 2 predictions The graph shows that, as expected, the predicted values of fedfunds are higher in state 2, the high-interest rate state, than in state 1, the moderate-interest rate state. Dynamic predictions Dynamic predictions are out-of-sample forecasted values of the dependent variable using one-stepahead probabilities. Example 3: Dynamic predictions for Markov-switching autoregression In example 6 of [TS] mswitch, we estimated the parameters of a Markov-switching autoregression for the U.S. real gross national product as a function of its own lags.. use http://www.stata-press.com/data/r15/rgnp, clear (Data from Hamilton (1989)). mswitch ar rgnp, ar(1/4) (output omitted ) To obtain dynamic predictions, we use predict with the dynamic() option. The dynamic() option requires that all exogenous variables be present for the whole predicted sample. In this example, we have not specified any exogenous variables, so we do not check for that. However, we do need to have time values available for the predictions. So before submitting our predict command, we use tsappend to extend the dataset by eight periods. Within dynamic(), we specify that dynamic predictions will begin in the first quarter of 1985, and we use the convenience function tq() to convert 1985q1 into a numeric date that Stata understands; see [FN] Date and time functions.

mswitch postestimation Postestimation tools for mswitch 7. tsappend, add(8). predict rgnp_f, dynamic(tq(1985q1)) (option yhat assumed; predicted values) We again use tsline to plot the in- and out-of-sample predictions. We restrict the range to quarters 1982q1 to 1986q4 using function tin().. tsline rgnp_f if tin(1982q1,1986q4), ytitle("out-of-sample predictions") > tline(1985q1) Out of sample predictions 2 1 0 1 2 3 1982q1 1983q1 1984q1 1985q1 1986q1 1987q1 date (quarters) The vertical line shows where our out-of-sample prediction begins. Model fit and state predictions Example 4: Assessing model fit In this example, we examine the model fit by comparing the fitted values of U.S. real gross national product and the residuals with the actual data. The fitted values are obtained using smoothed probabilities that consider all sample information.. predict yhat, smethod(smooth) (option yhat assumed; predicted values). predict res, residuals smethod(smooth). tsline yhat res rgnp, legend(label(1 "Fitted values") label(2 "Residuals"))

8 mswitch postestimation Postestimation tools for mswitch 2 1 0 1 2 3 1950q1 1955q1 1960q1 1965q1 1970q1 1975q1 1980q1 1985q1 date (quarters) Fitted values log differenced real GNP Residuals We see in the graph above that we do not obtain a good fit; the residuals account for much of the variation in the dependent variable. Example 5: Filtered probabilities Continuing example 4, recall that the states in the model correspond to recession periods and expansion periods for the U.S. economy. State 1 was the recession state. Here we compare the predicted probability of being in state 1 with the National Bureau of Economic Research recession periods stored in the indicator variable recession. To obtain the filtered probabilities, typically used to predict state probabilities, we specify options pr and smethod(filter) with predict.. predict fprob, pr smethod(filter). tsline fprob recession 0.2.4.6.8 1 1950q1 1955q1 1960q1 1965q1 1970q1 1975q1 1980q1 1985q1 date (quarters) State1, filter probabilities NBER recession indicator

mswitch postestimation Postestimation tools for mswitch 9 The predictions of recession and expansion states fit well with the NBER dates. Thus, it appears that while our model does not have good fit, it does a good job of predicting the probability of being in a given state. We could also have specified smethod(smooth) to obtain better estimates of the state probability using all sample information. Example 6: Expected duration Rather than predicting which state the series is in at a point in time, we may wish to know the average time it spends in a given state. We can compute the expected duration of the process being in a given state and show the result in a table using estat duration. Continuing example 5, we can calculate the average length of recession periods and expansion periods for the U.S. economy.. estat duration Number of obs = 131 Expected Duration Estimate Std. Err. [95% Conf. Interval] State1 4.076159 1.603668 2.107284 9.545915 State2 10.42587 4.101872 5.017004 23.11771 The table indicates that state 1, the recession state, will typically persist for about 4 quarters and state 2, the expansion state, will persist for about 10 quarters. Stored results estat transition stores the following in r(): Scalars r(level) Macros r(label#) Matrices r(prob) r(se) r(ci#) confidence level of confidence intervals label for transition probability estat duration stores the following in r(): vector of transition probabilities vector of standard errors of transition probabilities vector of confidence interval (lower and upper) for transition probability Scalars r(d#) expected duration for state # r(se#) standard error of expected duration for state # r(level) confidence level of confidence intervals Macros r(label#) label for state # Matrices r(ci#) vector of confidence interval (lower and upper) for expected duration for state #

10 mswitch postestimation Postestimation tools for mswitch Methods and formulas Forecasting a Markov-switching model requires estimating the probability of the process being at any given state at each time period. The forecasts are then computed by weighting the state-specific forecasts by the estimated probabilities. Refer to Hamilton (1993) and Davidson (2004) for more details on forecasting Markov-switching regression models. By default and with the smethod(filter) option, predict estimates the probability of being at a state in each period by applying a nonlinear filter on all previous periods and the current period. (See Methods and formulas of [TS] mswitch for the filter equations.) With the smethod(smooth) option, predict estimates the probabilities by applying a smoothing algorithm (Kim 1994) using all the sample information. With the smethod(onestep) option, predict estimates the probabilities using information from all previous periods to make one-step-ahead predictions. The dependent variable is predicted by averaging the state-specific forecasts by the estimated probabilities. The residuals are computed as the difference between the predicted and the realized dependent variable. The standardized residuals are the residuals normalized to have unit variances. Using an if or in qualifier to alter the prediction sample can change the estimate of the unobserved states in the period prior to beginning the dynamic predictions and hence alter the dynamic predictions. The initial values for the probabilities are obtained by calculating the ergodic probabilities from the transition matrix. References Davidson, J. 2004. Forecasting Markov-switching dynamic, conditionally heteroscedastic processes. Statistics and Probability Letters 68: 137 147. Hamilton, J. D. 1993. Estimation, inference and forecasting of time series subject to changes in regime. In Handbook of Statistics 11: Econometrics, ed. G. S. Maddala, C. R. Rao, and H. D. Vinod, 231 260. San Diego, CA: Elseiver. Kim, C.-J. 1994. Dynamic linear models with Markov-switching. Journal of Econometrics 60: 1 22. Also see [TS] mswitch Markov-switching regression models [U] 20 Estimation and postestimation commands