Modelling a classical nonlinear state space model benchmark - problems inferring latent states

271 views
Skip to first unread message

Nikolay Jetchev

unread,
Jan 3, 2016, 12:35:22 PM1/3/16
to Stan users mailing list
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
stan_nonlin_param.py
stan_nonlin.py

Andrew Gelman

unread,
Jan 3, 2016, 6:55:16 PM1/3/16
to stan-...@googlegroups.com
Hi, initial  points could be an issue.  If you have x[1] ~ normal(4,0.05), then you could be getting problems with default initial values.  Probably best to supply reasonable inits.  Or reparameterize so that all parameters are on a unit scale.

If convergence is slow I don’t recommend ADVI as a solution.  ADVI is more appropriate when your model is expensive to run because of big data or whatever.

A

--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<stan_nonlin_param.py><stan_nonlin.py>

Reply all
Reply to author
Forward
0 new messages