?na.exclude should help you: my guess is that you asked (by using the
default) na.action = na.omit) for rows with missing values to be excluded
from the residuals. But since you have not mentioned missing values, we
have to guess what 'for some reason' was: please note the footer of this
messag
Specify na.action = na.exlude, e.g.
> x <- y <- 1:10; x[5] <- NA
> fitted(lm(y ~ x, na.action = na.exclude))
1 2 3 4 5 6 7 8 9 10
1 2 3 4 NA 6 7 8 9 10
On 9/14/06, Robi Ragan <[EMAIL PROTECTED]> wrote:
> I am running a regression:
>
> ols.reg1 <- lm(y ~ x1 + x2 + x3 + x4)
>
> on
I am running a regression:
ols.reg1 <- lm(y ~ x1 + x2 + x3 + x4)
on a data.frame
and then generating fitted values:
y.hat <- ols.reg1$fitted.values
Then I would like to add these fitted values to the data.frame as a
new variable. The problem is that when the values are predicted the
resulting