Error with predict - incorrect number of dimensions

I'm currently having an error replicating code from a project designed to use machine learning to predict risk scores (risk of non-compliance) for facilities with clean water act permits. I've made a good deal of progress implementing the code but am running into a problem and because my background is environmental science and my r knowledge is extremely rudimentary I can't understand what's going wrong. The code is directly from the project and can be found here. I run into an error 533 lines into the referenced code. The error is with the code block below and states,

Error in predict(propensity.scores$forest, newdata = propensity.model.matrix.test, :
incorrect number of dimensions

test$pscore.forest <- predict(propensity.scores$forest, 
                                        newdata = propensity.model.matrix.test,
                                        estimate.variance = TRUE)$predictions[,1]

Any help would be much appreciated!

The first argument of predict() should be a model object, the output of some kind of fitting function.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.