R-beta: more glm bugs
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Mon Jan 26 18:38:04 CET 1998
Thomas Lumley <thomas at biostat.washington.edu> writes:
> On Mon, 26 Jan 1998, Jim Lindsey wrote:
> > 1. At least on my computer, fitting a saturated gamma model with glm
> > gives a core dump:
> > glm(rgamma(20,1,1)~gl(20,1,20), family=Gamma)
> I can't reproduce this problem on 0.50-a4, 0.60 or 0.61.1.
Nor can I (RedHat Linux 4.2)
> > 2. Factor variables are not vectors!!
> > is.vector(gl(20,2,40)) gives FALSE
> Even stranger
> R> is.vector(factor(1:3))
>  FALSE
> R> is.factor(factor(1:3))
>  TRUE
> R> is.vector(as.vector(factor(1:3)))
>  TRUE
> R> is.factor(as.vector(factor(1:3)))
>  TRUE
> so that factor variables *can* be vectors, but aren't naturally.
The bottom line seems to be this:
So vectors can't have attributes. Those are getting stripped off by
as.vector(), so in some sense something is making sense... does look
like a bit strange, BUT:
S-PLUS : Copyright (c) 1988, 1996 MathSoft, Inc.
S : Copyright AT&T.
Version 3.4 Release 1 for Sun SPARC, SunOS 5.3 : 1996
Working data will be in .Data
I.e., exactly the same. And to top it off:
er, that's cheating! There's no 'gl' function in S-plus, but:
function(n, k, length, labels = 1:n, ordered = FALSE)
factor(rep(rep(1:n, rep(k, n)), length = length), labels = labels)
(apparently I hacked one up at some earlier point while trying to run
R's glm+lm demo through Splus...)
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help