Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: fitted values in xtmepoisson and xtpoisson

From   Austin Nichols <>
Subject   Re: st: RE: fitted values in xtmepoisson and xtpoisson
Date   Tue, 11 May 2010 17:42:56 -0400

The fitted values assume e_i=0 which is rather more consequential in
the normal case; look at the means, or try

webuse epilepsy, clear
xtset subject
qui poisson seizures lage i.subject
predict f
la var f "FE Poisson"
qui xtpoisson seizures lage, re normal
predict n, nu0
la var n "Normal error"
qui xtpoisson seizures lage, re
predict g, nu0
la var g "Gamma error"
sort lage
g x=round(50*exp(lage))
qui xtpoisson seizures i.x, re normal
predict yn, nu0
qui xtpoisson seizures i.x, re
predict yg, nu0
su n g yn yg seizures
g rn=seizures/n
su rn, mean
g infln=n*r(mean)
table x, c(mean yn mean yg mean seizures)
table x, c(mean g mean n mean infln)
su seizures n g yn yg infln
sort x
tw lowess seizures x||line n x||line g x||line infln x

On Tue, May 11, 2010 at 12:53 PM, Dan MacNulty <> wrote:
> Thanks for spotting my error Garry; I did neglect to specify the -normal-
> option. And this highlights my core question: why do the marginal fitted
> values differ so much between poisson models where the random effects follow
> a normal versus a gamma distribution? Moreover, it seems the former provide
> a comparatively poor fit to the observed data. Specifically, the marginal
> fitted values from the poisson model with normally distributed random
> effects appear to underestimate the observed counts. This is illustrated
> with the following code:
> . use
> . xtset  subject
> . xtpoisson seizures lage, re normal
> . predict xt_norm, nu0
> . xtpoisson seizures lage, re
> . predict xt_gamma, nu0
> . twoway (lowess seizures lage)  (line xt_norm lage, sort) (line xt_gamma
> lage, sort)
> Garry Anderson wrote:
>> Dear Dan,
>> If you use the -,normal- option on the -xtpoisson- model the fitted
>> values are the same as -xtmepoisson-. That is, the -xtmepoisson- command
>> assumes that the random effects are normally distributed, whereas the
>> -xtpoisson- command assumes that they have a gamma distribution. Page
>> 286 of the Stata 11 XT manual refers to -xtmepoisson- and says "Because
>> this is a simple random-intercept model, you can obtain equivalent
>> results by using
>> xtpoisson with the re and normal options."
>> Cheers, Garry

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index