Estimation using particle filter

Dear all,

I am currently working on parameter estimation using particle filtering for my state-space model applying the following codes.

I especially followed run_filter_and_smoother_AR1_TaRB.m
But I have encountered some unexpected results. My estimates for rho and rho sigma converge close to 1, with small volatility over iterations.

What would be the potential reasons for this results and how can I fix this?

I suspect this could be due to the choice of prior distributions or the number of observables.
I used Uniform (-0.9999, 0.9999) for rho, and Beta (0.9, 0.1^2) for rho sigma (same setting as evaluate_prior_AR1).
And the number of observables are only 49.

I would appreciate any advice on how to address this issue.

Thank you very much!

Unit roots like that usually happen if the data mean does not conform to the mean in the model, i.e. you did not make sure data and code are consistent.

Does this mean that my data should be detrended or transformed before estimation to ensure consistency with the model? If so, would demeaning or normalizing the data be effective, or is there a more appropriate transformation?

How can I check whether my data and model are consistent?

Thank you!

How did you treat your data? The current code assumes data in deviations from the trend/mean, i.e. the data is mean 0.

I changed the code slightly so that the AR(1) process for the observables is now specified as:
x_t=(1-\rho)\bar{x}+\rho x_{t-1} + e^{\sigma_t}v_t
where x_bar is the mean of my data.
Would this transformation be valid? Does it correctly account for the mean structure of the data, or would additional adjustments be necessary?

Usually, it does. Did you make sure your data it not trending?

yes I detrended my series using hp-filter.

But then it must already be mean 0.

Oh, I missed that point. Thank you.
But even if I modify the model to have zero mean, I still get the same result.

How does a plot of your data look like?