a = mean^2 / variance = mean^2 / SD^2
b = variance / mean = SD^2 / mean
This corresponds to your
alfa=(mean/SE)^2
beta=SE^2/mean
except you have SE (standard error), when it
should be SD (standard deviation).
Now consider what happens if you work with
not x > 0, but y = - x. Clearly the SD
of y is the same as that of x, but the mean is negated,
so
a(y) = a(x)
b(y) = -b(x)
consistently with what you observed. OK so far, but
1. As mentioned, there are programs available
to you that will do the fit by maximum likelihood,
with various distinct advantages over moments, including
the provision of standard errors too and the possibility
of looking at dependence on covariates too.
. ssc inst gammafit
2. I do not know why you generated random numbers, but
if you want to assess the quality of fit, then use graphs!
. ssc inst qgamma
. ssc inst pgamma
3. There is some confusion in your post between
the inverse of the (cumulative) distribution function
of a gamma distribution, i.e. the quantile function
of a gamma distribution, as yielded by
beta * invgammap(alpha, probability)
and an inverse gamma distribution, which is a
different beast. Personally I find the S/S-Plus/R
convention of labelling all quantile functions -q<distribution>-
better than Stata's convention of calling quantile
functions inverse distribution functions. Among
other things, that leads to talk of the inverse of
the inverse gamma (Gaussian) distribution function,
which is potentially, if not actually, confusing.
Nick
[email protected]
Carlo Lazzaro
>
> According to Briggs A, Schuplper M, Claxton K. "Decision modelling for
> health economic evaluation". Oxford: Oxford University Press,
> 2006: 91-92, I
> have tried to address the uncertainty surrounding cost parameters as
> described below.
>
> 1) I have fitted a Gamma distibution (which, as You remarked,
> constrained
> between 0 and + infinitive; sorry for the previous mistake) with the
> original difference (always<0 for healthcare programme A) in
> cost data as
> follows:
>
> gen alfa=(mean/SE)^2; gen beta=SE^2/mean.
>
> Then, I drew random samples using:
>
> gen InvGamma=beta*invgammap(alfa, uniform()).
>
> 2) As You suggested, the results was always negative, and
> added nothing to
> my previous knowledge.
>
> 3) Hence, using the same Stata code, I have decided to fit
> two different
> Gamma distributions with the original cost data for each one
> of the compared
> health care programmes, draw random samples with two InvGamma
> distributions
> and eventually calculate the difference between the two Inv Gamma
> distributions. The results seemed to confirmed the base case findings.
Nick Cox
> This is unclear in several senses.
>
> 1. You do not say which commands you used.
>
> 2. Telling us your notation tells us little as there
> is no standardisation on notation or even parameterisation
> for the two-parameter gamma distribution across or within
> disciplines. In one common but not universal scheme the
> density is given, for variable x >= 0, shape parameter
> a > 0 and scale parameter b > 0, by
>
> [1 / (b^a gamma(a))] x^(a - 1) exp(-x / b),
>
> but last time I looked I encountered two other parameterisations
> in the literature. This one is what is used by -gammafit- from
> SSC.
>
> 3. It seems that this cannot be what you used as you
> report that your beta was negative.
>
> 4. beta * invgammap(alpha, probability) will yield
> negative results for negative beta and positive alpha.
>
> 5. I don't see that gamma random numbers using your
> fitted parameters will tell you anything that your
> data cannot, for example in terms of the difference
> associated with a covariate, health programme.
>
> 6. It sounds as if your variable may be negative.
> If I had a variable that looked like a gamma,
> apart from being all negative, I would fit
> a gamma to absolute values and then re-apply
> negation.
>
> 7. I don't understand what you mean by
> "being Gamma constrained on 0 to 1 interval".
Carlo Lazzaro
> > I have fitted a Gamma distribution with Stata 9/SE from a
> > dataset containing
> > savings (ie: cost difference all < 0) accrued to patients who
> > underwent
> > healthcare Programme A (50,000 patients) instead of
> > healthcare Programme B
> > (50,000 patients)
> > Parameter alfa was>0 but beta was less <0.
> >
> > Then I have drawn 50,000 random samples via InvGamma:
> >
> > gen InvGamma=beta*invgammap(alfa, uniform())
> >
> > InvGamma results confirmed that healthcare Programme A was
> always less
> > costly than Healthcare programme B.
> > However, being Gamma constrained on 0 to 1 interval, I really
> > do not know
> > whether the results of InvGamma are or not reliable.
*
* 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/