Interpretation of posterior predictive checks for a Gaussian Process

Lambda is the mean of the process (sort of; after marginalization the covariance terms will get mixed into the mean as well). As you can see in your PPC, the output is centered above zero, so that’s something.

Posterior predictive sampling samples from a requested random variable by drawing all required “downstream” variables from their respective posterior distributions. Consider this model:

\begin{align}y &\sim N(\mu, \sigma) \\ \mu &\sim N(0, 1) \\ \sigma &\sim Exponential(1)\end{align}

In my way of speaking, the random variable y is “downsteam” of \mu and \sigma, because I can’t sample from it until I first sample from \mu and \sigma. Graphically this model looks like this:

with pm.Model() as m:
    mu = pm.Normal('mu')
    sigma = pm.Exponential('sigma', 1)
    y = pm.Normal('y', mu=mu, sigma=sigma)
pm.model_to_graphviz(m)

image

In this DAG, you can again see that y depends on \mu and \sigma. So if you do pm.sample_posterior_predictive(idata, var_names=['y']), what will happen is:

  1. A posterior sample for \mu will be randomly selected
  2. A posterior sample for \sigma will be randomly selected
  3. The sample of \mu and \sigma will be used to parameterize the given definition of y, which is y\sim N(\mu, \sigma)
  4. A sample y will be drawn from this new distribution

What happens if you instead ask for pm.sample_posterior_predictive(idata, var_names=['mu'])? \mu depends on nothing – there are no edges pointing into \mu on the graph. So we can skip steps (1) and (2) and go straight to (3). \mu was defined as \mu \sim N(0, 1), so it will draw from that. That’s just the prior though, which is probably not what you were expecting! If you just want to look at the posterior, though, that’s already saved in your idata, so there’s no need to do any further sampling.

It looks like you Lambda variable falls into this 2nd category. So you don’t actually want to do posterior predictive sampling on it, you can just directly use the posterior. I’d show an example with your code but it’s not copy-pastable.

2 Likes