Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Negative predictions after trnbin0


From   [email protected]
To   [email protected]
Subject   Re: st: RE: Negative predictions after trnbin0
Date   Thu, 20 Jan 2005 16:16:49 EST

Someone asked me privately if exponentiating the  linear predictor produces 
the fitted value for all maximum likelihood models. No  it does not -- only for 
those models that are members of the exponential family  of distributions 
having a log link. For example, you would exponentiate the  linear predictor to 
obtain the fitted values, mu, for the log-normal, canonical  Poisson, and 
log-negative binomial (the log link is not canonical for the NB  distribution). 
Read the reference manual for GLM to get more information.  

Joe Hilbe

--------------------
trpois0 and trnbin0 are simliar  to other ML based programs in Stata. When  
you type predict after  modeling, you get the linear predictor, XB.  To  
obtain 
the fitted  values, type
predict lp
gen mu=exp(lp)

Note that Stata's -poisson-  and nbreg commands have been written so that  
using predict afterwards  generates the fitted value rather than the standard 
ML  
linear  predictor. 

You can check this out yourself by comparing output;  e.g.
use cancer
tab drug, gen(drug)
poisson studytim age drug2  drug3
predict mu_p
trpois0 studytim age drug2 drug3
predict lp
gen  mu_tr = exp(lp)
l mu_p lp mu_tr

You'll find that mu_p and mu_tr are  the same. Type 
gen lp_p = ln(mu_p) 
to obtain the  poisson command linear predictors 

The same is the case with negative  binomial: nbreg and trnbin0. 

I nearly always use the glm version of  poisson since it displays BIC and  
AIC 
GOF statistics, along with other  GOF values and statistical diagnostics, as  
well as allowing you to  immediately calculate lp, mu, and 11 types  of 
residuals. With the  -glm- command you can also obtain standard errors  using 
jacknife 
and  bootstrap -- and a variety of robust techniques. 

With the negative  binomial it is a bit different. I use nbreg to obtain an  
estimate of  the ancillary parameter and then use that value for alpha in the 
glm   version. I can then utilize the above mentioned modeling utilities that 
glm  
offers, and obtain the many residual statistics for
model assessment.  

Joe Hilbe




I believe -trnbin0- is producing the linear  prediction.   Exponentiate the
values to get the predicted number  of  events.

Scott

> 
> Dear all,
> I have used  a  truncated negative binomial model (trbin0) for the
> conditional  number of  visits to the doctor. I have found out that the
>  predictions after the  estimation of the positive number of visits  is
> sometimes negative. Is  there any one who could help me to  understand why
> that happens?
>  
> Many thanks in  advance,
> 
> Dolores  

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index