[R] Basic GLM: residuals definition

Hotz, T. th50 at leicester.ac.uk
Wed Aug 27 18:24:11 CEST 2003


As ?residuals.glm reveals, it's got an argument type:

    type: the type of residuals which should be returned. The
          alternatives are: `"deviance"' (default), `"pearson"',
          `"working"', `"response"', and `"partial"'.

You calculated "response" residuals, R gives "deviance" residuals 
by default. The different types are covered by most books on general
linear models.

HTH

Thomas


> -----Original Message-----
> From: Martin Hoyle [mailto:plxmh at nottingham.ac.uk]
> Sent: 27 August 2003 17:01
> To: r-help at stat.math.ethz.ch
> Subject: [R] Basic GLM: residuals definition
> 
> 
> 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?
> 
> Thanks for your attention.
> 
> Martin.
> 
> 
> Martin Hoyle,
> School of Life and Environmental Sciences,
> University of Nottingham,
> University Park,
> Nottingham,
> NG7 2RD,
> UK
> Webpage: http://myprofile.cos.com/martinhoyle
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

---

Thomas Hotz
Research Associate in Medical Statistics
University of Leicester
United Kingdom

Department of Epidemiology and Public Health
22-28 Princess Road West
Leicester
LE1 6TP
Tel +44 116 252-5410
Fax +44 116 252-5423

Division of Medicine for the Elderly
Department of Medicine
The Glenfield Hospital
Leicester
LE3 9QP
Tel +44 116 256-3643
Fax +44 116 232-2976




More information about the R-help mailing list