Skip to content

Instantly share code, notes, and snippets.

@smc77
Created October 22, 2011 23:44
Show Gist options
  • Save smc77/1306640 to your computer and use it in GitHub Desktop.
Save smc77/1306640 to your computer and use it in GitHub Desktop.
Multivariate Regression
# 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")
names(housing) <- c("CRIM", "ZN", "INDUS", "CHAS", "NOX", "RM", "AGE", "DIS", "RAD", "TAX", "PTRATIO", "B", "LSTAT", "MEDV")
# Subset the data for our model
housing <- housing[, c("CRIM", "RM", "PTRATIO", "LSTAT", "MEDV")]
plot(housing)
# Look at the linear model
housing.lm = lm(MEDV ~ CRIM + RM + PTRATIO + LSTAT, data=housing)
summary(housing.lm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment