Assume that we have the following dataset.

Using lm()  to calculate the regression coefficient is very easy.

Then we plug the coefficients in the formula.
But how are \(\beta_{0}\), \(\beta_{f}\), and \(\beta_{w}\) calculated? \(\bar{x}_{p}\), \(\rho\), and \(\sigma_{p}\) are the building blocks.

Now we are ready to calculate the intercepts.

Then we can calculate \(\beta_{0}\)
Now we are ready to predict.
TL;DR Manually fitting multiple regression is bearable. But if predictors are more than two. No need to reinvent the wheel, let’s just use lm() .  🙂