Simultaneous modeling of long-term and short-term trends in a state-space model


I am trying to model long term and short term trends of stock prices simultaneously in stan with a state space model.
I am not using a pre-moving average, but rather an internal stan
Weekly trend


and assuming a first-order linear trend, transforming


For stock prices, we have


but the estimated trend oscillates and sigma is estimated abnormally low.
Please advise!

Hi, @biones. I’m sorry nobody’s responded to your post, but it’s very hard to diagnose part of a model without data. Do you have a Stan program that compiles? I couldn’t quite follow the hints you’re leaving here as I’m having trouble turning them into code.

If there’s a way you can just write the model out in mathematical notation, that would also help.

The model you have is odd for a generative model in that it doesn’t seem to be modeling the data, but only the trends and its modeling trends based on other trends. Have you tried reformulating to generate a single value at a time?

In general, the answer to problems like these is to simulate data from the model and see if you can recover the true parameters in their posterior intervals.