Re: [R] Error in x[good, ] * w : non-conformable arrays

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue 09 May 2006 - 21:31:20 EST

Who said that an offset can be an array in glm? (It can be in other contexts).

On Tue, 9 May 2006, Mark Clements wrote:

>> From posts in Sep 2004 and Feb 2005, glm() was raising "Error in x[good, ] * w : non-conformable arrays". I can reproduce this error using:

Neither of those were using an offset, and the second was using a home-brewed family. I guess the issue was with the weights.

> df1 = data.frame(u=1:10,
> v=rpois(10,10),
> z=array(1,10,dimnames=list(1:10)))
> glm(v~u+offset(log(z)), data=df1, family=poisson)
>
> -- which seems to be due to the variable z have dimnames.

Rather, having a dim.

In glm.fit(), the error is traced to some weight vector w having class "numeric" on the first iteration and class "array" on the second iteration. Would this problem be solved by changing "x[good, ] * w" in glm.fit() to "x[good, ] * as.numeric(w)"?

That's not the place to fix it, and you want as.vector() or drop() rather than as.numeric. It would be more informative to check that the offset(s) are vectors and numeric.

>
> With kind regards, Mark Clements.
>
> https://stat.ethz.ch/pipermail/r-help/2005-February/066784.html
> https://stat.ethz.ch/pipermail/r-help/2004-September/057888.html
>
> ______________________________________________
> R-help@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
>

-- 
Brian D. Ripley,                  ripley@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

______________________________________________
R-help@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
Received on Tue May 09 21:37:15 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 09 May 2006 - 22:10:01 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.