Not sure if any solution or ideas about this problem. I try to write some
routine for
getting the prediction and confidence interval for predicted probabilities
in nbreg. However,
I got into some trouble. Note the following fourth line with:
.local ai = "1/exp([lnalpha]_b[_cons])" // pay attention to this
line
I think it is this line giving me trouble. I will get both nonsensical
prediction and for sure incorrect standard errors. And if I have
.local ai "1/exp([lnalpha]_b[_cons])" // pay attention to this line
Again, I get exactly teh same as I did using the line above.
If I take off the quotation mark;that is, if I have
.local ai = 1/exp([lnalpha]_b[_cons]) // pay attention to this line
then the prediction is CORRECT (I checked it), however, because the local is
resolved before getting into nlcom, so the confidence interval is incorrect
for sure.
I got totally confused and don't know what to do. Also note that `expxb' has
been defined to be equal to exp(xb)=mu and `i' refers to the number of times
(y). Because I have tested it for many times and guess the line that I just
talked about giving me trouble, especially how it is translated in nlcom
affects the differences in the output, and I am pretty sure it's not the
length of the expression list giving me trouble. Very frustrated, and hope
someone could help out. In addition, I think the density function I specify
for the nbreg is correct.
*****************************************************************
local alpha "exp([lnalpha]_b[_cons])"
*local alpha = "e(alpha)"
*local ai = 1/`alpha'
local ai = "1/exp([lnalpha]_b[_cons])" // pay attention to
this line
local gai "exp(lngamma(`ai'))"
noi di in y `alpha'
noi di in y `ai'
noi di in y `expxb'
nlcom
((exp(lngamma(`i'+`ai'))/(exp(lnfact(`i'))*exp(lngamma(`ai'))))* ///
((`ai'/(`ai'+`expxb'))^`ai')* ///
((`expxb'/(`ai'+`expxb'))^`i'))
******************************************************************
Jun Xu
Department of Sociology
Indiana University
_________________________________________________________________
Is your computer infected with a virus? Find out with a FREE computer virus
scan from McAfee. Take the FreeScan now!
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963