[R] residuals: lm and glm

Thomas Lumley tlumley at u.washington.edu
Wed Dec 11 18:08:56 CET 2002


On Wed, 11 Dec 2002, Kazuki Miyamoto wrote:

> Dear list members,
>
> I would like to know the difference in outputs and calculation processes
> between residuals.glm(object, type="response") and residuals.lm(object).

There's one very important similarity between these calls: you probably
shouldn't use either of them. Calling methods directly is generally a bad
idea.

residuals.lm() returns the $residuals component of the object. In an lm()
this is the residuals, but in a glm()  it is the working residuals. That's
why you shouldn't call residuals.lm() on a glm.

residuals.glm(, type="response") returns the observed value minus the
fitted value.


	-thomas




More information about the R-help mailing list