정재희
2014-Nov-11 17:58 UTC
[R] How are the standard errors of the estimates in glm.nb() calculated?
Hello, I am running a negative binomial model using the glm.nb function in MASS package. But the standard errors I get are slightly different from the same model I ran using Stata's nbreg command. Some of the standard errors are the same, but some are not. Those that are different differ in their decimals, particularly the third decimal. I am wondering how exactly glm.nb calculates standard errors. I could not find any documentation. The standard errors in Stata's nbreg command are calculated from the observed information matrix. I am thinking that maybe glm.nb uses the expected information instead of the observed information? But I could not figure out if that is the case. It may be because I don't have a very good grasp of the difference between expected and observed information. I also tried to look into the source code of glm.nb by typing glm.nb in the R console, but I could not find how the standard errors are calculated. Any help will be very much appreciated! As a side note, here is the output I get after running the glm.nb model: Deviance Residuals: Min 1Q Median 3Q Max -2.8076 -1.0216 -0.4800 0.3257 4.2359 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -1.4211390 0.2334931 -6.086 1.15e-09 *** x1 -0.0633597 0.1825984 -0.347 0.728599 x2 0.0240531 0.0327962 0.733 0.463308 x3 -0.0223691 0.0318900 -0.701 0.483025 x4 0.1004497 0.0348040 2.886 0.003900 ** x5 -0.0110895 0.0254989 -0.435 0.663635 x6 0.0098525 0.0174814 0.564 0.573029 x7 -0.2574358 0.2375014 -1.084 0.278394 x8 0.0319359 0.0250482 1.275 0.202318 x9 0.9795687 0.0332084 29.498 < 2e-16 *** x10 -1.2697342 0.1684822 -7.536 4.83e-14 *** x11 0.0021235 0.0003019 7.035 2.00e-12 *** x12 0.5223974 0.2052481 2.545 0.010922 * x13 -0.0491496 0.1853978 -0.265 0.790930 x14 -0.4071932 0.1087920 -3.743 0.000182 *** x15 -0.2980707 0.2197779 -1.356 0.175024 x16 -0.2374620 0.1885971 -1.259 0.207995 x17 -0.1466253 0.1236171 -1.186 0.235573 --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 (Dispersion parameter for Negative Binomial(1.2214) family taken to be 1) Null deviance: 3658.9 on 1108 degrees of freedom Residual deviance: 1186.1 on 1091 degrees of freedom (34 observations deleted due to missingness) AIC: 5104.4 Number of Fisher Scoring iterations: 1 Theta: 1.2214 Std. Err.: 0.0855 2 x log-likelihood: -5066.3860 [[alternative HTML version deleted]]