## Loading required package: lattice

EDA Overview - Palouse Region and Wheat commodity loss

This is an exploratory data analysis document that describes some commodity loss outputs for wheat, drought related claims across the 26 county region of the Palouse. Dashboards available @ http://dmine.io.

###A recursively partitioned decision tree with a minimum split of 20.
library(rpart.plot)
## Loading required package: rpart
attach(myfiles_allyears)

# Make big tree
form <- as.formula(loss ~ tmmx + pr + pdsi + prpet + erc)
tree.1 <- rpart(form,data=myfiles_allyears,control=rpart.control(minsplit=20,cp=0))
# 

tree.2 <- rpart(form)           # A more reasonable tree
#prp(tree.2)                                     # A fast plot                                                  
#fancyRpartPlot(tree.1, )   
rpart.plot(tree.2)

A deeper tree with more levels…

#--more detailed tree
rpart.plot(tree.1, # middle graph
           extra="auto", box.palette="GnBu",
           branch.lty=5, shadow.col="gray", nn=TRUE)