Normal Linear Model, llf #323

Open
josef-pkt opened this Issue Jun 20, 2012 · 1 comment

1 participant

@josef-pkt
statsmodels member

I always had problems matching llf of the linear models.

I ran into this again, and finally figured out that the scale estimate is MLE based with denominator nobs, instead of the denominator in results.scale which is (nobs - k_vars)

>>> stats.norm.logpdf(res.resid, scale=np.sqrt((res.resid**2).mean())).sum()
-59.216496084705149
>>> res.llf
-59.216496084705149

Even though the scale estimate is different, I think llf is exactly the same as Stata reports (IIRC)

At several places I needed a normal linear model that does not concentrate out the scale/sigma_squared estimate. We should get a basic generic Normal Model class for this.

@josef-pkt
statsmodels member

just to clarify what I think I was thinking when I opened this:

The scale estimate in the linear models uses the unbiased least squares, while the concentrated loglike uses the definition of the MLE. So llf is not the loglike at [params, scale] but at [params, scale_MLE]

related discussion in #1170

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment