4 #include <RcppArmadillo.h>
13 arma::mat X(Xr.
begin(), n, k,
false);
14 arma::colvec y(yr.
begin(), yr.
size(),
false);
16 arma::colvec coef = arma::solve(X, y);
17 arma::colvec resid = y - X*coef;
19 double sig2 = arma::as_scalar( arma::trans(resid)*resid/(n-k) );
22 sig2 * arma::diagvec( arma::inv(arma::trans(X)*X)) );
25 Named(
"stderr") = stderrest
List fastLm(NumericVector yr, NumericMatrix Xr)
const_iterator begin() const
void sqrt(InputIterator begin, InputIterator end, OutputIterator out)
Argument Named(const std::string &name)