Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Used Car Price Prediction (LASSO / Post-LASSO OLS)

Group project — ST404, University of Warwick (Group 6)

Overview

A statistical modelling project identifying the key drivers of used car prices in a US car-listings dataset (~1,125 vehicles, 19 variables). Using LASSO regression for variable selection and a post-LASSO OLS model for inference, we identified 9 variables explaining ~56% of the variation in log(price).

This was completed as a group assignment; the analysis, modelling, and write-up were a collaborative effort.

What this project covers

Data cleaning

  • Standardised inconsistent categorical labels (Drivetrain, FuelType, Transmission, etc.)
  • Log-transformed skewed numeric variables (price, mileage, consumer reviews)
  • Reduced 5 correlated rating variables into a single OverallRating score via PCA
  • Handled missing data using a mix of casewise deletion (MCAR cases) and KNN imputation (K=5) for values likely MAR/MNAR

Modelling

  • Compared LASSO, ridge, and stepwise regression for variable selection; selected LASSO for its ability to shrink coefficients exactly to zero
  • Used 10-fold cross-validation to select the penalty parameter (λ.1se)
  • Refit a post-LASSO OLS model on the LASSO-selected variables to obtain unbiased, interpretable coefficients and p-values

Validation & diagnostics

  • Assessed model fit via CV RMSE, comparing LASSO vs. post-LASSO OLS
  • Checked residual diagnostics (Q-Q plots, residuals vs. fitted, VIF for multicollinearity)
  • Identified and individually investigated statistically significant outliers (Bonferroni-corrected studentised residuals) — including a Ferrari and a Porsche in the dataset — and tested model sensitivity to their inclusion

Key findings

  • The final model explains ~56% of the variation in log(price) (R² = 0.558)
  • Vehicle age (Year) and mileage were the most intuitive drivers — newer, lower-mileage cars command higher prices
  • Drivetrain and transmission type had substantial effects: FWD cars were ~23% cheaper than the AWD/4WD baseline, and CVT transmissions ~15% cheaper than automatic
  • Fuel type mattered — hybrid/electric/diesel vehicles carried a ~15% premium over gasoline
  • The model performs best for mid-range and premium vehicles, but systematically under-predicts luxury/exotic cars (e.g. a Ferrari in the dataset) since brand and make information wasn't available

Tools

R, glmnet (LASSO/ridge), PCA, KNN imputation, OLS regression, outlier/diagnostic testing

Files

  • ST404-Write-Up-Assignment-2.pdf — full report, including methodology, results, and R code appendix
  • raw_dataset.csv — original, uncleaned dataset (~1,125 vehicles)
  • final_dataset.csv — cleaned dataset used for modelling (1,122 vehicles)

About

Group project (ST404): LASSO and post-LASSO OLS regression identifying key drivers of used car prices in a US car-listings dataset. Completed in R.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors