Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Zero Trunctated and One inflated Poisson

From   Maarten buis <>
Subject   Re: st: RE: Zero Trunctated and One inflated Poisson
Date   Tue, 20 Mar 2007 07:59:31 +0000 (GMT)

--- Giorgio Ricchiuti <> wrote:
> If I got the point are you suggesting me to write a program as
> follows?
> program
> version 8
> args lnf mu teta
> quietly replace ‘lnf’ = exp(-`teta') if $ML_y1==1
> quietly replace ‘lnf’ = ln(1-exp(-`teta'))+ $ML y1*ln(`mu')- `mu' - 
> lnfact($ML y1)- ln(1-exp(-`mu')) if $ML_y1>1
> end
> . ml model lf myoneinflated (y = x1 x2 x3) () () () ()
> . ml init tau1=1 tau2=2 tau3=3 tau4=4, skip
> . ml check
> . ml maximize

If you replace the line -program- with -program define myoneinflated-,
than, as a way of writing a -ml- model for one time use, yes this is
definitely the do it. I also begin this way when I am writing a program
for wider use, but than I continue adding bells and whistles to it till
it looks like a normal Stata program. 

However, i am not sure about the likelihood. A one inflated poisson
would mean to me that there are two groups: one that always has a count
of one, and the other which can have any count larger than or equal to
one. We don't know which person belongs to which group so we model the
data as a mixture. I assume `teta' is the linear predictor for the
``inflation equation'', in which case the probability of belonging to
the ``always 1 group'' is not -exp(-`teta')- but -invlogit(`teta')-.
One minus that probability (not belonging to the always 1 group) can
than for numerical precision reasons be better coded as
-invlogit(-`teta')- instead of -1-invlogit(`teta')-. Since it is a
mixture, the likelihood for a person with a one count should also
contain a -invlogit(-`teta')*``likelihood according to poisson''- part.
Finally, you specify tau s in the -ml init- statement that are not used
in the likelihood function. 

In short, as a way of programming this models this is a good way to do
it, but i would have a really good look at the likelihood function

Hope this helps,

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider.
*   For searches and help try:

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