[R] zero truncated poisson regression
Achim Zeileis
Achim.Zeileis at uibk.ac.at
Mon Aug 1 09:10:36 CEST 2011
On Sun, 31 Jul 2011, Iasonas Lamprianou wrote:
> Thanks
> Pscl seems to be a sensible option.
>
>
> I have the counts variable with the name "N". This variable can only
> take values bigger than zero!
>
> I have two explanatory variables with the names "type" and "diam"
>
> but when I run
>
> hpm <- hurdle(n ~ type+diam, data = an, dist = "poisson")
>
> I get the message "invalid dependent variable, minimum count is not
> zero". Well, I know that N>0, that is why want to run a zero-truncated
> model. But I must be missing something...and the manual does not seem to
> help a lot...
>
> Can anyone help please?
As previously pointed out by others on this list: hurdle() is not what you
are looking for (although it is related to what you want to do). The
hurdle() model is a two-part model consisting of a zero-truncated count
part and a binary part for modeling N=0 vs N>0. See also
vignette("countreg", package = "pscl") for details.
As you don't need the binary hurdle part, you cannot use hurdle()
directly.
This is why the package "countreg" on R-Forge provides the function
zerotrunc() which essentially does the same thing as the count part in
hurdle().
install.packages("countreg", repos = "http://R-Forge.R-project.org")
library("countreg")
m <- zerotrunc(n ~ type + diam, data = an, dist = "poisson")
summary(m)
> ?
> Dr. Iasonas Lamprianou
> Department of Social and Political Sciences
> University of Cyprus
>
>
>> ________________________________
>> From: Mitchell Maltenfort <mmalten at gmail.com>
>> To: Iasonas Lamprianou <lamprianou at yahoo.com>; "r-help at r-project.org" <r-help at r-project.org>
>> Sent: Sunday, 31 July 2011, 20:45
>> Subject: Re: [R] zero truncated poisson regression
>>
>> Pscl package.
>>
>> On 7/31/11, Iasonas Lamprianou <lamprianou at yahoo.com> wrote:
>>> Dear friends,
>>>
>>> does anyone know how I can run a zero truncated poisson regression using R
>>> (or even SPSS)?
>>>
>>> Dr. Iasonas Lamprianou
>>> Department of Social and Political Sciences
>>> University of Cyprus
>>>
>>> ??? [[alternative HTML version deleted]]
>>>
>>>
>>
>> --
>> Sent from my mobile device
>>
>> Due to the recession, requests for instant gratification will be
>> deferred until arrears in scheduled gratification have been satisfied.
>>
>>
>>
> [[alternative HTML version deleted]]
>
>
More information about the R-help
mailing list