# Does the parameter change during data generation in Bayesian Inference?

Let's assume that we have the following graphical model:

This graph encodes the joint distribution $P(p,x_1,x_2,x_3,x_4) = P(p)\prod_{i=1}^{4}P(x_i|p)$. In the Bayesian inference, if we know $x_1,x_2,x_3$ then a full Bayesian predictive posterior for $x_4$ is given as:

$$P(x_4|x_3,x_2,x_1) = \int_{p}P(x_4|p)P(p|x_3,x_2,x_1)dp$$

I used to interpret a model like in the above as follows: Some probabilistic system picks a $p$ from $P(p)$. Then this picked $p$ generates data as $x_1\sim P(x_1|p),x_2\sim P(x_2|p),x_3\sim P(x_3|p)$. We do not know the true value of $p$ and therefore we integrate over all possible values of $p$ using its posterior distribution given the data in order to obtain the posterior predictive distribution of $x_4$.

In this interpretation, the value of $p$ stays the same once it is picked from the prior, during the data generation. But our lack of knowledge about it leads us to integrate over its all possible values in order to infer $x_4$. This can be considered as a generative model.

My question is, is my interpretation correct here? I am asking this, because I have seen some sources on web which imply that $p$ changes during generating $x_i$s. If it were that way, shouldn't each of these different values be named as different random variables like $p_1$ for $x_1$, $p_2$ for $x_2$, etc. ?

This has greatly confused me. I appreciate any comments.

• Just to clarify - is $P(p)$ your prior? Or are you assuming there is a true data generating process for $p$ with associated distribution? Aug 19, 2014 at 17:01
• Yes, it is just the prior distribution for the parameter $p$. Aug 19, 2014 at 17:12
• If you'd like to share the sources that led to confusion, I'll take a look and see if I might be able to address more in my answer. Aug 19, 2014 at 21:03
• Thanks for the great answer. The primary source which led me to confusion is the presentation at: stat.ufl.edu/archived/casella/Talks/BayesRefresher.pdf Here, an example is given for Bayesian inference. In pages 6 and 8, if I understood correctly, three different protocols have been applied for a case of toxification. For each protocol, different studies have been conducted: In each study $j$, there is the total number of toxicity incidences, $n_j$, and the number of incidences which is determined to be linked to something called as "AAN", which is $X_j$. Aug 19, 2014 at 21:11
• Quite welcome! Sorry to say I share your confusion and can't help further. I think he might intend that $p_i$ is drawn from a different distribution for each cohort $j$. Meaning, each cohort might be analogous to a mint from which studies, or coins, are drawn. (I expect it would all be very clear if we heard the talk the slides are meant to support.) You might have some luck if you check and see if there are any code samples to support the book the slides mention. Model descriptions can be ambiguous; code cannot. Hope this helps! Aug 20, 2014 at 0:33

I believe your interpretation is correct. (Though without knowing the context the author intended for the graphic, I suppose anything is possible.) Likewise, your point about adding subscripts to $p$ seems right: if the model assumes different parameters drawn from some distribution, then those values would generally appear with subscripts. I'm not sure this is a strict convention, but it's used in practice, and arguably clearer. See for example formula (3) in the latent Dirichlet allocation paper, p. 996.
A specific example might help illustrate the difference. See p. 3 of this tutorial based on a chapter from Doing Bayesian Data Analysis. In short, it imagines a group of coins produced by the same mint, and theorizes that each coin from the same mint has a $p_i$ drawn from a beta distribution specific to the mint; each flip of a coin is assumed Bernoulli generated using that coin's $p_i$. Put more simply, it assumes variation in the probabilities of coins produced by a mint, and models that variation by way of the hierarchy.
That's the sort of model described by your second interpretation. In your first interpretation, there's only one coin, and $x_4$ could represent the next, unseen flip.