[Rd] Bug?: summary() fails after use of na.action="na.exclude" in lm()

Gregor Gorjanc gregor.gorjanc at bfro.uni-lj.si
Wed Jul 19 11:24:49 CEST 2006


Hello!

I have encountered a weird problem and I am wondering if this is a bug.
Here is the example:

n <- 50
x <- runif(n=n)
y1 <- 2 * x + rnorm(n=n)
y2 <- 5 * x + rnorm(n=n)
y2[sample(1:n, size=5)] <- NA

y <- cbind(y1, y2)

fit <- lm(y1 ~ 1, na.action="na.exclude")
summary(fit)

## Goes ok here
fit <- lm(y2 ~ 1, na.action="na.exclude")
summary(fit)

## But fails if we use matrix of response variables
fit <- lm(y ~ 1, na.action="na.exclude")
summary(fit)

## Response y1 :
##
## Call:
## lm(formula = y1 ~ 1, na.action = "na.exclude")
##
## Residuals:
## Error in quantile.default(resid) : missing values and NaN's not
allowed if 'na.rm' is FALSE

Am I doing something wrong here?

----------------------------------------------------------------------

Btw. man page of lm says (in the begining of the details):

"A typical model has the form 'response ~ terms' where 'response' is the
(numeric) response vector ..."
                   ^^^^^^

Should not this part say that repsponse can also be a matrix?

Thanks

-- 
Lep pozdrav / With regards,
    Gregor Gorjanc

----------------------------------------------------------------------
University of Ljubljana     PhD student
Biotechnical Faculty
Zootechnical Department     URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3                   mail: gregor.gorjanc <at> bfro.uni-lj.si

SI-1230 Domzale             tel: +386 (0)1 72 17 861
Slovenia, Europe            fax: +386 (0)1 72 17 888

----------------------------------------------------------------------
"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.



More information about the R-devel mailing list