Skip to content

Instantly share code, notes, and snippets.

@smc77
Created October 3, 2011 00:28
Show Gist options
  • Save smc77/1258171 to your computer and use it in GitHub Desktop.
Save smc77/1258171 to your computer and use it in GitHub Desktop.
Univariate regression with housing data
# First look at a linear model fit to the housing data
# details about dataset available http://archive.ics.uci.edu/ml/datasets/Housing
housing <- read.table("http://archive.ics.uci.edu/ml/machine-learning-databases/housing/housing.data")[, c(6, 14)]
names(housing) <- c("num.rooms", "median.values")
housing.lm <- lm(median.values ~ num.rooms, data=housing)
plot(housing)
abline(housing.lm)
summary(housing.lm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment