Nitin:
exactly.
exactly.
. use "C:\Program Files\Stata17\ado\base\a\auto.dta" (1978 automobile data) . nbreg rep78 mpg Fitting Poisson model: Iteration 0: log likelihood = -114.65178 Iteration 1: log likelihood = -114.65178 Fitting constant-only model: Iteration 0: log likelihood = -162.82048 Iteration 1: log likelihood = -116.17777 Iteration 2: log likelihood = -116.17777 Fitting full model: Iteration 0: log likelihood = -114.65639 Iteration 1: log likelihood = -114.65178 Iteration 2: log likelihood = -114.65178 Negative binomial regression Number of obs = 69 LR chi2(1) = 3.05 Dispersion: mean Prob > chi2 = 0.0806 Log likelihood = -114.65178 Pseudo R2 = 0.0131 ------------------------------------------------------------------------------ rep78 | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- mpg | .0188662 .0106071 1.78 0.075 -.0019234 .0396558 _cons | .8175587 .2419551 3.38 0.001 .3433354 1.291782 -------------+---------------------------------------------------------------- /lnalpha | -41.45834 . . . -------------+---------------------------------------------------------------- alpha | 9.88e-19 . . . ------------------------------------------------------------------------------ LR test of alpha=0: chibar2(01) = 0.00 Prob >= chibar2 = 1.000 . linktest Fitting Poisson model: Iteration 0: log likelihood = -114.36006 Iteration 1: log likelihood = -114.35988 Iteration 2: log likelihood = -114.35988 Fitting constant-only model: Iteration 0: log likelihood = -162.82048 Iteration 1: log likelihood = -116.17777 Iteration 2: log likelihood = -116.17777 Fitting full model: Iteration 0: log likelihood = -114.36554 Iteration 1: log likelihood = -114.35988 Iteration 2: log likelihood = -114.35988 Negative binomial regression Number of obs = 69 LR chi2(2) = 3.64 Dispersion: mean Prob > chi2 = 0.1624 Log likelihood = -114.35988 Pseudo R2 = 0.0156 ------------------------------------------------------------------------------ rep78 | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- _hat | -5.868779 8.883808 -0.66 0.509 -23.28072 11.54316 _hatsq | 2.666774 3.437846 0.78 0.438 -4.07128 9.404827 _cons | 4.37753 5.696759 0.77 0.442 -6.787911 15.54297 -------------+---------------------------------------------------------------- /lnalpha | -41.45834 . . . -------------+---------------------------------------------------------------- alpha | 9.88e-19 . . . ------------------------------------------------------------------------------ LR test of alpha=0: chibar2(01) = 0.00 Prob >= chibar2 = 1.000 .
. use "C:\Program Files\Stata17\ado\base\a\auto.dta" (1978 automobile data) . nbreg rep78 mpg Fitting Poisson model: Iteration 0: log likelihood = -114.65178 Iteration 1: log likelihood = -114.65178 Fitting constant-only model: Iteration 0: log likelihood = -162.82048 Iteration 1: log likelihood = -116.17777 Iteration 2: log likelihood = -116.17777 Fitting full model: Iteration 0: log likelihood = -114.65639 Iteration 1: log likelihood = -114.65178 Iteration 2: log likelihood = -114.65178 Negative binomial regression Number of obs = 69 LR chi2(1) = 3.05 Dispersion: mean Prob > chi2 = 0.0806 Log likelihood = -114.65178 Pseudo R2 = 0.0131 ------------------------------------------------------------------------------ rep78 | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- mpg | .0188662 .0106071 1.78 0.075 -.0019234 .0396558 _cons | .8175587 .2419551 3.38 0.001 .3433354 1.291782 -------------+---------------------------------------------------------------- /lnalpha | -41.45834 . . . -------------+---------------------------------------------------------------- alpha | 9.88e-19 . . . ------------------------------------------------------------------------------ LR test of alpha=0: chibar2(01) = 0.00 Prob >= chibar2 = 1.000 . linktest Fitting Poisson model: Iteration 0: log likelihood = -114.36006 Iteration 1: log likelihood = -114.35988 Iteration 2: log likelihood = -114.35988 Fitting constant-only model: Iteration 0: log likelihood = -162.82048 Iteration 1: log likelihood = -116.17777 Iteration 2: log likelihood = -116.17777 Fitting full model: Iteration 0: log likelihood = -114.36554 Iteration 1: log likelihood = -114.35988 Iteration 2: log likelihood = -114.35988 Negative binomial regression Number of obs = 69 LR chi2(2) = 3.64 Dispersion: mean Prob > chi2 = 0.1624 Log likelihood = -114.35988 Pseudo R2 = 0.0156 ------------------------------------------------------------------------------ rep78 | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- _hat | -5.868779 8.883808 -0.66 0.509 -23.28072 11.54316 _hatsq | 2.666774 3.437846 0.78 0.438 -4.07128 9.404827 _cons | 4.37753 5.696759 0.77 0.442 -6.787911 15.54297 -------------+---------------------------------------------------------------- /lnalpha | -41.45834 . . . -------------+---------------------------------------------------------------- alpha | 9.88e-19 . . . ------------------------------------------------------------------------------ LR test of alpha=0: chibar2(01) = 0.00 Prob >= chibar2 = 1.000 .
. use "C:\Program Files\Stata17\ado\base\a\auto.dta" (1978 automobile data) . nbreg rep78 mpg Fitting Poisson model: Iteration 0: log likelihood = -114.65178 Iteration 1: log likelihood = -114.65178 Fitting constant-only model: Iteration 0: log likelihood = -162.82048 Iteration 1: log likelihood = -116.17777 Iteration 2: log likelihood = -116.17777 Fitting full model: Iteration 0: log likelihood = -114.65639 Iteration 1: log likelihood = -114.65178 Iteration 2: log likelihood = -114.65178 Negative binomial regression Number of obs = 69 LR chi2(1) = 3.05 Dispersion: mean Prob > chi2 = 0.0806 Log likelihood = -114.65178 Pseudo R2 = 0.0131 ------------------------------------------------------------------------------ rep78 | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- mpg | .0188662 .0106071 1.78 0.075 -.0019234 .0396558 _cons | .8175587 .2419551 3.38 0.001 .3433354 1.291782 -------------+---------------------------------------------------------------- /lnalpha | -41.45834 . . . -------------+---------------------------------------------------------------- alpha | 9.88e-19 . . . ------------------------------------------------------------------------------ LR test of alpha=0: chibar2(01) = 0.00 Prob >= chibar2 = 1.000 . linktest Fitting Poisson model: Iteration 0: log likelihood = -114.36006 Iteration 1: log likelihood = -114.35988 Iteration 2: log likelihood = -114.35988 Fitting constant-only model: Iteration 0: log likelihood = -162.82048 Iteration 1: log likelihood = -116.17777 Iteration 2: log likelihood = -116.17777 Fitting full model: Iteration 0: log likelihood = -114.36554 Iteration 1: log likelihood = -114.35988 Iteration 2: log likelihood = -114.35988 Negative binomial regression Number of obs = 69 LR chi2(2) = 3.64 Dispersion: mean Prob > chi2 = 0.1624 Log likelihood = -114.35988 Pseudo R2 = 0.0156 ------------------------------------------------------------------------------ rep78 | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- _hat | -5.868779 8.883808 -0.66 0.509 -23.28072 11.54316 _hatsq | 2.666774 3.437846 0.78 0.438 -4.07128 9.404827 _cons | 4.37753 5.696759 0.77 0.442 -6.787911 15.54297 -------------+---------------------------------------------------------------- /lnalpha | -41.45834 . . . -------------+---------------------------------------------------------------- alpha | 9.88e-19 . . . ------------------------------------------------------------------------------ LR test of alpha=0: chibar2(01) = 0.00 Prob >= chibar2 = 1.000 .
predict fitted, xb
gen sq_fitted=fitted^2
Comment