Hello, The estimate of glm dispersion can be based on the deviance or on the Pearson statistic. I have compared output from R glm() to another statastical package and it appears that R uses the Pearson statistic. I was wondering if it is possible to make use R the deviance instead by modifying the glm(...) function? Thanks for your attention. Kind regards, Robin Smit This e-mail and its contents are subject to the DISCLAIMER at http://www.tno.nl/disclaimer/email.html [[alternative HTML version deleted]]
Adaikalavan Ramasamy
2005-Jul-11 10:19 UTC
[R] calculating dispersion formula using deviance ( was Re: (no subject) )
Please try to use a meaningful subject line. See below for comments. On Mon, 2005-07-11 at 11:30 +0200, Smit, R. (Robin) wrote:> Hello, > > The estimate of glm dispersion can be based on the deviance or on the > Pearson statistic. > I have compared output from R glm() to another statastical package and > it appears that R uses the Pearson statistic.A quick search would also highlight the following thread http://www.r-project.org/nocvs/mail/r-help/2002/6938.html> I was wondering if it is possible to make use R the deviance instead by > modifying the glm(...) function?I don't know what the formula for using the deviance is but _IF_ it is the square root of ratio of null deviance by its degrees of freedom, then sqrt( fit$deviance / fit$df.null ) should be useful.> Thanks for your attention. > > Kind regards, > Robin Smit > > > > This e-mail and its contents are subject to the DISCLAIMER at http://www.tno.nl/disclaimer/email.html > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
Actually, glm() does not estimate the dispersion at all, so you will need to be more specific. For example, summary.glm() and predict.glm() use the Pearson statistic if dispersion=NULL (the default) for most families. You can supply any other value you choose, and the MASS package makes use of this for ML estimation of the dispersion parameter (related to the shape) of the gamma family. There are rather good reasons (serious bias) not to use the deviance estimate in the binomial and Poisson families (see the example plots in MASS4), and good reasons not to use either in the gamma family. As the Pearson and deviance estimates agree for the gaussian, that does leave begging the question of why you want to do this. Further, McCullagh & Nelder have general arguments why the Pearson estimate might always be preferred to the deviance one. So that `another statastical package' appears to need justification for its choice. On Mon, 11 Jul 2005, Smit, R. (Robin) wrote:> The estimate of glm dispersion can be based on the deviance or on the > Pearson statistic. > I have compared output from R glm() to another statastical package and > it appears that R uses the Pearson statistic. > I was wondering if it is possible to make use R the deviance instead by > modifying the glm(...) function? > Thanks for your attention.-- Brian D. Ripley, ripley at 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 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595