BookmarkSubscribeRSS Feed
samp945
Obsidian | Level 7

Hello all,

 

I'm new to forecasting and have been using UCM with good results for certain analyses. However, I'm currently working with a couple of datasets where the training data appears less patterned (i.e., no seasonality). Specifically, I'm trying to create retrospective forecasts for 2020+ using monthly vehicle fatality data from 2015 - 2019. My goal is to assess how much of an impact pandemic conditions had on certain types of mortality unrelated to COVID.

 

I've attached the dataset I'm using. Any hints or tips on how to create a better model? My current model has very wide confidence intervals.

 

Here's my code (I've commented out certain statements because the model diagnostics suggested I should based on papers I've read):

%let Cause=Traffic;

proc ucm data=CountsDeathMonthCause;
		where CauseOfDeath="&Cause";
id DeathMonth interval=month;
	model Count;

	irregular;
		*variance=0 NoEst;
	level
		variance=0 NoEst;
	*slope
		variance=0 NoEst;
	*cycle
		variance=0 NoEst=(variance);
	*season
		length=12
		type=trig
		variance=0 NoEst;

	deplag lags=(1);
	
	estimate
		back=48
		plot=panel;
		*outest=pan.EstDeath&Cause;
	forecast
		back=48
		lead=48
		plot=(decomp forecasts)
		outfor=pan.TableDeath&Cause;
	ods output FitStatistics=FitDeath&Cause;
run;

Thanks for reading!

1 REPLY 1
SASCom1
SAS Employee

hello @samp945 

 

I cannot say doing the following will help you find a 'better ' model, but here are a couple of things you may consider when trying to explore model diagnostics:

 

1. you may find it helpful to plot the time series and see if you can visually identify some patterns. I used the following to produce a time series plot and the first thing that I noticed from the plot, is that there may be some level shift around 2016~2017, so having a CHECKBREAK option in the LEVEL statement may help.

 

proc timeseries data = a(where = (CauseOfDeath='Traffic')) plot = series;
id DeathMonth interval = month;
var count ;
run;

 

2. you may consider starting from a baseline model similar to the following example in the doc(or some other baseline model you find appropriate for your data), and check for breaks in the baseline model using the CHECKBREAK option in the LEVEL statement,

 

SAS Help Center: A Seasonal Series with Linear Trend

 

I tried the above baseline model and the results seem to indicate level shift in Aug. 2016 in the baseline model. 

 

3.  If level shift is confirmed in the baseline model (as is the case using the above baseline model),  you may want to include the level shift dummy variable as a regressor in the model, following shows an example of level shift detection and how to account for it:

 

https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/etsug/etsug_ucm_examples07.htm

 

 

You may want to do some further data explorations that may help you find alternative candidate models that suite your data, but I hope the above several notes are helpful to you.

 

 

 

 

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

Discussion stats
  • 1 reply
  • 1465 views
  • 0 likes
  • 2 in conversation