# Best Linear Predictor for LMM Example

I have been attempting to work through a best linear predictor example within the textbook Semiparametric Regression by Ruppert, Wand, and Carrol (pdf). The specific example concerns a linear mixed model on pig weight over time:

$$weight_{i,j} = \beta_0 + U_i + \beta_1week_j + \epsilon_{i,j}$$

Where j indexes the weeks and i indexes the pigs. U is a random variable distributed according to $$U \sim N(0,\sigma_U^2)$$, epsilon is the error term distributed according to $$\epsilon \sim N(0,\sigma_\epsilon^2)$$. We are also told that $$cov(weight_{i,j},weight_{i,j'}) = \sigma_U^2$$. The purpose of the example is to predict U using the equation:

$$BP(U) = E(U) + CV^-1(y-E(y)) \\ C = E[(U - E(U))(y - E(y))] \\ V = Cov(y)$$

My work is as follows:

$$BP(U) = 0 + E[(U - 0)(y - \beta_0 - \beta_i\bar{x})]\frac{1}{\sigma_U^2}(y - \beta_0 - \beta_i\bar{x}) \\ BP(U) = E[Uy]\frac{1}{\sigma_U^2}(y - \beta_0 - \beta_i\bar{x}) \\$$

The answer as provided in the textbook is:

$$BP(U) = \frac{n_i\sigma_U^2}{\sigma^2_\epsilon + n_i\sigma_U^2}(y - \beta_0 - \beta_i\bar{x})$$

Any steps that connect the starting point to the final answer in the book would be unbelievably appreciated.