Dear Statalists,
Sorry in advance for the long message, there are few Stata output that I need to include for clarity.
I am dealing with a panel dataset in which I want to estimate the territories' patenting activity on the basis of some performance indicators. I have a balanced panel dataset of 32 towns for 14 years. Giving the features of my dependent variable, I am using a negative binomial model, and I want to exploit the longitudinal feature of the data.
I have successfully ran the model with some selected independent variables as a poisson (non panel), negative binomial (non panel), unconditional possion fixed effect (glm command), unconditional negative binomial fixed effect (glm command) , conditional poisson fixed effect (xtpoisson, fe), conditional negative binomial fixed effect (xtnbreg, fe) models, random poisson model (xtpoisson, re). This is why I found it strange when I could not get any results from the negative binomial random effect (xtnbreg, re) model.
I post here the - xtnbreg, fe -, the - xtpoisson, re - and the - xtnbreg, re - codes, together with some of the output:
At first, the loglikelhood function yelded a non concave function. I waited up to the iteration 1380 but it did not seem to get to a solution. Therefore I tried to use various solutions that I found in the forum:
- using the - difficult - option
- changing the algorithm technique to the dfp and bfgs ones (I did not go through the bhhh as it reported it does not work with d2 evaluators).
The only "improvement" that I could get is that the problem is no longer the not concave function but the message "loglikelihood discontinuous region encountered":
I can only run the model if I omit some specific variables:
There seem to be an issue with two variables (named Nr_individual and Nr_foreign). What I do not understand is why the code is able to run with fixed effects and not with the random effect model. Why is it so? should I suspect that something is not right in the fixed effect model either? Is there any other way to overcome the problem apart from those I already tried? Shall I try some transformation with the variables that are causing trouble?
Thanks to anyone that will help!
Sorry in advance for the long message, there are few Stata output that I need to include for clarity.
I am dealing with a panel dataset in which I want to estimate the territories' patenting activity on the basis of some performance indicators. I have a balanced panel dataset of 32 towns for 14 years. Giving the features of my dependent variable, I am using a negative binomial model, and I want to exploit the longitudinal feature of the data.
I have successfully ran the model with some selected independent variables as a poisson (non panel), negative binomial (non panel), unconditional possion fixed effect (glm command), unconditional negative binomial fixed effect (glm command) , conditional poisson fixed effect (xtpoisson, fe), conditional negative binomial fixed effect (xtnbreg, fe) models, random poisson model (xtpoisson, re). This is why I found it strange when I could not get any results from the negative binomial random effect (xtnbreg, re) model.
I post here the - xtnbreg, fe -, the - xtpoisson, re - and the - xtnbreg, re - codes, together with some of the output:
PHP Code:
*Negative binomial, conditional fixed effect
xtnbreg SIPO_Pat ICT nospec cap_on_emp Nr_individual l1.Exports Nr_foreign l1.Grad_sec_sch pre* post*, fe
note: post_2005 omitted because of collinearity
Iteration 0: log likelihood = -8759.6522 (not concave)
...
Iteration 24: log likelihood = -2481.9586 (not concave)
Iteration 25: log likelihood = -2356.2314
Iteration 26: log likelihood = -2219.1313
Iteration 27: log likelihood = -2199.4056
Iteration 28: log likelihood = -2198.8179
Iteration 29: log likelihood = -2198.8158
Iteration 30: log likelihood = -2198.8158
Conditional FE negative binomial regression Number of obs = 416
Group variable: TOWN_ID Number of groups = 32
Obs per group: min = 13
avg = 13.0
max = 13
Wald chi2(10) = 1405.40
Log likelihood = -2198.8158 Prob > chi2 = 0.0000
--------------------------------------------------------------------------------------------------
SIPO_Pat_Appl | Coef. Std. Err. z P>|z| [95% Conf. Interval]
---------------------------------+----------------------------------------------------------------
ICT | -.1426851 .082568 -1.73 0.084 -.3045154 .0191452
nospec | -.2190276 .0679435 -3.22 0.001 -.3521944 -.0858607
cap_on_employee_ads | .0012927 .0013914 0.93 0.353 -.0014343 .0040197
Nr_individual_comm_hous_enterpri | 1.60e-06 1.60e-06 0.99 0.320 -1.55e-06 4.74e-06
|
Exports_10th |
L1. | 4.31e-07 2.13e-07 2.03 0.043 1.41e-08 8.48e-07
|
Nr_foreign_funded_firms | .0002219 .0001048 2.12 0.034 .0000164 .0004274
|
Grad_sec_sch_pop |
L1. | 7.776467 2.578928 3.02 0.003 2.72186 12.83107
|
pre_2005 | -.8859314 .081811 -10.83 0.000 -1.046278 -.7255848
post_2005 | 0 (omitted)
post_2008 | .6558707 .0543943 12.06 0.000 .5492597 .7624817
post_2011 | .2776123 .049691 5.59 0.000 .1802197 .3750049
_cons | 1.541551 .1224057 12.59 0.000 1.30164 1.781461
--------------------------------------------------------------------------------------------------
*Poisson, random effect
xtpoisson SIPO_Pat ICT nospec cap_on_emp Nr_individual l1.Exports Nr_foreign l1.Grad_sec_sch pre* post*, re
Fitting Poisson model:
Iteration 0: log likelihood = -31973.28
Iteration 1: log likelihood = -30094.781
Iteration 2: log likelihood = -30089.312
Iteration 3: log likelihood = -30089.312
Fitting full model:
Iteration 0: log likelihood = -17908.496
Iteration 1: log likelihood = -11730.035
Iteration 2: log likelihood = -11570.704
Iteration 3: log likelihood = -11545.794
Iteration 4: log likelihood = -11543.718
Iteration 5: log likelihood = -11543.687
Iteration 6: log likelihood = -11543.687
Random-effects Poisson regression Number of obs = 416
Group variable: TOWN_ID Number of groups = 32
Random effects u_i ~ Gamma Obs per group: min = 13
avg = 13.0
max = 13
Wald chi2(10) = 55875.28
Log likelihood = -11543.687 Prob > chi2 = 0.0000
--------------------------------------------------------------------------------------------------
SIPO_Pat_Appl | Coef. Std. Err. z P>|z| [95% Conf. Interval]
---------------------------------+----------------------------------------------------------------
ICT | -.1028622 .0140955 -7.30 0.000 -.1304888 -.0752356
nospec | -.1438835 .012527 -11.49 0.000 -.168436 -.119331
cap_on_employee_ads | .0039368 .0002509 15.69 0.000 .003445 .0044287
Nr_individual_comm_hous_enterpri | 1.81e-06 2.57e-07 7.04 0.000 1.31e-06 2.32e-06
|
Exports_10th |
L1. | 3.20e-07 3.04e-08 10.53 0.000 2.61e-07 3.80e-07
|
Nr_foreign_funded_firms | .0002136 .0000139 15.32 0.000 .0001863 .0002409
|
Grad_sec_sch_pop |
L1. | 11.57073 .4436957 26.08 0.000 10.7011 12.44036
|
pre_2005 | -1.116745 .0140921 -79.25 0.000 -1.144365 -1.089125
post_2008 | .739617 .0080947 91.37 0.000 .7237516 .7554824
post_2011 | .1076197 .0078306 13.74 0.000 .0922719 .1229674
_cons | 5.178147 .1205244 42.96 0.000 4.941924 5.414371
---------------------------------+----------------------------------------------------------------
/lnalpha | -.7870015 .2338881 -1.245414 -.3285894
---------------------------------+----------------------------------------------------------------
alpha | .4552077 .1064676 .2878218 .7199386
--------------------------------------------------------------------------------------------------
Likelihood-ratio test of alpha=0: chibar2(01) = 3.7e+04 Prob>=chibar2 = 0.000
.
*Negative Binomial random effect
xtnbreg SIPO_Pat ICT nospec cap_on_emp Nr_individual l1.Exports Nr_foreign l1.Grad_sec_sch pre* post*, re
Fitting negative binomial (constant dispersion) model:
Iteration 0: log likelihood = -31973.28
Iteration 1: log likelihood = -30094.781
Iteration 2: log likelihood = -30089.312
Iteration 3: log likelihood = -30089.312
Iteration 0: log likelihood = -50019.689
Iteration 1: log likelihood = -6160.8259
Iteration 2: log likelihood = -4620.1901 (backed up)
Iteration 3: log likelihood = -2957.8093
Iteration 4: log likelihood = -2928.1561
Iteration 5: log likelihood = -2926.5559
Iteration 6: log likelihood = -2926.5532
Iteration 7: log likelihood = -2926.5532
Iteration 0: log likelihood = -2926.5532 (not concave)
Iteration 1: log likelihood = -2825.9998
Iteration 2: log likelihood = -2699.4153
Iteration 3: log likelihood = -2674.8744
Iteration 4: log likelihood = -2672.2632
Iteration 5: log likelihood = -2672.2598
Iteration 6: log likelihood = -2672.2598
Fitting full model:
Iteration 0: log likelihood = -8326.6712 (not concave)
Iteration 1: log likelihood = -5825.2809 (not concave)
Iteration 2: log likelihood = -5782.6175
Iteration 3: log likelihood = -4181.4293 (not concave)
Iteration 4: log likelihood = -3677.2887
Iteration 5: log likelihood = -3110.3723 (not concave)
Iteration 6: log likelihood = -3103.9361 (not concave)
Iteration 7: log likelihood = -3096.597 (not concave)
Iteration 8: log likelihood = -3096.0307 (not concave)
Iteration 9: log likelihood = -3095.7554 (not concave)
...
- using the - difficult - option
- changing the algorithm technique to the dfp and bfgs ones (I did not go through the bhhh as it reported it does not work with d2 evaluators).
The only "improvement" that I could get is that the problem is no longer the not concave function but the message "loglikelihood discontinuous region encountered":
PHP Code:
xtnbreg SIPO_Pat ICT nospec cap_on_emp Nr_individual l1.Exports Nr_foreign l1.Grad_sec_sch pre* post*, re difficult technique(nr dfp bfgs)
note: post_2005 omitted because of collinearity
Fitting negative binomial (constant dispersion) model:
(setting technique to nr)
Iteration 0: log likelihood = -31973.28
Iteration 1: log likelihood = -30094.781
Iteration 2: log likelihood = -30089.312
Iteration 3: log likelihood = -30089.312
(setting technique to nr)
Iteration 0: log likelihood = -50019.689
Iteration 1: log likelihood = -6160.8259
Iteration 2: log likelihood = -4620.1901 (backed up)
Iteration 3: log likelihood = -2957.8093
Iteration 4: log likelihood = -2928.1561
(switching technique to dfp)
Iteration 5: log likelihood = -2926.5559
Iteration 6: log likelihood = -2926.5532
Iteration 7: log likelihood = -2926.5532
(setting technique to nr)
Iteration 0: log likelihood = -2926.5532 (not concave)
Iteration 1: log likelihood = -2825.9998
Iteration 2: log likelihood = -2699.4153
Iteration 3: log likelihood = -2674.8744
Iteration 4: log likelihood = -2672.2632
(switching technique to dfp)
DFP stepping has contracted, resetting DFP Hessian
Iteration 5: log likelihood = -2672.2598
DFP stepping has contracted, resetting DFP Hessian
Iteration 6: log likelihood = -2672.2598 (backed up)
DFP stepping has contracted, resetting DFP Hessian
Iteration 7: log likelihood = -2672.2598 (backed up)
DFP stepping has contracted, resetting DFP Hessian
Iteration 8: log likelihood = -2672.2598 (backed up)
DFP stepping has contracted, resetting DFP Hessian
Iteration 9: log likelihood = -2672.2598 (backed up)
(switching technique to bfgs)
BFGS stepping has contracted, resetting BFGS Hessian
Iteration 10: log likelihood = -2672.2598 (backed up)
BFGS stepping has contracted, resetting BFGS Hessian
Iteration 11: log likelihood = -2672.2598 (backed up)
BFGS stepping has contracted, resetting BFGS Hessian
Iteration 12: log likelihood = -2672.2598 (backed up)
BFGS stepping has contracted, resetting BFGS Hessian
Iteration 13: log likelihood = -2672.2598 (backed up)
BFGS stepping has contracted, resetting BFGS Hessian
Iteration 14: log likelihood = -2672.2598 (backed up)
(switching technique to nr)
Iteration 15: log likelihood = -2672.2598 (backed up)
Fitting full model:
(setting technique to nr)
Iteration 0: log likelihood = -8326.6715 (not concave)
Iteration 1: log likelihood = -5825.2839 (not concave)
Iteration 2: log likelihood = -5782.621
Iteration 3: log likelihood = -4181.1842 (not concave)
Iteration 4: log likelihood = -3677.1854
(switching technique to dfp)
DFP stepping has contracted, resetting DFP Hessian
Iteration 5: log likelihood = -3110.5124
cannot compute an improvement -- discontinuous region encountered
r(430);
PHP Code:
xtnbreg SIPO_Pat ICT nospec cap_on_emp Nr_foreign l1.Grad_sec_sch pre* post*, re difficult technique(nr dfp bfgs)
note: post_2005 omitted because of collinearity
Fitting negative binomial (constant dispersion) model:
(setting technique to nr)
Iteration 0: log likelihood = -38755.247
Iteration 1: log likelihood = -37842.441
Iteration 2: log likelihood = -37840.06
Iteration 3: log likelihood = -37840.06
(setting technique to nr)
Iteration 0: log likelihood = -50019.689
Iteration 1: log likelihood = -6160.8259
Iteration 2: log likelihood = -4620.1901 (backed up)
Iteration 3: log likelihood = -2957.8093
Iteration 4: log likelihood = -2928.1561
(switching technique to dfp)
Iteration 5: log likelihood = -2926.5559
Iteration 6: log likelihood = -2926.5532
Iteration 7: log likelihood = -2926.5532
(setting technique to nr)
Iteration 0: log likelihood = -2926.5532
Iteration 1: log likelihood = -2786.4174 (backed up)
Iteration 2: log likelihood = -2743.1568
Iteration 3: log likelihood = -2723.0039
Iteration 4: log likelihood = -2722.8331
(switching technique to dfp)
Iteration 5: log likelihood = -2722.833
Fitting full model:
(setting technique to nr)
Iteration 0: log likelihood = -9353.5423 (not concave)
Iteration 1: log likelihood = -2769.5786 (not concave)
Iteration 2: log likelihood = -2637.0027 (not concave)
Iteration 3: log likelihood = -2519.5827
Iteration 4: log likelihood = -2512.9767
(switching technique to dfp)
Iteration 5: log likelihood = -2503.1936
Iteration 6: log likelihood = -2502.3942
Iteration 7: log likelihood = -2502.1686
Iteration 8: log likelihood = -2502.1571
Iteration 9: log likelihood = -2502.1567
(switching technique to bfgs)
Iteration 10: log likelihood = -2502.1567
Random-effects negative binomial regression Number of obs = 416
Group variable: TOWN_ID Number of groups = 32
Random effects u_i ~ Beta Obs per group: min = 13
avg = 13.0
max = 13
Wald chi2(8) = 1378.00
Log likelihood = -2502.1567 Prob > chi2 = 0.0000
-----------------------------------------------------------------------------------------
SIPO_Pat_Appl | Coef. Std. Err. z P>|z| [95% Conf. Interval]
------------------------+----------------------------------------------------------------
ICT | -.1073468 .0817717 -1.31 0.189 -.2676165 .0529228
nospec | -.2141712 .0666093 -3.22 0.001 -.3447231 -.0836194
cap_on_employee_ads | .0008254 .0014677 0.56 0.574 -.0020512 .0037021
Nr_foreign_funded_firms | .0003357 .0001039 3.23 0.001 .000132 .0005394
|
Grad_sec_sch_pop |
L1. | 8.398023 2.525613 3.33 0.001 3.447912 13.34813
|
pre_2005 | -.9107259 .0804405 -11.32 0.000 -1.068386 -.7530655
post_2005 | 0 (omitted)
post_2008 | .6540546 .0534153 12.24 0.000 .5493626 .7587466
post_2011 | .3172153 .0452615 7.01 0.000 .2285043 .4059262
_cons | 1.553998 .1206744 12.88 0.000 1.317481 1.790516
------------------------+----------------------------------------------------------------
/ln_r | .8607036 .2442626 .3819576 1.33945
/ln_s | 4.170516 .2849279 3.612068 4.728964
------------------------+----------------------------------------------------------------
r | 2.364824 .5776382 1.46515 3.816942
s | 64.74885 18.44875 37.04256 113.1783
-----------------------------------------------------------------------------------------
Likelihood-ratio test vs. pooled: chibar2(01) = 441.35 Prob>=chibar2 = 0.000
Thanks to anyone that will help!
Comment