0

I'm using rpart to fit a regression model using monthly weather data. I would like partitioning to be done in order: first Jan, then Feb and so on. Is there a way to set the order of the variables?

adding an example: I want the nodes of the tree to be in order.

set.seed(1)
jan<-sample(size=30,1:150)
feb<-sample(size=30,1:200)
mar<-sample(size=30,1:150)
yield<-sample(size=30,0.5:3.5,replace = TRUE)
model<-rpart(yield~jan+feb+mar,method = "anova", minsplit=3, minbucket=1)
rpart.plot(model)
Pablo Figueroa
  • 691
  • 1
  • 5
  • 7
  • 2
    Could you add a little [reproducible example](https://stackoverflow.com/help/mcve) I am not sure if I understand the desired behavior? – missuse Feb 25 '18 at 08:39
  • this is partly answered here but using ctree https://stackoverflow.com/questions/39844830/how-to-specify-split-in-a-decision-tree-in-r-programming – Pablo Figueroa Feb 27 '18 at 14:19

0 Answers0