If I understand wellFirstly, you are talking about to use the function predict()
.
So you have theget your model:
LM <- lm(PSR ~ Area+Forests, data = Wetlands)
Make sure all data values are correct.
The function predict()
provide this usagedoes the calculation:
pred <- pred(your_model, your_data_test)
butYour issue seems that your_data_test
have more variables than your model, right?
YouSo you can makeslice your_data_test
and put into a new_data_test
by using this,
new_data_test <- data.frame(your_data_test$variable1,your_data_test$variable2)
and then
pred <- pred(yourmodel, new_data_test)
I suppose that this mayshould be works wellwork for you.