How it works...
When we call lm() in R, it uses ordinary least squares to find the coefficients for our model. Internally, it uses a similar approach to what we used here (there are some computational tricks that can be used to ensure that the matrix inversion is more robust to correlation).
We have already explained how the t-values are computed and how they are used to calculate p-values. For the p-values, R uses numerical routines to calculate the area to the right of the test statistic, and to the left of its negative value. In other words, the total probability that we get values more extreme than the one we got assuming the coefficients are equal to 0 (null hypothesis). If that p-value is small, it means that, if the coefficient was ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access