From smyth@wehi.edu.au  Sat Jan 19 06:52:57 2002
From: smyth@wehi.edu.au (Gordon Smyth)
Date: Sat, 19 Jan 2002 17:52:57 +1100
Subject: [Rd] How do I know if the deviance of a glm fit was fixed?
In-Reply-To: <Pine.A41.4.44.0201180913240.16914-100000@homer26.u.washing
 ton.edu>
References: <ldlg4u4kjhdff9g4j1ii2e3ri418t9pgsq@4ax.com>
Message-ID: <5.1.0.14.1.20020119171507.00ad5840@wehiz.wehi.edu.au>

I think that it could improve the glm family function to include an 
argument or attribute that tells explicitly that the dispersion is fixed, 
equivalent to the $scale declaration in GLIM. This would be set T by 
default for the binomial and Poisson families and F by default for most 
other families. This could be done I think in a way which would add extra 
features but would not contradict the S-Plus "Blue Book". In effect, I 
would like the dispersion to be considered part of the "fit" of a glm 
because it is needed for standard errors and hypothesis testing.

The advantage of an explicit fixed-dispersion-attribute would come when
(i) the dispersion happens to be known even though the dispersion is not 
always known for the response family being used. Eg the family is Gamma but 
you know that the responses are multiples of chi-square random variables on 
1 df.
(ii) someone defines a new glm family, other than the binomial or Poisson, 
with fixed dispersion
(iii) one want to use a binomial or Poisson family with variable 
dispersion, without switching to the quasi family.

In case (i), you can work around by calling summary with dispersion=2 (for 
chisquare_1 responses), but not all functions which take glm.objects as 
arguments have a dispersion argument. And in the spirit of object 
orientated programming, shouldn't the glm.object contain all the 
information necessary to construct a standard error or anova from it?

I am enjoying becoming a regular R user. Thanks to all for your work in 
providing a terrific piece of free software.
Gordon Smyth

At 09:14 AM 18/01/2002 -0800, Thomas Lumly wrote:
>On Fri, 18 Jan 2002, Duncan Murdoch wrote:
>
> > I'm writing functions that need to behave differently for
> > GLMs like binomial and Poisson with fixed deviance, and those like
> > normal or gamma or quasi where the deviance is estimated from the
> > data.  Given a glm object, is there a simple way to tell this
> > directly, or do I have to look at the name of the family?
> >
>
>I assume you  mean dispersion rather than deviance.
>
>You have to look.  This information can be specificied by the user to
>summary.glm(), but not to glm() itself. Presumably the reason is that the
>fit doesn't depend on the dispersion.
>
>
>         -thomas

---------------------------------------------------------------------------------------
Dr Gordon K Smyth, Bioinformatics,
Walter and Eliza Hall Institute of Medical Research,
Post Office, Royal Melbourne Hospital, Vic 3050
Tel: (03) 9345 2326, Fax (03) 9347 0852,
Email: smyth@wehi.edu.au, www: http://www.statsci.org

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] How do I know if the deviance of a glm fit was fixed?
Gordon Smyth