Have you checked what happens if you do the PSIS-LOO approximation in the loo package? I'm not sure that's what you want for this model, but I'd be curious to know what happens.
Jonah
I think with a single time series, you need to
fit the model on observations y[1] to y[t-1]
and look at the predicted log density for
y[t].
Hi,I have estimated a Hidden Markov Model (HMM) for animal movement states (with the help of Bob! See the attached.) The marginalisation of the latent states is handled via dynamic programming using the forwards/backwards algorithm.I have a number of model permutations which I would like to compare using some measure of predictive performance. For example, I would like to compare a two-state HMM with a three-state one.
--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/Nb_yXztKVFY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.
> On Jul 8, 2016, at 10:28 AM, Krzysztof Sakrejda <krzysztof...@gmail.com> wrote:
...
> Just a word of caution about predictions in
> this context. Lots of time-series models will produce decent
> single time-step predictions just because they are set up as
> stepwise models. To really see if you have a decent model
> you need multi-step predictions on a meaningful time scale.
Do you mean predicting the entire rest of the series, like
p(y[(t+1):T] | y[1:t])
?
> In other words, I can tell you where that elk is going to be
> fifteen minutes after the last GPS fix, it'll be near where you
> last saw it, and if you can't beat that model (y[t]=y[t-1]) an
> hour or two out you might want to rethink your modeling approach.
It's a little more subtle than that. The elk tend to either
mill about, or walk in a straightish line. So it's not just
a random diffusion around where they're at for each time step.
But then when you zoom out scales, it does look like a diffusion
again. Without longer-scale history data, say for fixed migrations
paths, or covariates, such as location of food and water and terrain
features, it's hard to tell where an animal's going to go.
The real problem is that y[t] = y[t-1] isn't a model. It doesn't provide
a density for p(y[t] | y[t-1]). So how do I evaluate against a non-model?
With mean square error or something? In the mixture HMM case, there are two
components, change in heading and distance moved---together with the current
bearing and state (transiting, foraging, sleeping, etc.), they give you a
prediction of where you'll be next.
- Bob
Even though it won't be able to
make an accurate prediction, it should be able to estimate the density
of everywhere it might be. The correlation among bearings will mean
that you can explain longer walks ---it's a kind of overdispersion.
> The real problem is that y[t] = y[t-1] isn't a model. It doesn't provide
> a density for p(y[t] | y[t-1]). So how do I evaluate against a non-model?
> With mean square error or something? In the mixture HMM case, there are two
> components, change in heading and distance moved---together with the current
> bearing and state (transiting, foraging, sleeping, etc.), they give you a
> prediction of where you'll be next.
>
> Sure it's a point prediction. You can use any error you want,
Well, I want to use log loss to compare probabilistic predictions.
That is, I want to lay out an area and ask what the probability
is that the animal will be in it. Or at least evaluate the density
of the point the animal's actually at.
> for infectious disease
> we've done mean absolute error and relative mean absolute error (MAE1/MAEref)
> where MAEref is for some reference model (sometimes as simple as y[t]=y[t-1]). Typically
> we evaluate these as a function of prediction horizon or something like that.
But I want to do full Bayes for my predictions. I'd integrate
the error measure over the posterior predictive to derive an
expected error and bounds:
INT err(y[(t+1):T], y'[(t+1):T]) p(y'[(t+1):T] | y[1:t]) dy'.
- Bob
I was thinking that I could use a variant of k-folds for time series where I essentially do the following:1 | 21 2 | 31 2 3 | 41 2 3 4 | 5
where the | indicates a boundary between a training and testing set. However, to me it is a bit unclear how to do this with a HMM. The code below shows how I estimate the model. Basically - to estimate the states - we find the most probable state for each time period, determined by considering the previous time periods' best state.