Skip to content
This repository has been archived by the owner on Jul 14, 2019. It is now read-only.

Use of ssm_lpdf() gives "Rejecting initial value" #32

Open
ksvanhorn opened this issue May 19, 2017 · 0 comments
Open

Use of ssm_lpdf() gives "Rejecting initial value" #32

ksvanhorn opened this issue May 19, 2017 · 0 comments

Comments

@ksvanhorn
Copy link

I have a Stan model using ssmodels-in-stan that worked fine with ssm_constant_lpdf(), but when I switched to ssm_lpdf() I started getting the error "Rejecting initial value: Error evaluating the log probability at the initial value." Some experimentation showed that it was in fact the call to ssm_lpdf() that is the problem. Digging in further, the problem appears to be the line

K = ssm_update_K(P, T_t, Z_t, Finv);

near the end of the function. The definition of ssm_update_K looks like this:

matrix ssm_update_k(matrix P, matrix Z, matrix T, matrix Finv) {
  matrix[cols(Z), rows(Z)] K;
  K = T * P * Z' * Finv;
  return K;
}

So you have Z and T swapped in the call to ssm_update_K, leading to non-conforming matrices in the matrix multiply.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant