Dear Stan developers and users
can you please help me model in Stan this classical nonlinear state space model benchmark, used for example in the experiments of these NIPS papers
http://arxiv.org/pdf/1306.2861.pdf http://arxiv.org/pdf/1506.03338v3.pdf So far, I get poor results in Stan for it, divergent RHAT and wrong parameter fits and poor likelihood.The attached file
stan_nonlin_param.py has the python/pystan code to create the data, and then infer the latent states
x and the parameters
a,b,c,sigma.
I tried to split the problem in smaller chunks and understand better what fails in my approach. The attached file
stan_nonlin.py has the parameters set to the correct values and only needs to infer the posteriors of the latent states
x.
Stan also fails to do this, which is otherwise quite easy for a vanilla
particle filter/sequential importance sampling method. Can you please help me improve the model:
1) In general, is my coding of a state space model too direct and naive? I am basically just encoding the joint distribution consisting of state transition and observation probabilities. Should I instead really code a full particle filter with particles and ancestors in STAN? The papers cited do Particle Gibbs Sampling, but it seems this would be too cumbersome to encode in STAN, so I hoped that some ellegant small model can do the job instead
2)
does the nonlinear state space transition and the nonlinear
transformation in the observation probability cause any specific
problems for STAN? The y~ x^2 part makes the latent states distribution bimodal, is this an issue for STAN?
Also the term weighted by b=25 is problematic, the nonlinear state evolution term. State x inference works a bit better with b=0 (so a linear state evolution), but still seems worse than a particle filter forward sampling.
3) how should I change my Stan settings? Any special step sizes for the NUTS, other priors on the parameters? Will ADVI work better for the task - it is currently not available in pystan but I can try with cmdstan?
have a successful new year and thanks a lot for your help
Nikolay