Given the following table, use the matrix method to derive the constant and slope parameters of the sample regression function: Marks = f(Weekly party hours). X (Weekly party hours) 2,4,6,8,10,12,14,16 Y (Marks) 80,77,71,67,66,58,49,36
We first tabulate the values of X and Y and calculate "X^2" and "XY"
Using matrix;matrix
"X'X=\\begin{bmatrix}\n 8 & 72 \\\\\n 72 & 816\n\\end{bmatrix}"
"X'Y=" "\\begin{bmatrix}\n 504 \\\\\n 4048\n\\end{bmatrix}"
"X'X^{-1}=\\begin{bmatrix}\n 0.607 & -0.0536\\\\\n -0.0536 & 0.00595\n\\end{bmatrix}"
b="(X'X^{-1})X'Y"
="\\begin{bmatrix}\n 0.607 & -0.0536\\\\\n -0.0536 & 0.00595\n\\end{bmatrix}""\\begin{bmatrix}\n 504 \\\\\n 4048\n\\end{bmatrix}"
="\\begin{bmatrix}\n 88.9552\\\\\n-2.9288\n\\end{bmatrix}"
constant=88.9552
slope=-2.9288
Comments
Leave a comment