Using gret l for Principles of Econometrics, 4th Edition
Poisson Regression
When the dependent variable in a regression model is a count of the number of occurrences of an event you may want to use the poisson regression model. In these models, the dependent variable is a nonnegative integer, (i. e., y = 0,1,...), which represent the number of occurrences of a particular event. The probability of a given number of occurrences is modeled as a function of independent variables.
e-xy
P (Y = y|x) = - y - y = 0,1, 2,... (16.17)
where A = ві + в2х is the regression function.
Estimating this model using maximum likelihood is very simple since the MLE of the poisson regression model is already programmed into gretl. The syntax for a script is the same as for linear regression except you use the possion command in place of ols. This is shown in the following script which replicates the example from your textbook.
A country’s total number of medals (medaltot) in the 1988 olympics is modeled as a function of ln(gdp) and ln(pop). Of course, you can also access the poisson regression estimator from the pull-down menus using Model>Nonlinear models>Possion. To replicate the example in POE4 be sure to restrict the sample to 1988 before estimating the model.
open "@gretldirdatapoeolympics. gdt"
set echo off
set messages off
smpl year = 88 —restrict
logs pop gdp
poisson medaltot const l_pop l_gdp
scalar m1 = exp($coeff(const)+$coeff(l_pop)*ln(quantile(pop,0.5)) +$coeff(l_gdp)*ln(quantile(gdp,0.5))) scalar m2 = exp($coeff(const)+$coeff(l_pop)*ln(quantile(pop,0.75)) +$coeff(l_gdp)*ln(quantile(gdp,0.5))) scalar mft = exp($coeff(const)+$coeff(l_pop)*ln(quantile(pop,0.5))
+$coeff(l_gdp)*ln(quantile(gdp,0.5)))*$coeff(l_gdp) printf "nMarginal Effect at the medians is %.3fn",mft printf "nAverage medal total for median gdp and pop is %.3fn",m1 printf "nAverage medal total for median gdp and 75th quantile pop is %.3fn",m2
In the script, we have also computed a marginal effect and two means for representative countries. The algebraic justification for these can be found below.
The results for poisson model are:
Poisson, using observations 1-205 (n = 151)
Missing or incomplete observations dropped: 54
Coefficient |
Std. Error |
z |
p-value |
|
-15.8875 |
0.511805 |
-31.0420 |
0.0000 |
|
l-pop |
0.180038 |
0.0322801 |
5.5773 |
0.0000 |
l-gdp |
0.576603 |
0.0247217 |
23.3238 |
0.0000 |
Dependent variable: medaltot |
Mean dependent var |
4.887417 |
S. D. dependent var |
16.62670 |
Sum squared resid |
25165.58 |
S. E. of regression |
13.03985 |
McFadden R2 |
0.546854 |
Adjusted R2 |
0.544972 |
Log-likelihood |
-722.3365 |
Akaike criterion |
1450.673 |
Schwarz criterion |
1459.725 |
Hannan-Quinn |
1454.350 |
Overdispersion test: x2(1) = 9.20208 [0.0024] |
Both the size and the wealth of a country contribute to higher medal counts. The probability that the random variable Y is equal to an outcome y can be obtained based on the formula:
where E(y0) = A0 = exp(/?i + /?2x0). The marginal effects are simple
dE(y)
dxi
The marginal effect at the medians and the average medal totals for two hypothetical countries are: