This video belongs to the openHPI course Introduction to Bayesian Data Analysis. Do you want to see more?
An error occurred while loading the video player, or it takes a long time to initialize. You can try clearing your browser cache. Please try again later and contact the helpdesk if the problem persists.
Scroll to current position
- 00:00Now let's take a look at posterior predictive distributions.
- 00:07These are in contrast to prior predictive distributions that I discussed earlier.
- 00:12So what we're going to do now is that having seen the data, we're going to now generate new data, distributions of new data
- 00:22So that's what I'm calling Y pred here given the observed data.
- 00:27So what we are actually going to do is we are going to again integrate out the theta parameters and figure out what new data
- 00:36would look like after we have computed the posterior distributions of the parameters.
- 00:42Remember when we did the prior predictive distributions, when we generated them, what we did was we sampled from the prior
- 00:49for each parameter, plugged it into the likelihood and generated using the R family of functions, generated the simulated
- 00:56data. That was prior predictive data. Posterior predictive data is going to be basically the same story.
- 01:02Except that instead of using the priors for the parameters, we are going to use the posterior samples that we get from the
- 01:11model.
- 01:12We're going to plug those into the likelihood and produce future data.
- 01:16That's all this equation is doing.
- 01:18And so the code is of course very easy.
- 01:21You'll see that in the textbook, I won't show that to you because it distracts from the actual discussion.
- 01:26But really, once you fit the brm model, you can just generate posterior predictive data using this simple command that's
- 01:34provided with the brm package.
- 01:36It's called posterior predictive check (pp_check).
- 01:39You input the actual fitted model with brm. And you define the number of simulated data points you're producing
- 01:49And you also define the type of plot that you want to produce.
- 01:52So here I am providing you with density overlay plot. The black line
- 01:59is the observed data.
- 02:00So that's the Y?
- 02:01And the blue lines that you're seeing.
- 02:04These are the data sets generated by the model.
- 02:08So this was the original model that we fit with the uniform 0, 20000 uniform prior on the mu parameter.
- 02:18Okay.
- 02:19And so we are looking at posterior distributions of the data given those prior specifications.
- 02:25And you can see that the model is basically producing reasonable data relative to the observed data.
- 02:33So these are future datasets, simulated future data sets that we are looking at.
- 02:37And if these blue lines had been, for example out here, you know, just thinking about a pathological case that would tell
- 02:45you something important about the model, that the observed data and the future data seem to have no connection with each
- 02:51other.
- 02:52Okay, so that's bad news and that means that there is something wrong with this model.
- 02:57So you would have to go back and think about how to fix that model.
- 03:00Okay.
- 03:01But in this case we're in the lucky situation where our posterior predictive data fits beautifully, pretty well with
- 03:09the observed data.
- 03:10It is slightly more spread out.
- 03:12You see this here.
- 03:14The predicted data has a bigger spread.
- 03:17So that's why it's flatter here, but the general shape is similar here.
- 03:22So what happens if I use those very broad uninformative priors?
- 03:26I get a pretty similar fit with the similar predicted data here.
- 03:30Why is that?
- 03:31The reason is that I have a lot of data and so the priors are not actually having that much of an impact on the
- 03:38predicted data that I'm getting.
- 03:40If I had very sparse data, the story might be different.
- 03:43Okay, now, when I use more informative priors, you remember the informative prior from the previous lecture, you see
- 03:51that the distribution shifts a bit to the right.
- 03:54I showed that to you earlier that there was a slight shift to the right in the posterior as well.
- 03:59But the data also has a slight skew to the right and this is due to the impact of the prior.
- 04:04Now the informative prior here.
- 04:06And again, when I make the prior principal, that means I make the standard deviation a bit larger.
- 04:10Again, I get this little larger spread and overlapped with the observed data.
- 04:16So basically, you know, this kind of posterior predictive check is showing me that all the four priors are reasonable
- 04:28in the sense that they are not going to impact the posterior much, the posterior of the parameters.
- 04:35And I also see that in the posterior predictive data that I'm producing from the model under different prior specifications
- 04:42So this is the way to understand the properties of your model for future data, especially in areas like psychology
- 04:50and linguistics, where we are very interested in replicating
- 04:56our experimental results. Replication is a very important part of doing science.
- 05:02So what we want to understand when we've got a particular data set is whether the model that we have chosen
- 05:09for this data set, whether that model is going to produce future data that at least reflects the data that we have.
- 05:19This is not a very big achievement because obviously we are conditioning on the data that we already have.
- 05:25So this should not surprise you that we are in this particular case, pretty close to the observed data, but it is still a
- 05:32good sanity check.
- 05:33And it gives you some idea of the descriptive adequacy of this model.
- 05:38And so from the statistical modeling perspective, this is a very useful thing to do. By the way, you can do this in a frequentist
- 05:45model too, but people just don't do it.
- 05:47But in the Bayesian modeling framework, this is a standard part of the workflow when you're doing data analysis.
- 05:54Okay, so
- 05:57in summary what we did here is that we looked at prior predictive distributions that was also a diagnostic to understand
- 06:04what the model behaves like before it's seen any data.
- 06:08But we also looked at posterior predictive distributions and these tell us what the model predicts for future data conditioning
- 06:15on the data that we have actually observed.
- 06:17These are all diagnostic tools for understanding how the model operates and what the predictions and assumptions of the model
- 06:24are right in terms of observed data.
- 06:28So what I would suggest is that, not during this course, but at some point in the future you would benefit from reading
- 06:37Chapter six and Chapter seven where I discuss or where we discuss these ideas in much more detail with many more examples.
- 06:45The examples help you understand the relevance of these steps, you know, of computing the prior, posterior predictive distributions
- 06:53in the course of doing the data analysis.
- 06:55Okay.
- 06:58So now I'm going to show you another model for the same data where instead of the normal likelihood which I showed you was
- 07:09somewhat questionable because of the skew in the data.
- 07:12I'm going to use an alternative likelihood and that's the log-normal likelihood.
- 07:17That's the next lecture
To enable the transcript, please select a language in the video player settings menu.