* W.H. Greene, Econometric Analysis, Fourth Edition, 2000. SAMPLE 1 601 READ (FAIR_PT.shd) / NAMES * Regression Models for Count Data, Table 20.6, p. 924. * Allocate space for use later. DIM BETA 7 * Poisson Regression MLE y z2 z3 z5 z7 z8 / TYPE=EPOISSON COEF=BETA GEN1 LR=$LLF GEN1 K=$K-1 * Now calculate marginal effects for the Poisson regression. * See the formula in the middle of p. 880. STAT y / MEAN=ybar SAMPLE 1 K GENR SLOPE=ybar*BETA PRINT BETA SLOPE * Negative Binomial Regression * Specify the log-likelihood function using the formula on p. 887. SAMPLE 1 601 LAMBDA: EXP(B2*z2+B3*z3+B5*z5+B7*z7+B8*z8+B0) * With the GENR command, the LGAM(x) function generates a log gamma value. GENR CONST = LGAM(y+1) * Set a starting value for "theta". The choice of starting values * can be important for model convergence. GEN1 BETA:7=0.1 NL 1 / NCOEF=7 LOGDEN START=BETA EQ y*LOG([LAMBDA]/([LAMBDA]+THETA)) + & THETA*LOG(1-([LAMBDA]/([LAMBDA]+THETA))) + & LGAM(THETA+y) - CONST - LGAM(THETA) END * In Table 20.6, the coefficient for z2 for the Negative binomial * regression should be reported as -0.00262 (not -0.0262). * Calculate the overdispersion parameter alpha=1/theta for the * negative binomial model. TEST 1/THETA * A test of the Poisson distribution is obtained by testing the * hypothesis H0: alpha=0. * Textbook typo, middle of p. 887 - the hypothesis theta=0 * should read hypothesis alpha=1/theta=0. * Alternatively, as a test of the Poisson distribution, * calculate a likelihood ratio test statistic. GEN1 LU=$LLF GEN1 LR=-2*(LR-LU) * Now get the p-value. DISTRIB LR / TYPE=CHI DF=1 GEN1 pvalue=1-$CDF PRINT LR pvalue STOP