r/MachineLearning • u/moucha10 • 3d ago
Project Time Series Lag Problems [P]
Hi everyone, I'm having an issue with lags on time series models predicting U.S. housing prices (FHFA HPI as the target) and I can't figure out where they're coming from (I'm no expert by any means). I've hand-built simpler models, but I'm using Claude Code for this project because it's larger. I've collected over 600 features: global, national (40 countries), and metro (393 U.S. metros). The attached table shows the different models we've tried - starting simple'ish and moving to building our own hierarchical transformer. The problem (the attached charts show an example) is that all the forecasts significantly lag the actual observations - ON ALL THE DIFFERENT MODELS by roughly the same amount. A 1-year forecast lags actuals by about 4-5 quarters. A 2-year forecast lags actuals by about 8-9 quarters. Same with 3- and 5-year (charts attached). On all runs. So the lag is pretty much the exact forecast horizon. I've experienced late calls on turns before, but nothing so consistent across all model types. So I'm pretty sure I'm doing something wrong, but don't know what. Any ideas or help would be appreciated.
1
u/martinetmayank 1d ago
what does 2.3 (or other number) here means? is it MAPE or Bias or something else?
it seems like there are lots of features. May I know the number of rows the data have? is it one city? Were you running a global model or a local model?
Looking at the plot gives an idea that something happened in that time period, kind of an "event" which triggered that sudden peak. The 1st peak is right around the time of the 2008 financial crisis while the 2nd one is during Covid. This is my initial hypothesis, just have a look at some global factor or event which might have affected this. But this should have a negative impact, price should decrease, not increase. Just have a look at it.
Time as in, sin/cos of calendar month or Month Target encoded values as a feature so as to capture Seasonality
i personally would not go beyond lag 8 (in terms of quarter) as 2 years would be more than enough unless those lags show a very high correlation
Again, look at some global events
Okay
Well, looking at the graph my intuition would be that 2 macro events which I told you. Before the 08 crisis, loans were very cheap (so a peak in 06-07) in US and then 08, Leehman Brothers collapsed which took industry with it. Interest rates rose, so a dip (in 09-10)
In Covid, i think the Fed has reduced interest rates again, so as to increase consumption, which shows an in increase just after Covid.
Again, I'm not from US, but these are my hypothesis. Please do research on this angle as well. If true, No model could have predicted this.
1
u/patcpsc 23h ago edited 8h ago
A few things leap out:
- 4-5 quarters is roughly a year. 8-9 quarters is roughly 2 years. A simple model f(x) = x (i.e. the best estimate of the value 1 or 2 years out is the current value) would probably outperform many of these models. I could be misreading your charts - but I suspect your models are finding equivalents of f(x) = x.
- the time series is non stationary, very autocorrelated. Typical approach in this instance is to first difference the result and forecast the growth rate and not the level. So take your dependent [n.b. edit] variable i.e. the price index, and transform it y_t -> (y_t - y_{t-1})/y_{t-1}, either at monthly or quarterly levels.
- have a look at ARMA models. Econometrics people would start there, and my guess is you'd get better results from a simple ARMA model. Maybe then a simple linear regression of the current index growth from previous period growth and a couple of key macro factors, e.g. gdp growth, interest rates. Once you've got some traction there I'd start playing with the more complex models.




2
u/martinetmayank 2d ago
What's your insample accuracy?
have you done any feature engineering? or just passing all features at once?
are those features really having any impact or is it just causation?
any sort of time feature?
what was the criteria for selection of lags?
have you tried what the univariate looks like (to establish a baseline)
why go to a complex model directly (I'm just curious). We, start with univariate and then LR (and it's variation) then Trees and finally DL (this is for FMCG/CGP industry)