Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Prediction of diamond price set.seed( 1 ) data (diamonds)diamonds size= 5000 ) Use thesummary()function to obtain summaries of each variable in the diamonds dataset.
1. Prediction of diamond price
set.seed(1)data(diamonds)diamonds size=5000)
- Use thesummary()function to obtain summaries of each variable in the diamonds dataset. How many categorical variables are there? How many quantitative variables? Are there any missing values?
- Use thextabs()function to obtain cross-tabulations of all possible pairs of categorical variables. How many diamonds are of the best cut (Ideal) and clarity (IF)?
- Excluding price (our response variable), which three quantitative variables are most highly correlated with carat (weight of the diamond)?
- Remove x, y and z from the dataset and fit a model with price as the response variable and all main effects and possible interactions as explanatory variables. Call your fitted modelfit.full.
- Starting fromfit.full, and using the null model as the smallest model, use stepwise selection to select a model, using the BIC criterion. (You don't need to specify thescopeof the models -step()will search fromfit.fullto the null model by default.) What main effects and what interactions are included in the final model?
- For eachcategoricalexplanatory variable that appears in an interaction with carat in the model selected by stepwise selection, produce a scatterplot of price versus carat with the categorical interaction variable as color. For example, if there is a carat:clarity interaction, do
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