"An experiment in which 64 indivduals had their pulse rates recorded (x) and , following the toss of a coin, 23 of the 64 were asked to run a fixed distance. After the exercise period, the pulse of all 64 individuals were again measured (y). Summary statistics of the pulse measurements ( I will only include those for those who did not run for this question) are given below:

The sum of the x_i = 2940

The sum of the y_i = 2932

The sum of the x_i-squared = 214,306

The sum of the y_i-squared = 212728

The sum of the x_i*y_i = 213,274.

For those who did not run, we are to assume the model y_i = Bx_i + e_i, where e_i is distributed normally N(0,phi - squared) , i = 1, ..., n.

We are asked to calculate the least squares estimate 'B-hat', of B, and calculate an unbiased estimatet of phi-squared, and hence an estimate of the standard deviation of 'B-hat'. "

I've found the least square estimate 'B-hat' of B. But I am struggling to calculate an unbiased estimate of phi-squared.

I know the formula is (1/n-2)* (the sum of [(y_i - Bx_i)squared])

We know n =41.

We know 'the sum of the y's' and the 'the sum of the x's ' .

I have worked out that 'B-hat' = 0.99518.

So how do I calculate an estimate for phi-squared, because we cannot just say (1/n-2)*([the sum of the y's] -[B-hat*the sum of the x's]) ALL SQUARED, because it's the sum of all the individual (y_i- Bx_i)squareds.

I hope this is clear!!!

I would appreciate any help. Thank you for your time.