Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Need help to comeup with predicted mean after xtgee

From   Maarten buis <>
Subject   Re: st: Need help to comeup with predicted mean after xtgee
Date   Mon, 21 Jun 2010 00:23:40 -0700 (PDT)

--- On Mon, 21/6/10, wrote:
> I am running an xtgee regression on a large time series data.
> The dependent variable is a log transformed person-month
> medical costs. The model is:
> . xi: xtgee ln_medicaidMC i.state <snip>,
> family(gamma) link(log)
> . predict mean_sample if e(sample)
> . gen expmean_sample=exp( mean_sample)
> The pmt_mc is the raw person-month medical cost without
> transformation. The mean_sample is the predicted mean (see
> command above) and the expmean_sa~e is the exp(
> mean_sample). Since the predicted mean (mean_sample) is
> exp(xb), I suppose it is in dollar amount, not the log
> transformed dollar amount. But, mean of the mean_sample is
> too slow compare with the pmt_mc (raw medical costs), 3.017
> vs 529.66. But the the expmean_sa~e is loo large compared
> with the raw medicaid coss.

In your model you moddeled ln(E(ln(pmt_mc))), that is, the
logarithm of the expected value of the logarithm of medical
cost, while you probably want to model ln(E(pmt_mc)). In
-xtgee- and -glm- it is the -link- option that takes care
of the transformations, you should _not_ transform the 
dependent variables yourself. So your model should probably

xi: xtgee pmt_mc i.state <snip>, family(gamma) link(log)

A nice article that discusses this use of the link function
to take care of transformations rahter than doing it yourself

Nicholas J. Cox, Jeff Warburton, Alona Armstrong, Victoria J. Holliday 
(2007) "Fitting concentration and load rating curves with generalized
linear models" Earth Surface Processes and Landforms, 33(1):25--39.

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen


*   For searches and help try:

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