[R] Basic GLM: residuals definition
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Aug 27 18:28:17 CEST 2003
On Wed, 27 Aug 2003, Martin Hoyle wrote:
> Dear R Users,
>
> I suppose this is a school boy question, but here it is anyway. I'm trying to re-create the residuals for a poisson GLM with simulated data;
>
> x<-rpois(1000,5)
> model<-glm(x~1,poisson)
> my.resids<-(log(x)- summary(model)$coefficients[1])
> plot(my.resids,residuals(model))
>
> This shows that my calculated residuals (my.resids) are not the same as residuals(model).
> p 65 of Annette Dobson's book says that GLM (unstandardised) residuals are calculated by analogy with the Normal case.
> So where am I going wrong?
Not reading the help page. Hint: what is the default for the type
argument for the glm method for residual?
A much better reference for this is
Davison, A.~C. and Snell, E.~J. (1991) Residuals and diagnostics.
\newblock Chapter~4 of \cite{Hinkley.ZZ.91}.
Hinkley, D.~V., Reid, N. and Snell, E.~J. eds (1991) \emph{Statistical Theory
and Modelling. In Honour of Sir David Cox, {FRS}}.
\newblock London: Chapman \& Hall.
--
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
More information about the R-help
mailing list