I\'m using a data frame with many NA values. While I\'m able to create a linear model, I am subsequently unable to line the fitted values of the model up with
NA
I use a simple for loop. The fitted values have an attribute (name) of the original row they belonged to. Therefore:
for(i in 1:nrow(data)){ data$fitted.values[i]<- fit$fitted.values[paste(i)] }
"data" is your original data frame. Fit is the object from the model (i.e. fit <- lm(y~x, data = data))