I am at the end of my ropes trying to get this question correct. I honestly have no idea what I'm doing wrong.
"The table below lists the height h (in cm), the age a (in years), the gender g (0 = "Female", 1 = "Male"), and the weight w (in kg) of some college students.
$$\begin{array}{c|c|c|} \text{Height} & \text{Age} & \text{Gender} & \text{Weight}\\ \hline 155 & 21 & 0 & 47 \\ \hline 173 & 19 & 1 & 68 \\ \hline 175 & 20 & 1 & 70 \\ \hline 180 & 21 & 1 & 77 \\ \hline 160 & 22 & 0 & 52 \\ \hline \end{array}$$
We need to fit a linear function of the form: w = c0 + c1h + c2a + c3g.
Find the best approximation of this function, using least squares"
We need to solve for the normal equation ATAc = ATB.
So I set up my two matrices as:
\begin{bmatrix} 1 & 155 & 21 & 0\\ 1 & 173 & 19 & 1\\ 1 & 175 & 20 & 1\\ 1 & 180 & 21 & 1\\ 1 & 160 & 22 & 0 \end{bmatrix}
and
\begin{bmatrix} 47 \\ 68 \\ 70 \\ 77 \\ 52 \end{bmatrix}
After plugging them into the formula and doing the calculations, I got the following values for c:
c0 = -137.8333333331393
c1 = 1.1666666666660603
c2 = 0.16666666666606034
c3 = 0.8333333333866904
Then it tells me to write my answer in this form:
w = w(h, a, g) =
So I typed my answer as this:
-137.833 + 1.16667h + 0.166667a + 0.833333g
But it is completely wrong. Did I type it in the wrong format? Did I mess up my calculations? Or is it both cases?