I thought they use discriminant analysis as discribed e.g. in chapter 4.4. in James et. al. "An Introduction to Statistical Learning with Applications in R". But after input from this article and this SO-question including reproducible examples it seems that
- a matrix model is calculated in
ans <- .External2(C_modelmatrix, t, data)
(inmodel.matrix.default
) - the matrix model goes into
z <- .Call(C_Cdqrls, x, y, tol, FALSE)
and I did not expect, that linear regression and discriminant analysis are the same on the maths level.
From here it seems, R can always use the standard algorithm based on qr-factorization.
Is that true?
Comment: R's help ?lm
references Chambers, J. M. (1992) Linear models. Chapter 4 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole. But I do not have access to the book.