[Rd] loess "method" bugfix (PR#3332)
minka at stat.cmu.edu
minka at stat.cmu.edu
Wed Jun 25 03:51:26 MEST 2003
There appears to be a bug in loess. It fails when you specify
"method". For example:
data(cars)
cars.lo <- loess(dist ~ speed, cars)
# works, and should be the same as:
cars.lo <- loess(dist ~ speed, cars, method="loess")
# but this fails with:
Error in model.frame(formula, rownames, variables, varnames, extras,
extranames, :
invalid variable type
Included is a possible fix (only one line is added).
Tom
loess <-
function(formula, data=NULL, weights, subset, na.action, model = FALSE,
span = 0.75, enp.target, degree = 2, parametric = FALSE,
drop.square = FALSE, normalize = TRUE,
family = c("gaussian", "symmetric"),
method = c("loess", "model.frame"),
control = loess.control(...), ...)
{
family <- match.arg(family)
method <- match.arg(method)
mt <- terms(formula, data = data)
mf <- match.call(expand.dots=FALSE)
mf$model <- mf$span <- mf$enp.target <- mf$degree <-
mf$parametric <- mf$drop.square <- mf$normalize <- mf$family <-
mf$control <- mf$... <- NULL
# minka: bugfix
mf$method <- NULL
mf[[1]] <- as.name("model.frame")
mf <- eval(mf, parent.frame())
[rest is the same]
}
More information about the R-devel
mailing list