How does R fit a linear model?
Chapter 1 Intro & Motivation
This book is the product of my goal to answer the question ‘How does R fit a linear model using the
lm function?’ A seemingly simple question based on one of the most humble formulas in all of statistics led me down a rabbit hole of math and programming I never expected.
The goal of writing this is for my own etification, but also to provide a thorough walkthrough so that R-users at all levels of math and programming can have a better grasp on one of the most ubiquitous tools in a statisticians toolbelt.
The book wil be structured largely following my own journey:
- What is a linear model and what is the least squares problem?
- What are the various methods for solving the least squares problem
- How could I write my own
- How does R fit a linear model with the
Along the way I include various appendices the dive a bit deeper into some relevant backgroun information. Surprisingly, this humble function will take us on a jounrye through some pretty sophisticated math as well as not one, but two additional programming languages (