glm code bug (PR#224)
Bill.Venables@cmis.csiro.au
Bill.Venables@cmis.csiro.au
Tue, 13 Jul 1999 07:13:46 +0200 (MET DST)
Peter,
There is a clear and simple bug in glm() that I have noticed in
0.64.2 (Windows and Unix) but may have been present in earlier
versions.
The function starts as follows:
> glm
function (formula, family = gaussian, data = list(), weights = NULL,
subset = NULL, na.action = na.fail, start = NULL, offset = NULL,
control = glm.control(...), model = TRUE, method = "glm.fit",
x = FALSE, y = TRUE, contrasts = NULL, ...)
{
call <- match.call(expand.dots = FALSE) ### <<<<----------------------------
## family
if (is.character(family))
family <- get(family)
if (is.function(family))
family <- family()
## extract x, y, etc from the model formula and frame
if (is.null(family$family)) {
print(family)
stop("`family' not recognized")
}
mt <- terms(formula, data = data)
if (missing(data))
data <- sys.frame(sys.parent())
mf <- match.call() ### <<<<----------------------------
mf$family <- mf$start <- mf$control <- mf$maxit <- NULL
mf$model <- mf$method <- mf$x <- mf$y <- mf$contrasts <- NULL
mf$... <- NULL
######
The two marked lines should clearly be
call <- match.call()
and
mf <- match.call(expand.dots = FALSE)
The error in the first line can case problems with update() (I
suspect) but the error in the second line does not allow isolated
control arguments (like trace = T) to appear on the main call as
they get passed on to the call to model.frame, causing
pandemonium. As a confirmation of the second change above,
unless you do have (expand.dots = FALSE) the last line quoted
above has no effect.
Regards,
Bill Venables.
--
-----------------------------------------------------------------
Bill Venables, Statistician, CMIS Environmetrics Project.
Physical address: Postal address:
CSIRO Marine Laboratories, PO Box 120,
233 Middle St, Cleveland, Queensland Cleveland, Qld, 4163
AUSTRALIA AUSTRALIA
Telephone: +61 7 3826 7251 Email: Bill.Venables@cmis.csiro.au
Fax: +61 7 3826 7304
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._