vector-valued constraints

297 views
Skip to first unread message

Jon Zelner

unread,
May 15, 2015, 11:38:32 AM5/15/15
to stan-...@googlegroups.com
Hi Folks -

Sorry if this has been posted before, but after doing some searching, I wasn't able to find it.

I'm implementing a model where a subset of individuals have a latent variable corresponding to an unobserved infection time. That time can only happen on the interval from birth to their current age, a_i. But individuals are of different ages, and I want to ensure that the value of the parameter is only between [0,a_i) for each individual. 

From the manual, it's doesn't seem like a vector-valued constraint will work in stan when declaring a vector of parameters.

One thought I had was to declare a vector of raw parameter values Z, constrained between [0,1) and then transform them by multiplying by Z * A elementwise where A = [a_1, a_2, ...a_N]. 

I know this would involve a jacobian adjustment, since I want to sample the values of Z*A. So, I wanted to see if I was missing something about using vector-valued constraints and check to see what the appropriate jacobian adjustment would be for the approach I described. 

Thanks!

-Jon

Bob Carpenter

unread,
May 15, 2015, 12:33:54 PM5/15/15
to stan-...@googlegroups.com
If A is constant, you don't need a Jacobian adjustment.
If you work it out, it'll just add a log constant, so it
can be dropped because Stan only needs densities defined
up to an additive constant on the log scale.

- Bob
> --
> 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.

Jon Zelner

unread,
May 15, 2015, 12:42:59 PM5/15/15
to stan-...@googlegroups.com
Ah right; makes sense. Thanks!

-Jon
Reply all
Reply to author
Forward
0 new messages