[LON-CAPA-cvs] cvs: modules /gerd evaluate.pl
www
lon-capa-cvs@mail.lon-capa.org
Thu, 06 Jul 2006 15:14:14 -0000
www Thu Jul 6 11:14:14 2006 EDT
Modified files:
/modules/gerd evaluate.pl
Log:
Using a library routine for the correlation ... not much difference
Index: modules/gerd/evaluate.pl
diff -u modules/gerd/evaluate.pl:1.10 modules/gerd/evaluate.pl:1.11
--- modules/gerd/evaluate.pl:1.10 Sun May 21 22:33:27 2006
+++ modules/gerd/evaluate.pl Thu Jul 6 11:14:12 2006
@@ -1,4 +1,5 @@
use strict;
+use Statistics::Basic::Correlation;
# Read the discussions
open(IN,'classified.csv');
my %evals=();
@@ -340,8 +341,16 @@
#
# Correlation between arrays x and y - from WikiPedia
#
+
sub correlation {
my ($x,$y)=@_;
+ my $co= new Statistics::Basic::Correlation($x,$y);
+ return ($co->query,$#$x);;
+}
+
+
+sub old_correlation {
+ my ($x,$y)=@_;
my $sum_sq_x = 0;
my $sum_sq_y = 0;
my $sum_coproduct = 0;