I'm reading this data analysis book by Gelman and Hill and am trying to understand predictions with hierarchical models. On page 273 they are demonstrating making new predictions for an already observed group and state
Still more generally, we can add in the inferential uncertainty in the estimated parameters, α, β, and σ.
I'm trying to understand how one would do that. As an example:
I have a hierarchical regression model as such:
\begin{aligned} & Y = b_{0_j} + b_1 x + \epsilon \\ & b_0 = U + \eta_j \\ \end{aligned}
I fit the model on 5 different groups j1, j2, j3, j4, and j5
The resulting parameters I received are
- U = 5
- $\eta_j = [1, 2, -1, 4, -3]$
- b_1 = 3
- epsilon is normally distributed with variance 2.25
- the between group variance is 2.25
I want to make a prediction using this model for a new observation. The new observation is in group 5 and has an x value of 4. I believe I would calculate the point prediction by plugging in values to the above formula that is
\begin{aligned} & b_{0_5} = 5 + (-3) = 2 \\ & Y = 2 + 3(4) = 14 \\ \end{aligned}
My main question is how would I construct a 95% confidence interval around this estimate? I think I might add/subtract 1.96 * std(e) but that doesn't account for the between group variation. On the other hand adding in the between group variation in full seems wrong to me since the intercept for group j5 ($U + \eta_5$) is already far from the mean intercept U.
The book gives examples of sampling from various distributions, but even if you were to sample from distributions, would you sample eta 5 (eg -3) from N(-3, 2.25)? or would you sample U from N(5, 2.25) and then add -3 for eta? Or would you sample b0_5 from N(2, 2.25)?
Additionally, would the method to construct the interval be the same if the model had varying intercept and slope? How about if there were group level predictors?