Estimating hidden states of time series model

92 views
Skip to first unread message

marmaduk...@univ-amu.fr

unread,
Jul 30, 2015, 5:49:10 PM7/30/15
to Stan users mailing list
Hi

I'm trying to infer parameters of a time series model with hidden states, and I would like to know if it's possible to avoid estimating the hidden states themselves.

A toy example of how I've done it so far, which includes the hidden states, is the following

data {
  int T;
  vector[T] y; // observations
  real dt; // time step for SDE
}
parameters {
  vector[T] x; // hidden states
  real a;  // parameter I'm interested in
  real sig;
  real eps;
}
model {
  for (t in 2:T)
    x[t] ~ normal(x[t-1] + dt*(a*x[t-1] - x[t-1]^3), sig*sqrt(dt));
  y ~ normal(1/(1 - exp(-x)), eps);
}

And this works quite well, but for the real model I want to use, there's not 1 hidden state variable but tens or hundreds, the observation model is a general linear mixture and aside from making the inference quite slow, I'm worried it reduces the quality of the estimates (though I'm quite new to Stan & MCMC so maybe that's unfounded). The only trick I've come up with so far is to thin the number of time points being estimated.

Can anyone offer some pointers or critiques here? Any remarks on SDEs in Stan/MCMC in general would also be welcome.

Cheers,
Marmaduke

Jeffrey Arnold

unread,
Jul 31, 2015, 12:22:58 AM7/31/15
to Stan users mailing list
If you can express the system in discrete time as a linear dynamic model you can use a forward pass of the Kalman filter to calculate the log-likelihood marginalizing over the latent variables. You can find my various attempts at implementing this here: https://github.com/jrnold/ssmodels-in-stan.  I apologize in advance for the code being a bit of a mess; I've been meaning to clean it up for external consumption for a while. But despite the mess, it still may be better than starting from scratch. 


--
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.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages