Hand Coding a Linear Model function
In yesterday’s post we developed a method for constructing a multivariate linear model with an intercept. Today we will turn the collection of loose commands into an integrated and easy to use function. A small recap from yesterday. We start by loading data and assigning our variables to objects {% highlight r %} data(iris) x1 <- iris$Petal.Width x2 <- iris$Sepal.Length y <- iris$Petal.Length {% endhighlight %} We now construction our linear model, the fastest way of doing this is using the QR decomposition.