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

From: Gregor Gorjanc <gregor.gorjanc_at_bfro.uni-lj.si>
Date: Wed 19 Jul 2006 - 09:24:49 GMT


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.

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed Jul 19 19:31:39 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 Wed 19 Jul 2006 - 18:31:24 GMT.

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