This application estimates the price of your dream home, if it were located in King County, Washington. Using a data set of 21,612 homes, the application builds a prediction model to estimate the price of a fictional home, based on your inputs.
10/14/2017
This application estimates the price of your dream home, if it were located in King County, Washington. Using a data set of 21,612 homes, the application builds a prediction model to estimate the price of a fictional home, based on your inputs.
## Read and clean the data
housing <- read.csv("https://github.com/tyler-richardett/DevelopingDataProjects_CourseProject/raw/master/kc_house_data.csv")
housing <- housing[-15871, c(3:8, 11:12, 15, 17)]
housing$zipcode <- as.factor(housing$zipcode)
## Build generalized linear model
pred <- glm(price ~ ., data = housing)
## Prediction example
dream.home <- data.frame(bedrooms = 4, bathrooms = 2.5,
floors = 2, sqft_living = 3000,
sqft_lot = 5000, condition = 4, grade = 8,
yr_built = 1982, zipcode = as.factor(98001))
predict(pred, dream.home)[[1]]
## [1] 549886.7