April 8, 2017

Overview

In this assignment, you will see the predicted list price of houses in Boulder, CO. The primary output is a diagram that shows the list price ob the Y axis and the size of the house (in square feet) on the X axis.

With just a click or two, you can change the main parameters for the house and the price prediction will change accordingly. It makes price comparism between different areas (zip codes) and house sizes extremely easy.

Link to the application: https://kkovago.shinyapps.io/housepricing/

Source code: https://github.com/kkovago/housepricing

About the data

The data is from the Coursera course "Predictive Modeling and Analytics" https://www.coursera.org/learn/predictive-modeling-analytics

See the head of the data below. List price is given in thousand dollars. The size of the house is in square feet. Parking type is 1 if the house has a garage, 0 otherwise. The data also contains the number of bedrooms and the Zip code of the location.

##   LIST.PRICE SQFT BEDS PARKING.TYPE   ZIP
## 1        895 3040    4            1 80303
## 2        659 2920    3            1 80303
## 3       1840 3845    4            1 80303
## 4        335  928    2            1 80305
## 5        299 1044    2            1 80305
## 6       6499 5588    4            1 80303

List price prediction

For an illustration of the base data, see below the house list prices by size, by ZIP codes. My application builds a Random Forest price prediction model from the existing data.

Interactive application

The model is saved at the time of the first calcualtion (since it is time consuming) and loaded upon subsequent runs.

if(file.exists("rf.trainingModel.RData")) {
    load(file="rf.trainingModel.RData", verbose=TRUE)
} else {
    rf.trainingModel <- train(LIST.PRICE ~ ., data=dat, method="rf")
    save(rf.trainingModel, file="rf.trainingModel.RData")
}

The application generates a diagram of list price by square feet, by house parameters you can interactively select: Zip code, Number of bedrooms, Whether the house has a garage or not.

Link to the application: https://kkovago.shinyapps.io/housepricing/