BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lsantfrbp
Fluorite | Level 6

I'm trying to smooth a single, daily time series with a Kalman filter. The state vector has an upward trend to it (its nonstationary) so I dont think I can use PROC UCM, since that assumes the underlying signal is a random walk.Come to think of it, I could try differencing the series, buy i havent done that yet.

 

Instead, I went to the SAS/ETS user guides, which is never a good place to be if you aren't 100% sure of what you're doing. Even the examples are too complex for a beginner. I'd gladly accept a pointer to something written in plain English. In the language of the user guide, Ive got a measurement yt=zt+et which is the signal plus white noise measurement error. I assume b=0 and h=1 for all t. And I've got a signal that I think evolves like this zt = a + fzt-1 + nt. I'd like to assume a and f are not time varying, as written. At this point I would like to feed in my vector of measurements y, and initial values for the signal z0 and prior error covariance, and get as output a smoothed series, SAS having estimated a, f and whatever else it needed to estimate in order to generate the signal series.

 

Does this make any sense?  How can I do it?

1 ACCEPTED SOLUTION

Accepted Solutions
rselukar
SAS Employee

I think you can use PROC UCM.  You can fit a smooth local linear trend model as follows:

proc ucm data test;

   id date interval=day;

   model y;

   irregular;

   level variance=0 noest plot=smooth;

   slope;

   forecast lead=20 plot=decomp;

run;

 

Please check the UCM doc for additional details. 

View solution in original post

4 REPLIES 4
rselukar
SAS Employee

I think you can use PROC UCM.  You can fit a smooth local linear trend model as follows:

proc ucm data test;

   id date interval=day;

   model y;

   irregular;

   level variance=0 noest plot=smooth;

   slope;

   forecast lead=20 plot=decomp;

run;

 

Please check the UCM doc for additional details. 

lsantfrbp
Fluorite | Level 6

Rajesh- Thanks for suggesting this proc. Its very flexible and easier to understand than the IML calls.

rselukar
SAS Employee
I am glad you liked UCM. For even more flexibility, both in terms of types of time series data and the variety of state space models, you can check out the SSM procedure (also in SAS/ETS). The Kalman routines from IML are rarely needed if you have access to the UCM and SSM procedures.
rselukar
SAS Employee
I am glad you liked UCM. For even more flexibility, both in terms of types of time series data and the variety of state space models, you can check out the SSM procedure (also in SAS/ETS). The Kalman routines from IML are rarely needed if you have access to the UCM and SSM procedures.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Discussion stats
  • 4 replies
  • 1410 views
  • 0 likes
  • 2 in conversation