FALL2021_-_Midterm_Exam_1_Part_2_Solutions (1)Midterm Exam 1 - Open Book Section (R) - Part 2
Recommended Packages
library(car)
## Loading required package: carData
Car Price Data Analysis
For this exam, you will be
...
FALL2021_-_Midterm_Exam_1_Part_2_Solutions (1)Midterm Exam 1 - Open Book Section (R) - Part 2
Recommended Packages
library(car)
## Loading required package: carData
Car Price Data Analysis
For this exam, you will be building a model to predict the price of second-hand cars (price).
The “USA_cars_datasets.csv” data set consists of the following variables:
• price: price of the second-hand car
• brand: brand of the car
• year: year of the car
• title_status: clean vehicle or salvage insurance
• mileage: mileage driven of the car
• color: color of the car
• users: number of previous users of the car
Read the data and answer the questions below. Assume a significance threshold of 0.05 for hypothesis tests
unless stated otherwise.
# Read the data set
cars = read.csv('USA_cars_datasets.csv', header=TRUE)
#Set brand and title_status as categorical
cars$brand<-as.factor(cars$brand)
cars$title_status<-as.factor(cars$title_status)
head(cars)
## price brand year title_status mileage color users
## 1 6300 toyota 2008 clean vehicle 274117 6 3
## 2 2899 ford 2011 clean vehicle 190552 10 2
## 3 5350 dodge 2018 clean vehicle 39590 3 1
## 4 25000 ford 2014 clean vehicle 64146 4 1
## 5 27700 chevrolet 2018 clean vehicle 6654 3 1
## 6 5700 dodge 2018 clean vehicle 45561 7 1
Note: For all of the following questions, treat all variables as quantitative variables except for brand, and
title_status. They have already been converted to categorical variables in the above code.
Question 1 - 5pts
Create an ANOVA model, called anovamodel, to compare the mean car price (price) among the different
car brands (brands). Display the corresponding ANOVA table.
A) Identify the value of the mean squared error (MSE) from the ANOVA table.
B) Provide the formula that is used to calculate the MSE in the table, and clearly explain what this
quantity rep
[Show More]