How Much is My Used Car Worth?
Maybe you've tried to sell a car, only to find that you couldn't get nearly as much money as you thought! Perhaps you have tried to buy a used car, only to find that it cost much more than you could have imagined! Or you purchased a used car for a reasonable price only to find that the car had unexpected problems that were invisible on the surface!
In this web scraping project, I set out to see which factors affected the resale price of a used car, and by what factor.
To do this, I web scraped Carfax: https://www.carfax.com/.
Carfax is a website that is well known for checking the history and status of used cars to help used car buyers from being sold a car that has problems that the buyer is unaware of.
Using Selenium, I extracted the URLs of the webpage for each car using the following used filters:
- Sold within a 50 mile radius of New York city
- Under $15,000
Once all the URLS were collected, I extracted the detailed information for each car using scrapy. Here is a sample webpage:
Boxplot of Price vs. Year:
Barchart of Price vs. Year:
I was curious to see why the trend of prices decreasing as the age of the car was not followed in the year 2015. I noticed something interesting when looking at the number of listings per year.
Because many cars are leased for 3 years and returned, the number of cars that are 3 years old being sold is significantly higher! This could be a factor as to why the sale price in 2015 was higher than in other years.
Another large factor in the resale of cars in the mileage. The following is a histogram of the number of used cars sold by mileage:
The density plot:
The values for Mean and Median:
A hex chart of price vs. mileage:
A density plot of price vs. mileage:
When comparing by "make" since the filter of less than $15,000 was set, the data could be skewed for luxury brands in particular, but the following shows a general view of the resale prices categorized by make:
The following is price categorized by the body style:
For those who are green, here is a breakdown of the resale price by energy source. (Note: there was only one result for "Alternative" energy source, so the data may not accurately reflect the category.)
Breakdown by Transmission:
I compared the automatic vs. manual transmission purchases with a two-sample t-test to see if the means were statistically different:
They were statistically different! A car with an automatic transmission sells for approximately $1300 more than a car with a manual transmission.
Many people are concerned with the title status of a new car. Here is the breakdown by title status:
An interesting comparison was between resale values of cars that had accidents, and cars that did not:
It is clear that No Accidents Reported had a significant impact on the resale price:
Ultimately the two-sample t-test showed that the means of these categories were different. The mean difference was $1150.
Finally, based on the data, here is a breakdown of the models with the top resale value:
1. An automatic transmission resells at about $1300 more than a manual transmission.
2. A used car without accidents reported resells at about $1150 more than a car with accidents reported.
Sedans resell better than other body types of used cars. (By observation, t-test not performed.)
These results can be applied not only for those who are interested in purchasing a used car, but also for:
- Those considering purchasing a new car.
- Whether or not to buy or lease a new car.
- Whether to sell a currently owned used car or keep it.