# Looking for mult. linear regression equations

#### dave25

##### New Member
Hi - I'm having trouble finding the equations for the coefficients for a multiple linear regression with two independent variables (a=, b1=, b2=). I've checked many sources but had no luck. I'm also interested in seeing the equations for a regression with three or four IVs if they're available somewhere.
Thanks

#### Dragan

##### Super Moderator
Hi - I'm having trouble finding the equations for the coefficients for a multiple linear regression with two independent variables (a=, b1=, b2=). I've checked many sources but had no luck. I'm also interested in seeing the equations for a regression with three or four IVs if they're available somewhere.
Thanks
Let: Yhat = b0 + b1*X1 + b2*X2

The OLS estimates are:

b1 = [(ry1 - ry2*r12) / (1 - r12^2)] * (Sy/SX1)

b2 = [(ry2 - ry1*r12) / (1 - r12^2)] * (Sy/SX2)

b0 = YBar - b1*X1Bar - b2*X2Bar

where

ry1, ry2, r12 are Pearson zero-order correlations; Sy, SX1, SX2 are standard deviations; YBar, X1Bar, X2Bar are the means.

When the independent variables exceed 2 my advice is to use matrix algebra:

B = (X^T X)^1 * X^T * Y

where T indicates "Transpose".