Lab 1
Fit a line and examine its residuals
Use the eight observations to compute the centred cross-product slope, fit y on x with an intercept, and compare the two results. Check the residual sum and residual–x cross-product. Change to a unit one hundredth as large, so the recorded variable becomes , and explain how its coefficient changes.
Show a starting hint
Start with the sample means. Compute Sxy and Sxx, then divide. Use lm(y ~ x, data = d), coef(), resid() and sum(). A known rescaling changes coefficient units; it does not make the information noisier.
Compare with the worked interpretation
The sample means are and . Centre each observation around its sample mean:
and
The slope is therefore
Substitute it into the intercept formula:
The fitted regression gives the same two coefficients. The residual sum and residual–x cross-product are zero up to rounding. With , one w unit is only one hundredth of an original x unit, so the coefficient becomes
predictions stay the same. These sample fitting identities do not prove structural exogeneity.