Skip to content

Instantly share code, notes, and snippets.

@smc77
Created October 24, 2011 00:11
Show Gist options
  • Save smc77/1308110 to your computer and use it in GitHub Desktop.
Save smc77/1308110 to your computer and use it in GitHub Desktop.
Normal Equation
data <- read.csv("http://www.statalgo.com/wp-content/uploads/2011/10/housing.csv")
x <- as.matrix(cbind(intercept=rep(1, m), data[, c("area", "bedrooms")]))
theta <- solve(t(x) %*% x) %*% t(x) %*% y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment