You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To derive the computation of the log-likelihood used in stats::logLik.lm we first need to incorporate weights.
From ?lm
weights can be used to indicate that different observations have different variances (with the values in weights being inversely proportional to the variances)
Note that this is the maximium likelihood estimate for $\sigma^2$, not the unbiased estimator for the residual variance, which has $N - p$ in the denominator.
Given the residuals $r_i = y_i - \hat{\boldsymbol{\beta}}\boldsymbol{X}$ we have