Like a lot of people, I understand how to run a linear regression, I understand how to interpret its output, and I understand its limitations.
My understanding of the mathematical underpinnings of linear regression, however, are less developed. In particular, I do not understand the logic behind how we estimate beta using the following formula:
$$ \beta = (X'X)^{-1}X'Y $$
Would anyone care to offer an intuitive explanation as to why/how this process works? For example, what function each step in the equation performs and why it is necessary.