Packages and settings – R and Python
As the chapter reviews some of the techniques in the latter half of the book, we need a lot of packages and functions:
- First set the working directory:
setwd("MyPath/R/Chapter_10")
- Load the required R package:
library(RSADBE) library(rpart) library(rattle) library(MASS) library(ROCR)
- A host of functions from
numpy
,pandas
,matplotlib
, andsklearn
will be required for Python analyses:
Understanding recursive partitions
The name of the library package rpart
, shipped along with R, stands for Recursive Partitioning. The package was first created by Terry M Therneau and Beth Atkinson, and is currently maintained by Brian Ripley. We will first have a look at what recursive partitions means.
A complex and contrived relationship is generally not identifiable by linear models. In the previous chapter, we saw the extensions of the linear models in piecewise, polynomial, and spline regression models.
It is also well known that if the order of a model is...