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/IpFRiQFFYps/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.
data { int<lower=1> T; // number of time periods int<lower=1> K; // number of categories int<lower=0> counts[T, K];}parameters { simplex[K] props[T]; // period-specific category proportions real<lower=0> tau; // innovation standard deviation}transformed parameters { vector[K] logit_props[T]; // logit of proportions for (t in 1:T) { for (k in 1:K) { logit_props[t, k] <- logit(props[t, k]); // Adjust for logit tranform by incrementing the log probability // by the log of the derivative of the inverse-logit increment_log_prob(log(inv_logit(props[t, k])) + log1m(inv_logit(props[t, k]))); } }}model { for (t in 1:T) { if (t > 1) { logit_props[t] ~ normal(logit_props[t - 1], tau); //vectorized } counts[t] ~ multinomial(props[t]); }}data { int<lower=1> T; // number of time periods int<lower=1> K; // number of categories int<lower=0> counts[T, K];}parameters { vector[K] logit_props[T]; // logit of proportions real<lower=0> tau; // innovation standard deviation}transformed parameters { simplex[K] props[T]; // period-specific category proportions for (t in 1:T) { props[t] <- softmax(logit_props[t]); }}model { for (t in 1:T) { if (t > 1) { logit_props[t] ~ normal(logit_props[t - 1], tau); } counts[t] ~ multinomial(props[t]); }}>>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>> --
>> 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/IpFRiQFFYps/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com
>> <mailto:stan-users+unsub...@googlegroups.com>.
Hi Bob,
Thanks for the correction. Your math is correct. The updated code is:
int<lower=1> T; // number of time periods int<lower=1> K; // number of categories int<lower=0> counts[T, K];}parameters { simplex[K] props[T]; // period-specific category proportions real<lower=0> tau; // innovation standard deviation}transformed parameters { vector[K] logit_props[T]; // logit of proportions for (t in 1:T) { for (k in 1:K) { logit_props[t, k] <- logit(props[t, k]); // Adjust for logit tranform by incrementing the log probability // by the log of the derivative of the logit function increment_log_prob(-(log(props[t, k]) + log1m(props[t, k]))); } }}model { for (t in 1:T) { if (t > 1) { logit_props[t] ~ normal(logit_props[t - 1], tau); } counts[t] ~ multinomial(props[t]); }}
Devin
>> >>> stan-users+...@googlegroups.com <javascript:> <mailto:stan-users+unsub...@googlegroups.com <javascript:>>.
>> >>> For more options, visit https://groups.google.com/groups/opt_out <https://groups.google.com/groups/opt_out>.
>> >>
>> >> --
>> >> 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/IpFRiQFFYps/unsubscribe
>> <https://groups.google.com/d/topic/stan-users/IpFRiQFFYps/unsubscribe>.
>> >> To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com <javascript:>
>> >> <mailto:stan-users+unsub...@googlegroups.com <javascript:>>.
data { int<lower=1> T; // number of time periods int<lower=1> K; // number of categories int<lower=0> counts[T, K];}parameters { simplex[K] props[T]; // period-specific category proportions real<lower=0> tau; // innovation standard deviation}transformed parameters { vector[K] logit_props[T]; // logit of proportions for (t in 1:T) { for (k in 1:K) { logit_props[t, k] <- logit(props[t, k]); // Adjust for logit tranform by incrementing the log probabilitydata { int<lower=1> T; // number of time periods int<lower=1> K; // number of categories int<lower=0> counts[T, K];}parameters { simplex[K] props[T]; // period-specific category proportions real<lower=1> priorN; // implied "sample size" of the previous period}model { for (t in 1:T) { if (t > 1) { props[t] ~ dirichlet(priorN * props[t - 1]); // transition equation } counts[t] ~ multinomial(props[t]); }}> >> >>> stan-users+...@googlegroups.com <javascript:> <mailto:stan-users+unsub...@googlegroups.com
> <javascript:>>.
> >> >>> For more options, visit https://groups.google.com/groups/opt_out
> <https://groups.google.com/groups/opt_out> <https://groups.google.com/groups/opt_out
> <https://groups.google.com/groups/opt_out>>.
> >> >>
> >> >> --
> >> >> 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/IpFRiQFFYps/unsubscribe
> <https://groups.google.com/d/topic/stan-users/IpFRiQFFYps/unsubscribe>
> >> <https://groups.google.com/d/topic/stan-users/IpFRiQFFYps/unsubscribe
> <https://groups.google.com/d/topic/stan-users/IpFRiQFFYps/unsubscribe>>.
> >> >> To unsubscribe from this group and all its topics, send an email to
> stan-users+...@googlegroups.com <javascript:>
> >> >> <mailto:stan-users+unsub...@googlegroups.com <javascript:>>.