[R] Problem Creating Partial Dependence Plot

Stephen Milborrow milbo at sonic.net
Fri May 30 09:10:53 CEST 2014


> Jane Shevtsov wrote:
>
> I am trying to use the plotmo package to generate a partial dependence 
> plot
> for a CART model created with rpart. When running plotmo, I get "Error:
> get.plotmo.y returned the wrong length (got 204938 expected 205000)". The
> rpart predict function does indeed return 204938 results, but plotmo is
> supposed to be able to handle NA's in rpart models.  What I might do about
> this?

It’s because you have NAs in y; plotmo only allows them in x (and then only 
with rpart models).  The plotmo help page is admittedly not clear on this 
and I will update it in due course.



More information about the R-help mailing list