Re: [Rd] residuals.glm for glm(..., y = FALSE)

2006-08-06 Thread Prof Brian Ripley
On Mon, 24 Jul 2006, Achim Zeileis wrote:

> I just ran into a problem with residuals.glm() for GLMs fitted with
>   glm(..., y = FALSE)
> For such fits, the residuals of type "deviance", "pearson" and "response"
> can't be computed (see example below). The reason is that residuals.glm()
> uses
>   y <- object$y
> which obviously can't work for such fits.
> 
> I've checked ?glm and ?residuals.glm and did not find it mentioned
> explicitely...looks like a bug to me.

Well, the original S code returns numeric(0): surely that is worse.

There is not enough information in the fit to recover the response 
residuals in general (the problem I see is with zero weights), so all we 
can do it throw an informative error.

> 
> Best,
> Z
> 
> ## example for poisson GLM from ?glm
>   d.AD <- data.frame(treatment = gl(3,3), outcome = gl(3,1,9),
> counts = c(18,17,15,20,10,20,25,13,12))
>   glm.D93 <- glm(counts ~ outcome + treatment, family = poisson,
> data = d.AD, y = FALSE)
> 
> ## residuals cannot be computed
>   residuals(glm.D93, type = "deviance")
>   residuals(glm.D93, type = "pearson")
>   residuals(glm.D93, type = "response")
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] residuals.glm for glm(..., y = FALSE) (PR#9124)

2006-08-04 Thread Achim . Zeileis
Last week I ran into a problem with residuals.glm() for GLMs fitted with
  glm(..., y = FALSE)
For such fits, the residuals of type "deviance", "pearson" and "response"
can't be computed (see example below). The reason is that residuals.glm()
uses
  y <- object$y
which obviously can't work for such fits.

I've checked ?glm and ?residuals.glm and did not find it mentioned
explicitely...hence this looks like a bug to me. (I've posted this last
week on R-devel and received no reply, hence I resubmitted it to R-bugs so
that it does not get lost.)

Best,
Z

## example for poisson GLM from ?glm
  d.AD <- data.frame(treatment = gl(3,3), outcome = gl(3,1,9),
counts = c(18,17,15,20,10,20,25,13,12))
  glm.D93 <- glm(counts ~ outcome + treatment, family = poisson,
data = d.AD, y = FALSE)

## residuals cannot be computed
  residuals(glm.D93, type = "deviance")
  residuals(glm.D93, type = "pearson")
  residuals(glm.D93, type = "response")

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] residuals.glm for glm(..., y = FALSE)

2006-07-24 Thread Achim Zeileis
I just ran into a problem with residuals.glm() for GLMs fitted with
  glm(..., y = FALSE)
For such fits, the residuals of type "deviance", "pearson" and "response"
can't be computed (see example below). The reason is that residuals.glm()
uses
  y <- object$y
which obviously can't work for such fits.

I've checked ?glm and ?residuals.glm and did not find it mentioned
explicitely...looks like a bug to me.

Best,
Z

## example for poisson GLM from ?glm
  d.AD <- data.frame(treatment = gl(3,3), outcome = gl(3,1,9),
counts = c(18,17,15,20,10,20,25,13,12))
  glm.D93 <- glm(counts ~ outcome + treatment, family = poisson,
data = d.AD, y = FALSE)

## residuals cannot be computed
  residuals(glm.D93, type = "deviance")
  residuals(glm.D93, type = "pearson")
  residuals(glm.D93, type = "response")

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel