@@ -38,13 +38,14 @@ fastLm(X, \dots)
38
38
\code {\link {lm }} and friends versus this approach based on
39
39
\code {Armadillo }. The reason that \code {Armadillo } can do something
40
40
like \code {\link {lm.fit }} faster than the functions in the stats
41
- package is because \code {Armadillo } uses the Lapack version of the QR
42
- decomposition while the stats package uses a \emph {modified } Linpack
43
- version. Hence \code {Armadillo } uses level - 3 BLAS code whereas the
44
- stats package uses level - 1 BLAS. However , \code {Armadillo } will
41
+ package is because \code {Armadillo } can use different solvers , including
42
+ fast / approximative ones. Older versions of Armadillo could therefore
45
43
either fail or , worse , produce completely incorrect answers
46
44
on rank - deficient model matrices whereas the functions from the stats
47
45
package will handle them properly due to the modified Linpack code.
46
+ Newer Armadillo version pivot (with warning ) to an approximate solutions.
47
+ This behavior can be control with options to the \code {solve } function ,
48
+ see the Armadillo documentation.
48
49
49
50
An example of the type of situation requiring extra care in checking
50
51
for rank deficiency is a two - way layout with missing cells (see the
@@ -60,7 +61,7 @@ fastLm(X, \dots)
60
61
61
62
\code {fastLm } returns a richer object which also includes the
62
63
residuals , fitted values and call argument similar to the \code {\link {lm }} or
63
- \code {\link [MASS ]{rlm }} functions..
64
+ \code {\link [MASS ]{rlm }} functions.
64
65
}
65
66
\seealso {\code {\link {lm }}, \code {\link {lm.fit }}}
66
67
\references {Armadillo project : \url {https : // arma.sourceforge.net / }}
@@ -93,7 +94,7 @@ fastLm(X, \dots)
93
94
set.seed(1 )
94
95
dd $ y <- mm \%* \% seq_len(ncol(mm )) + rnorm(nrow(mm ), sd = 0.1 )
95
96
summary(lm(y ~ f1 * f2 , dd )) # detects rank deficiency
96
- summary(fastLm(y ~ f1 * f2 , dd )) # some huge coefficients
97
+ summary(fastLm(y ~ f1 * f2 , dd )) # fits all coefficients via approx solution
97
98
98
99
\dontshow {armadillo_reset_cores()}
99
100
}
0 commit comments