Group Members: Stephanie Duong, Hanyue Xu, Luisa Aya, Lauren Holm
Our models were generated using data that we collected from www.cars.com. We looked at used Honda Civics (a car model from a Japanese motor company) within 10 miles of zip code 55105. The variables that we collected were the price of the car (in dollars), mileage, model, year, location (by zip code), the number of doors, type of engine (by liters), and color of the exterior of the car. We calculated the age of the car by subtracting the model year from the current year (2013). The response variable here is price. The rest are explanatory variables. The reason for collecting this data is to see if we can explain the car price variation within our data.
dataSource = "https://docs.google.com/spreadsheet/pub?key=0Ak21sCy4zh9KdEh3WnlxNzJuazBid1pSbVhpcFdFcVE&output=csv"
cars = fetchGoogle(dataSource)
We start by plotting our response variable with one explanatory variable. Here is an xyplot of the price of used Honda Civics with respect to their age.
xyplot(Price~Age, data=cars,
ylab="Price", xlab="Age")
The price of an used Honda Civic appears to go down as age increases.
Here is a graph with a fitted model to the xyplot above. It reinforces our observations from above that price of used Honda Civics decrease with age increase.
model7 = lm(Price ~ Age, data = cars)
g7 = makeFun(model7)
xyplot(Price ~ Age, data = cars, auto.key = TRUE)
plotFun(g7(Age = x) ~ x, x.lim = range(0, 100), xlab = "Age", add = TRUE)
Another explanatory variable we looked at was mileage of the cars. Here we plots the price with respect to their mileage.
xyplot(Price~Mileage, data=cars)
Price appears to go down as the mileage increases.
bwplot(Doors~Price, groups = Doors, data=cars, ylab="Doors (in Pairs)", xlab="Price")
It appears that cars with two pairs of doors tend to cost more than cars with one pair of doors.
mod1 = lm(Price ~ Age, data=cars)
coef(mod1)
## (Intercept) Age
## 18057 -1043
According to the model above, a brand new car should cost $18,057. For each year of ownership, the value should depreciate by $1,043.
mod2 = lm(Price ~ Mileage, data=cars)
coef(mod2)
## (Intercept) Mileage
## 1.834e+04 -9.204e-02
According to this model, a car with zero miles is worth $18,340. For each mile driven, the value depreciates by 9 cents.
mod3 = lm(Price ~ Mileage + Age, data=cars)
coef(mod3)
## (Intercept) Mileage Age
## 1.856e+04 -5.078e-02 -5.610e+02
In mod3, a new car with zero miles is worth $18,560. For each mile driven, the value of the car depreciates by $0.05. For each year it ages the car depreciates by $0.056.