Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: gamma constraints using glm


From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: gamma constraints using glm
Date   Wed, 17 Jul 2002 17:31:01 +0100

At 16:24 17/07/02 +0100, Toby Andrew wrote:
Dear Statalist,

Could anyone tell me how to constrain a gamma distribution to chi-squared using GLM in Stata 7.0?
You don't specify why you wish to do this. However, a chi-squared distribution with k degrees of freedom is simply a gamma distribution with inverse squared coefficient of variation k/2 and scale parameter 1/2, or, equivalently, with mean k and variance of 2k. If you don't want to constrain k to be an integer, then you are effectively using the Poisson variance function variance=phi*mu, fixing phi=2. If you want to constrain k to be an integer, then you are getting outside the framework of generalized linear models.

You don't say what link you are using. However, if you use

glm y x1-xn, family(poisson) scale(2) link(whatever_you_want_to_use)

and ignore any message about non-integer y-values, then you will be fitting maximum quasi-likelihood estimates with the correct link and variance function for a chi-squared distribution. In generalized linear models, the -family- option specifies a variance function, ie a function for deriving the variance from the mean and a single parameter phi, and the -link- option specifies a function defining the mean as a function of sum(x_j*beta_j).

I hope this helps.

Roger


--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]

Opinions expressed are those of the author, not the institution.

*
* 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/




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