[LON-CAPA-cvs] cvs: modules /gerd/educause correl.pl

www lon-capa-cvs@mail.lon-capa.org
Mon, 22 Mar 2004 15:01:53 -0000


www		Mon Mar 22 10:01:53 2004 EDT

  Modified files:              
    /modules/gerd/educause	correl.pl 
  Log:
  Percentage of people answering this also answering that
  
  
Index: modules/gerd/educause/correl.pl
diff -u modules/gerd/educause/correl.pl:1.1 modules/gerd/educause/correl.pl:1.2
--- modules/gerd/educause/correl.pl:1.1	Mon Mar 22 09:26:51 2004
+++ modules/gerd/educause/correl.pl	Mon Mar 22 10:01:53 2004
@@ -1,4 +1,6 @@
 %res=();
+%tot=();
+%root=();
 $questionaire=0;
 open(IN,'results.csv') || die('Could not open file');
 while($line=<IN>) {
@@ -9,17 +11,23 @@
     for ($first=1;$first<=$#entries;$first++) {
 	print ".";
 	unless ($entries[$first]) { next; }
-	$key=$first.':'.$entries[$first].'_';
+	$key=$first.':'.$entries[$first];
+	$tot{$key}++;
 	for ($second=1;$second<=$#entries;$second++) {
 	    if ($first==$second) { next; }
 	    unless ($entries[$second]) { next; }
-	    $res{$key.$second.':'.$entries[$second]}++;
+	    $thiskey=$key.'_'.$second.':'.$entries[$second];
+	    $res{$thiskey}++;
+	    $root{$thiskey}=$key;
 	}
     }
 }
 close(IN);
 print "\nSorting\n";
-foreach (sort { $res{$a}<=>$res{$b} } keys %res) {
-    print $_.' '.$res{$_}."\n";
+foreach ( sort { $res{$a}/$tot{$root{$a}}<=>$res{$b}/$tot{$root{$b}}} keys %res) {
+    my $correl=$res{$_}/$tot{$root{$_}};
+    if (($correl>0.6) && ($tot{$root{$_}}>5)) {
+	print $_.' '.$tot{$root{$_}}.' '.$res{$_}.' '.$correl."\n";
+    }
 }