[Rcpp-commits] r2561 - in pkg/RcppGSL: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Nov 27 19:56:48 CET 2010


Author: edd
Date: 2010-11-27 19:56:47 +0100 (Sat, 27 Nov 2010)
New Revision: 2561

Modified:
   pkg/RcppGSL/ChangeLog
   pkg/RcppGSL/R/fastLm.R
Log:
updated summary() to include R2 and adjR2
updated changelog for include/ changes as well


Modified: pkg/RcppGSL/ChangeLog
===================================================================
--- pkg/RcppGSL/ChangeLog	2010-11-27 18:16:12 UTC (rev 2560)
+++ pkg/RcppGSL/ChangeLog	2010-11-27 18:56:47 UTC (rev 2561)
@@ -1,3 +1,13 @@
+2010-11-27  Romain Francois <romain at r-enthusiasts.com>
+
+	* include/include/*h: Updated to satisfy some grumblings from g++
+
+2010-11-27  Dirk Eddelbuettel  <edd at debian.org>
+
+	* R/fastLm.R: summary() now also computed R2 and adjR2
+
+	* inst/doc/RcppGSL/RcppGSL.Rnw: Adding some material to introcuction
+
 2010-05-25  Romain Francois <romain at r-enthusiasts.com>
 
 	* inst/include/RcppGSLForward.h : add indexing operator, stl iterator

Modified: pkg/RcppGSL/R/fastLm.R
===================================================================
--- pkg/RcppGSL/R/fastLm.R	2010-11-27 18:16:12 UTC (rev 2560)
+++ pkg/RcppGSL/R/fastLm.R	2010-11-27 18:56:47 UTC (rev 2561)
@@ -59,8 +59,26 @@
                  t.value = tval,
                  p.value = 2*pt(-abs(tval), df=object$df))
 
+    # why do I need this here?
+    rownames(TAB) <- names(object$coefficients)
+    colnames(TAB) <- c("Estimate", "StdErr", "t.value", "p.value")
+
+    ## cf src/stats/R/lm.R and case with no weights and an intercept
+    f <- object$fitted.values
+    r <- object$residuals
+    mss <- sum((f - mean(f))^2)
+    rss <- sum(r^2)
+
+    r.squared <- mss/(mss + rss)
+    df.int <- 1 		# case of intercept
+    n <- length(f)
+    rdf <- object$df
+    adj.r.squared <- 1 - (1 - r.squared) * ((n - df.int)/rdf)
+
     res <- list(call=object$call,
-                coefficients=TAB)
+                coefficients=TAB,
+                r.squared=r.squared,
+                adj.r.squared=adj.r.squared)
 
     class(res) <- "summary.fastLm"
     res



More information about the Rcpp-commits mailing list