so I ran a random forest model to observe impact of climate variables on evapotranspiration. I split the data into training data for fitting the model and testing data for testing the model. The OOB error seems to be low, but the plot of actual data vs predicted data is not making sense to me. How do I improve this please?
``
library(randomForest)
library(rpart)
#Splitting data into Training and Testing data
index <- sample(2, nrow(cdata), replace = TRUE, prob = c(0.8, 0.2))
#Training data
Training <- cdata[index==1,]
#Testing data
Testing <- cdata[index==2,]
#View(Testing)
#Building Model with training data
NumericET <- as.numeric(Training$ETc)
rfm.model <- randomForest(NumericET~., data = Training, ntree=500,)
summary(rfm.model)
plot(rfm.model)
#Testing model using predict function
predictmodel <- predict(rfm.model, data=Testing)
predictmodel
#Plotting Actual vs predicted values of Training data
library(ggplot2)
actualAndPredictedData = data.frame(actualValue = Testing$ETc,
predictedValue = predictmodel)
ggplot(actualAndPredictedData,aes(x = actualValue, y = predictedValue)) +
geom_point()+geom_abline()
#Check RMSE value
#install.packages("Metrics")
library(Metrics)
rmse(Testing$ETc,predictmodel)
``
