Calculating the model coefficients

Report a typo

One day before your Statistics exam, you want to practice fitting a linear regression model by hand. You see the following toy dataset in your textbook:

Example x1x_1 x2x_2 yy
1 2 5 1
2 3 5 1
3 4 7 3

Based on this data, you want to fit a model as follows:

y^=w0+w1x1+w2x2\hat{y} = w_0 + w_1x_1 + w_2x_2.

Estimate the optimal values of the model coefficients w0, w1w_0, \ w_1 and w2w_2 based on the least-squares method.

Enter the obtained values of w0, w1w_0, \ w_1 and w2w_2 divided by space. For example, if you get

w0=0.2, w1=3, w2=12w_0^* = 0.2, \ w_1^* = -3, \ w_2^* = 12

your answer should be 0.2 -3 12.

You can use one of the online matrix calculators, for example https://matrixcalc.org, or your favorite programming language for matrix calculations.

Tip: The exact formula to compute the optimal values of a linear regression model is as follows: w=(XX)1XYw=(X^\top X)^{-1}X^\top Y

Enter a short text
___

Create a free account to access the full topic