Closed ivanistheone closed 5 months ago
Good catch, thanks! Am I right that n
in your line sigmahat = np.sqrt( SS_resid/(n-p-1) )
can be defined as n = len(mod2['residuals'])
?
Am I right that n in your line sigmahat = np.sqrt( SS_resid/(n-p-1) ) can be defined as n = len(mod2['residuals'])?
yes exactly; n is the sample size
Message ID: @.***>
Perfect, thanks!
In the subsection "Checking the homogeneity of variance" in the chapter on linear regression, the Scale-Location Plot shows the sqrt-abs-value of the unstandardized residuals, when it should show residuals divided by $\widehat{\sigma} = \sqrt{ \frac{SS_{resid}}{n-p-1}}$, a.k.a.
np.sqrt(lm.scale)
for a linear model fit objectlm
obtained from statsmodels.To get the standardized residuals, the code could be changed from:
to
Probably not a big deal, but it would be nice to have the graph match plots readers might see in R plots, and also 1 = $\widehat{\sigma}$ is a useful reference.