[rkward-cvs] SF.net SVN: rkward: [1952] trunk/rkward/rkward/plugins/analysis/regression/ linear_regression.php

nono_231 at users.sourceforge.net nono_231 at users.sourceforge.net
Tue Aug 21 00:08:52 UTC 2007


Revision: 1952
          http://rkward.svn.sourceforge.net/rkward/?rev=1952&view=rev
Author:   nono_231
Date:     2007-08-20 17:08:51 -0700 (Mon, 20 Aug 2007)

Log Message:
-----------


Modified Paths:
--------------
    trunk/rkward/rkward/plugins/analysis/regression/linear_regression.php

Modified: trunk/rkward/rkward/plugins/analysis/regression/linear_regression.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/regression/linear_regression.php	2007-08-13 10:48:05 UTC (rev 1951)
+++ trunk/rkward/rkward/plugins/analysis/regression/linear_regression.php	2007-08-21 00:08:51 UTC (rev 1952)
@@ -1,17 +1,44 @@
 <?
-function preprocess () {
-        }
+function preprocess () { ?>
+require(xtable)
+<?        }
 
 function calculate () {
 ?>
-results <- summary (lm (<? getRK ("y"); ?> ~ <? getRK ("x"); ?>))
+# This can be used in a later fase to give the user the option to choose 
+# precision. For the moment is stable 5 (In summary.lm is 4).
+n=5
+results <- summary.lm (lm (<? getRK ("y"); ?> ~ <? getRK ("x"); ?>) )
+# Here we get the quantiles of the residuals and place them in a matrix 
+# and we name them in order to use xtable
+quarlm<-matrix(quantile(residuals(results)),nrow=1, ncol=5)
+colnames(quarlm)<-c("Min","1Q","Median","2Q","Max")
+# We extract the coefficients
+coeflm<-coef(results)
+# the Residual standard error
+siglm<-results$sigma
+# the maximum degrees of fredom
+maxdflm<-(max(results$df))
+# the r squared and the adjusted r squared
+rsq<-results$r.squared
+arsq<-results$adj.r.squared
+# the fstatistic, we put it into a matrix and we name it in order to use xtable 
+fslm<-matrix(results$fstatistic,nrow=1,ncol=3)
+colnames(fslm)<-names(results$fstatistic)
 <?
 }
 
 function printout () {
 ?>
 rk.header ("Linear Regression")
-rk.print (results)
+rk.print("Residuals")
+rk.results(xtable(quarlm))
+rk.print("Coefficients")
+rk.results(xtable(coeflm))
+rk.print(c("Residual standard error: ", round(siglm,n), " on ", maxdflm, " degrees of fredom"))
+rk.print(c("Multiple R-Squared: ", round(rsq,n), ", Adjusted R-squared: ", round(arsq,n)))
+rk.print("F-statistic")
+rk.results(xtable(fslm))
 <?
 }
-?>
\ No newline at end of file
+?>


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list