[Rcpp-commits] r1274 - pkg/RcppArmadillo/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue May 18 19:16:10 CEST 2010
Author: dmbates
Date: 2010-05-18 19:16:10 +0200 (Tue, 18 May 2010)
New Revision: 1274
Modified:
pkg/RcppArmadillo/src/fastLm.cpp
Log:
Change a couple of variable names and descriptions to be more accurate.
Modified: pkg/RcppArmadillo/src/fastLm.cpp
===================================================================
--- pkg/RcppArmadillo/src/fastLm.cpp 2010-05-18 17:08:40 UTC (rev 1273)
+++ pkg/RcppArmadillo/src/fastLm.cpp 2010-05-18 17:16:10 UTC (rev 1274)
@@ -32,16 +32,14 @@
arma::colvec y(yr.begin(), yr.size(), false);
arma::colvec coef = arma::solve(X, y); // fit model y ~ X
- arma::colvec resid = y - X*coef; // residuals
+ arma::colvec res = y - X*coef; // residuals
- double sig2 = std::inner_product(resid.begin(), resid.end(),
- resid.begin(), double())/(n-k);
+ double s2 = std::inner_product(res.begin(), res.end(), res.begin(), double())/(n - k);
+ // std.errors of coefficients
+ arma::colvec stderr = arma::sqrt(s2 * arma::diagvec( arma::inv(arma::trans(X)*X) ));
- // std.error of estimate
- arma::colvec stderrest = arma::sqrt(sig2 * arma::diagvec( arma::inv(arma::trans(X)*X) ));
-
return Rcpp::List::create(Rcpp::Named("coefficients") = coef,
- Rcpp::Named("stderr") = stderrest,
+ Rcpp::Named("stderr") = stderr,
Rcpp::Named("df") = n - k
);
More information about the Rcpp-commits
mailing list