Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use the rpart function in R to creat a decision tree model for the Insurance Category dependent variable. Do not forget to load library(rpart). Provide
- Use the rpart function in R to creat a decision tree model for the Insurance Category dependent variable. Do not forget to load library(rpart). Provide evidence in Word that you have created the model.
- Using summary(
), identify the three most important independent variables used to predict Insurance Category. In Word, show evidence of the three top independent variables. Writ a short explanation of your findings. - Use Tools > Install Packages in the R Studio application menu to install the rpart.plot package. Once installed, load this package using library(rpart.plot). Then, use the prp function to visualize your decision tree. You may need to resize the Plots window in the lower right part of your R Studio application to make the tree large enough to read. In your prp function, include the following parameters: extra=4, faclen=0, varlen=0, cex=.75. The extra parameter includes the confidence percentages in each leaf of your tree; faclen causes the independent variable names to be spelled out in the tree; varlen causes the dependent variable values to be spelled out in the tree, and cex sets the font size (you can experiment with this if you would like). In your Word document, include a screen capture of your visualized decision tree. Writ a short explanation of how the percentages in each tree leaf would be interpreted.
- Make predictions for each of the policy buyers by applying your decision tree model the Policy Buyers data set. When using the predict function in R, be sure to include the parameter type="class" so that you will generate an Insurance Category for each policy buyer. Using the Filter feature in R Studio, report the number of policy buyers that you predict will fall into each of the four categories. Be sure to label these clearly in your Word document. If you have done this step correctly, the numbers predicted for each category should total to 473, which is the number of records in the Policy Buyers data set.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started