Change data
to newdata
. Look at ?predict.lm
to see what arguments predict
can take. Additional arguments are ignored. So in your case data
(and OOB
) is ignored and the default is to return predictions on the training data.
Prediction <- predict(fit, newdata = combi[is.na(combi$Price),])
identical(predict(fit), predict(fit, data = combi[is.na(combi$Price),]))
## [1] TRUE