# Example of Fit Model for TreeNet® Regression

###### Note

A team of researchers wants to use data about a borrower and the location of a property to predict the amount of a mortgage. Variables include the income, race, and gender of the borrower as well as the census tract location of the property, and other information about the borrower and the type of property.

After initial exploration with CART® Regression to identify the important predictors, the team now considers TreeNet® Regression as a necessary follow-up step. The researchers hope to gain more insight into the relationships between the response and the important predictors and predict for new observations with greater accuracy.

These data were adapted based on a public data set containing information on federal home loan bank mortgages. Original data is from fhfa.gov.

1. Open the sample data set PurchasedMortgages.MTW.
2. Choose Predictive Analytics Module > TreeNet® Regression > Fit Model.
3. In Response, enter Loan Amount.
4. In Continuous predictors, enter Annual IncomeArea Income.
5. In Categorical predictors, enter First Time Home BuyerCore Based Statistical Area.
6. Click Validation.
7. In Validation method, select K-fold cross-validation.
8. In Number of folds (K), enter 3.
9. Click OK in each dialog box.

## Interpret the results

For this analysis, Minitab grows 300 trees and the optimal number of trees is 300. Because the optimal number of trees is close to the maximum number of trees that the model grows, the researchers repeat the analysis with more trees.

## Example with 500 trees

1. After the model summary table, click Tune Hyperparameters to Identify a Better Model.
2. In Number of trees, enter 500.
3. Click Display Results.

## Interpret the results

For this analysis, there were 500 trees grown and the optimal number of trees for the combination of hyperparameters with the best value of the accuracy criterion is 500. The subsample fraction changes to 0.7 instead of the 0.5 in the original analysis. The learning rate changes to 0.0437 instead of 0.04372 in the original analysis.

Examine both the Model summary table and the R-squared vs Number of Trees Plot. The R2 value when the number of trees is 500 is 86.79% for the test data and is 96.41% for the training data. These results show improvement over a traditional regression analysis and a CART® Regression. The Relative Variable Importance graph plots the predictors in order of their effect on model improvement when splits are made on a predictor over the sequence of trees. The most important predictor variable is Core Based Statistical Area. If the importance of the top predictor variable, Core Based Statistical Area, is 100%, then the next important variable, Annual Income, has a contribution of 92.8%. This means the annual income of the borrower is 92.8% as important as the geographical location of the property. The scatterplot of fitted loan amounts versus actual loan amounts shows the relationship between the fitted and actual values for both the training data and the test data. You can hover over the points on the graph to see the plotted values more easily. In this example, all points fall approximately near the reference line of y=x. Use the partial dependency plots to gain insight into how the important variables or pairs of variables affect the fitted response values. The partial dependence plots show whether the relationship between the response and a variable is linear, monotonic, or more complex. The first plot illustrates the fitted loan amount for each core based statistical area. Because there are so many data points, you can hover over individual data points to see the specific x– and y–values. For instance, the highest point on the right side of the graph is for core area number 41860 and the fitted loan amount is approximately \$378069. The second plot illustrates that the fitted loan amount increases as the annual income increases. After annual income reaches \$300000, the fitted loan amount levels increase at a slower rate. The third plot illustrates that the fitted loan amount increases as the front end ratio increases. The fourth plot illustrates the fitted loan amount for each census county code. As with the first plot, you can hover over certain data points to get more information. Click Select More Predictors to Plot to produce plots for other variables.
By using this site you agree to the use of cookies for analytics and personalized content.  Read our policy