# Latent discrete parameters

#1

I have a theoretical question concerning your example of the “Change point models” in the latent Discrete parameters part of your manual.

You show how to estimate the posteriori distribution for the discrete parameter s.

where lp[m,s] is the likelihood : p(s, D| e,l) in the posteriori draw m. I found it strange that the prior for parameter e and l is never taken into account to calculate the posteriori distribution for the discrete parameter s. For me, this formulation would make more sense:

p(s|D) \propto q(s|D) = \frac{1}{M} \sum_{m=1}^M \exp(lp[m,s]) p(e,m) p(l,m)

where p(e,m) would denote the prior for parameter e in the posteriori draw m.

Am I misunderstanding something?

Charlotte

#3

The transformed variable lp is a function of the parameters. So the relevant code is:

transformed parameters {
vector[T] lp;
lp = rep_vector(log_unif, T);
for (s in 1:T)
for (t in 1:T)
lp[s] = lp[s] + poisson_lpmf(D[t] | t < s ? e : l);
}


So lp is a function of e already, which is where the connection comes in. The prior influences the sampling of e, which will be used in this calculation. Does that make sense?