Duncan Murdoch
2002-Jan-18 17:06 UTC
[Rd] How do I know if the deviance of a glm fit was fixed?
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? Duncan Murdoch -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thomas Lumley
2002-Jan-18 17:14 UTC
[Rd] How do I know if the deviance of a glm fit was fixed?
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 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof Brian Ripley
2002-Jan-18 17:26 UTC
[Rd] How do I know if the deviance of a glm fit was fixed?
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?Did you mean dispersion fixed? S/R do not take the dispersion into account: it is not in the fit. It is used by the summary, predict and anova methods (and that's all as I recall). And they do look at the family name. -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Gordon Smyth
2002-Jan-19 06:52 UTC
[Rd] How do I know if the deviance of a glm fit was fixed?
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._