I read here ( http://www.stata.com/statalist/archi.../msg00884.html ) that statas estat ic does not include a degree of freedom correction. This indeed seems to be the case. Here is an example, the BIC rises as the model gets larger but I cannot replicate the exact number (bic outputs in ps to not clutter the question):
However, in the documentation, this formula is given for the BIC: BIC = -2 lnL + k lnN. This has a degree of freedom correction in k (the number of regressors). I think the discussion about which N to choose has nothing to do with my issue (please correct me if I'm wrong). If I plug the log likelihood of the last model into the formula (Log likelihood = -122.75521, k=4, n= 528), I get: -2*(-122.75521)+4*log(528)=270.586 which is not identical to the 276.855 estat ic returns.
It is also far off from the glm BIC:
Since I have the log likelihood, I should be able to exactly calculate the BIC corrected for model size by hand, no? There should be no magic here!
Any hint would be great!
Frank
P.s.: Here the output for the BICs:
and the glm:
Code:
*create some data sysuse auto, clear set seed 123 gen y= rbinomial(1,0.05) *run four different logits and calculate the BIC's logit y price estat ic logit y price mpg estat ic logit y price mpg headroom estat ic logit y price mpg headroom length estat ic
It is also far off from the glm BIC:
Code:
glm binvar packpc pop income tax, nolog fam(bin)
Any hint would be great!
Frank
P.s.: Here the output for the BICs:
Code:
----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 528 -123.442 -123.1639 2 250.3277 258.8659 ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 528 -123.442 -123.1172 3 252.2345 265.0418 ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 528 -123.442 -123.1162 4 254.2324 271.3087 ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 528 -123.442 -122.7552 5 255.5104 276.8559 ----------------------------------------------------------------------------- Note: N=Obs used in calculating BIC; see [R] BIC note.
Code:
. glm binvar packpc pop income tax, fam(bin) link(logit) Iteration 0: log likelihood = -129.32473 Iteration 1: log likelihood = -122.79829 Iteration 2: log likelihood = -122.75525 Iteration 3: log likelihood = -122.75521 Iteration 4: log likelihood = -122.75521 Generalized linear models No. of obs = 528 Optimization : ML Residual df = 523 Scale parameter = 1 Deviance = 245.5104226 (1/df) Deviance = .4694272 Pearson = 526.2333414 (1/df) Pearson = 1.006182 Variance function: V(u) = u*(1-u) [Bernoulli] Link function : g(u) = ln(u/(1-u)) [Logit] AIC = .4839213 Log likelihood = -122.7552113 BIC = -3033.227 ------------------------------------------------------------------------------ | OIM binvar | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- packpc | -.0096746 .0096484 -1.00 0.316 -.0285852 .009236 pop | -8.73e-08 1.92e-07 -0.45 0.650 -4.64e-07 2.90e-07 income | 3.83e-09 9.04e-09 0.42 0.671 -1.39e-08 2.15e-08 tax | -.0169302 .0201709 -0.84 0.401 -.0564645 .0226041 _cons | -.9446007 1.551501 -0.61 0.543 -3.985486 2.096284 ------------------------------------------------------------------------------ . end of do-file
Comment