[LON-CAPA-cvs] cvs: modules /gerd/educause printcorrels.pl
www
lon-capa-cvs@mail.lon-capa.org
Mon, 22 Mar 2004 22:27:49 -0000
www Mon Mar 22 17:27:49 2004 EDT
Modified files:
/modules/gerd/educause printcorrels.pl
Log:
Show where different options lead to different correlations.
Index: modules/gerd/educause/printcorrels.pl
diff -u modules/gerd/educause/printcorrels.pl:1.1 modules/gerd/educause/printcorrels.pl:1.2
--- modules/gerd/educause/printcorrels.pl:1.1 Mon Mar 22 16:42:14 2004
+++ modules/gerd/educause/printcorrels.pl Mon Mar 22 17:27:49 2004
@@ -1,6 +1,7 @@
while ($userin=<STDIN>) {
my ($question,$userin)=split(/\s+/,$userin);
print "\n-----------------------------------";
+ my %correlwith=();
open (IN,'correlations.dat');
while ($line=<IN>) {
my ($first,$fcrit,$second,$scrit)=($line=~/^(\d+)\:([^\_]+)\_(\d+)\:(\w+)\s/);
@@ -8,6 +9,7 @@
if ((!$userin) || ($fcrit eq $userin)) {
print "\n$first $fcrit -> $second $scrit";
}
+ $correlwith{$fcrit}.='&'.$second.':'.$scrit;
}
if ($second==$question) {
if ((!$userin) || ($scrit eq $userin)) {
@@ -16,7 +18,6 @@
}
}
close(IN);
- print "\n--Percentages:";
open(IN,'results.csv') || die('Could not open file');
my $tot=0;
my %sum=();
@@ -28,6 +29,26 @@
}
}
close (IN);
+# Different correlations
+ print "\n--Diffs:";
+ foreach $fopt (sort keys %correlwith) {
+ foreach (split(/\&/,$correlwith{$fopt})) {
+ my ($num,$answer)=split(/\:/,$_);
+ if ($num) {
+ foreach $sopt (sort keys %correlwith) {
+ if ($sopt eq $fopt) { next; }
+ foreach (split(/\&/,$correlwith{$sopt})) {
+ my ($snum,$sanswer)=split(/\:/,$_);
+ if (($snum==$num) && ($sanswer ne $answer)) {
+ print "\n".$fopt.'->'.$num.':'.$answer.' while '.$sopt.'->'.$sanswer;
+ }
+ }
+ }
+ }
+ }
+ }
+# Percentages
+ print "\n--Percentages:";
foreach (sort keys %sum) {
$perc=int(100*$sum{$_}/$tot+.5);
print "\n$question $_: $perc";