data(trees) # also used in help(lm)
X <- as.matrix(cbind(const=1, trees[, c("Girth", "Height")]))
y <- trees$Volume
linear_regression(X, y, rep(0, 3), tol=1e-12)
coef(lm(y ~ X - 1)) # for comparison
Run the code above in your browser using DataLab