Non-Linear Regression in R with Decision Trees
![](https://www.deeplearningdaily.com/wp-content/uploads/2020/09/non-linear-regression-in-r-with-decision-trees_5f61cf8389834-600x400.jpeg)
Last Updated on August 15, 2020
In this post, you will discover 8 recipes for non-linear regression with decision trees in R.
Each example in this post uses the longley dataset provided in the datasets package that comes with R.
The longley dataset describes 7 economic variables observed from 1947 to 1962 used to predict the number of people employed yearly.
Kick-start your project with my new book Machine Learning Mastery With R, including step-by-step tutorials and the R source code files for all examples.
Let’s get started.
![decision tree](https://3qeqpr26caki16dnhd19sv6by6v-wpengine.netdna-ssl.com/wp-content/uploads/2014/07/decision-tree.jpg)
Decision Tree
Photo by Katie Walker, some rights reserved
Classification and Regression Trees
Classification and Regression Trees (CART) split attributes based on values that minimize a loss function, such as sum of squared errors.
The following recipe demonstrates the recursive partitioning decision tree method on the longley dataset.