Used-Car Prices

Group Members: The whole class, together!

Introduction

Describe the car model you selected, the variables (including price, age, location, and mileage) you chose to look at, etc.

Reading in the Spreadsheet

You'll be reading in your spreadsheet from Google Docs. This example is based on the data provided as part of the mosaic package, but copied over to Google Docs just to show how to read in from a spreadsheet. Of course, you'll be setting up your own Google Doc and getting the public link to it to read in with fetchGoogle per these instructions.

Remember … you need to change the name of the data source to that for your own Google spreadsheet.

dataSource = "https://docs.google.com/spreadsheet/pub?key=0Am13enSalO74dEEya201eF9qamZ0VDlPbWY4eW1jemc&single=true&gid=0&output=csv"
cars = fetchGoogle(dataSource)

Description of Data

Density plots, scatter plots, etc. Whatever you think is informative.

The variables are

names(cars)
## [1] "Price"    "Year"     "Mileage"  "Location"
## [5] "Color"    "Age"
xyplot(Price~Age, data=cars, 
       ylab="Price ($)", xlab="Age (yrs)")

plot of chunk unnamed-chunk-4

Comment briefly to say what each of your plots shows, e.g. “Price goes down with age.”

densityplot(~Mileage, data=cars)

plot of chunk unnamed-chunk-5

Models

Here you'll give a few models, giving the model coefficients and interpreting them using language that might make sense to a well-educated car buyer.

mod1 = lm( Price ~ Age*Location, data=cars)
coef(mod1)
##            (Intercept)                    Age 
##             20473.9276             -1576.6873 
##     LocationSanta Cruz        LocationSt.Paul 
##               686.6259              -693.8565 
## Age:LocationSanta Cruz    Age:LocationSt.Paul 
##                -0.8085                73.0458
xyplot( fitted(mod1)~Age, data=cars)

plot of chunk unnamed-chunk-6

mod2 = lm( Price ~ Mileage, data=cars)
coef(mod2)
## (Intercept)     Mileage 
##  20766.5803     -0.1013

Interpret your coefficients in everyday terms.

Do several other models that you think might be of interest.

Comment on anything that's surprising to you.