Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Forecasting
- /
- Outputting 'state prediction' time series with Proc Model Switching re...

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 04-24-2017 09:52 PM
(821 views)

Hello, I have been working on US recession turning point analysis using LEI data, and I have run into a bit of a snag. One of the models I am working with is a Markov Switching model, seen here:

http://support.sas.com/documentation/cdl/en/etsug/66100/HTML/default/viewer.htm#etsug_model_sect277.... (I believe this is the most famous example of how to do this in SAS by far)

However this code only estimates the parameters of the equation in each state, as well as a series of tests to see if the parameters are significantly different between states. What I am looking for out of this model is a monthly time series output (I'm using monthly time series data) of which state it believes is active in a given month, so basically a series of regime/state probabilities. Is there any way to get this working in SAS?

3 REPLIES 3

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Using the switching regression example in the PROC MODEL chapter you could output the predicted regime probabilities by using the following FIT and OUTVARS statemnt in place of the FIT statement in the example:

```
fit starts / method=marquardt converge=1.0e-5 out=o;
outvars d;
```

The values of 'd' written to the ouput data set represent the predicted probabiltiy each observation is in regime 2.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thanks, that worked perfectly. However, it brought another issue to my attention that I'm not sure how to solve.

For this Markov Switching model, I'm using LEI to predict whether or not the economy is in a recession, using the binary indicator provided by the NBER as a point of reference. Following the example I linked to, I ended up using the binary recession indicator to construct 'd'. But this is obviously an issue since my goal is to predict the state variable endogenously, rather than figure out the parameters in different states.If I am using the NBER indicator in my markov chain, which is the thing I'm trying to predict, then I'm not actually doing anything.

Would you know how I could set up this model in SAS to predict the state variable, ONLY using %change in the LEI (without referencing the NBER indicator?).

For reference, here is my code (mostly taken wholesale from the example):

proc model data=revisedLEI_and_nber; parms sig1=10 sig2=10 int1 int2; bounds 0.0001 < sig1 sig2; a = NBER_binary; d = probnorm(a); y1=int1; y2=int2; rtchglei = (1 - d)*y1 + d*y2; logL = ((1/2)*( (log(2*3.1415)) + log( (sig1**2)*((1-d)**2)+(sig2**2)*(d**2) ) + (resid.rtchglei*( 1/( (sig1**2)*((1-d)**2)+(sig2**2)*(d**2) ) )*resid.rtchglei) ) ); errormodel rtchglei ~ general(logL); fit rtchglei / method=marquardt converge=1.0e-5 out=o; outvar d; run;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If I understand your question correctly you would just need to model 'a' using one or more parameters that are also estimated. In the original PROC MODEL example 'p' plays the role of this parameter.

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.