I build a prediction modeling using both regression and random forest.
testmodel2<-lm(y~as.matrix(xtest))
summary(testmodel2)
rf2<-randomForest(y~.,data=df,importance=TRUE)
varImpPlot(rf2)
The regression model result shows that t1, t10 and t11
are not significant. However, the varImpPlot
show that they are pretty important. On the other side, t3,t5 and t6
are significant in terms of P-value in the regression result, but they are not important in the Random forest result.
Is there any reason that linear regression result is different with random forest? Which one should be more reliable? The correlation matrix is also attached for the reference. The result of backward step-wise variable selection
is also attached.