[LON-CAPA-cvs] cvs: modules /gerd evaluate.pl
www
lon-capa-cvs@mail.lon-capa.org
Fri, 31 Mar 2006 02:10:22 -0000
www Thu Mar 30 21:10:22 2006 EDT
Modified files:
/modules/gerd evaluate.pl
Log:
exists actually makes things exist afterwards ... $@$@# Perl.
Index: modules/gerd/evaluate.pl
diff -u modules/gerd/evaluate.pl:1.4 modules/gerd/evaluate.pl:1.5
--- modules/gerd/evaluate.pl:1.4 Thu Mar 30 12:54:07 2006
+++ modules/gerd/evaluate.pl Thu Mar 30 21:10:20 2006
@@ -106,11 +106,11 @@
if ($entries[103+$mp]=~/\d/) { $mpexpost{$user.':'.$mp}=($entries[103+$mp]-1)/4; }
}
foreach my $mp (1..34) {
- if (($mpexpost{$user.':'.$mp}) && ($mpexpre{$user.':'.$mp})) {
+ if ((defined($mpexpost{$user.':'.$mp})) && (defined($mpexpre{$user.':'.$mp}))) {
$mpex{$user.':'.$mp}=($mpexpost{$user.':'.$mp}+$mpexpre{$user.':'.$mp})/2;
- } elsif ($mpexpost{$user.':'.$mp}) {
+ } elsif (defined($mpexpost{$user.':'.$mp})) {
$mpex{$user.':'.$mp}=$mpexpost{$user.':'.$mp};
- } elsif ($mpexpre{$user.':'.$mp}) {
+ } elsif (defined($mpexpre{$user.':'.$mp})) {
$mpex{$user.':'.$mp}=$mpexpre{$user.':'.$mp};
}
}
@@ -136,6 +136,70 @@
# Sample is everybody who got a grade in the course
my @userkeys=sort keys %grade;
+# Get MPEX ave and std-deviations
+my @mpexpresum=();
+my @mpexpren=();
+my @mpexpostsum=();
+my @mpexpostn=();
+my @mpexsum=();
+my @mpexn=();
+my @mpexpreave=();
+my @mpexprestd=();
+my @mpexpostave=();
+my @mpexpoststd=();
+my @mpexave=();
+my @mpexstd=();
+my @mpexpresumq=();
+my @mpexpostsumq=();
+my @mpexsumq=();
+
+
+foreach my $user (@userkeys) {
+ foreach my $number (1..34) {
+ if (defined($mpexpre{$user.':'.$number})) {
+ $mpexpresum[$number]+=$mpexpre{$user.':'.$number};
+ $mpexpren[$number]++;
+ }
+ if (defined($mpexpost{$user.':'.$number})) {
+ $mpexpostsum[$number]+=$mpexpost{$user.':'.$number};
+ $mpexpostn[$number]++;
+ }
+ if (defined($mpex{$user.':'.$number})) {
+ $mpexsum[$number]+=$mpex{$user.':'.$number};
+ $mpexn[$number]++;
+ }
+ }
+}
+
+foreach my $number (1..34) {
+ $mpexpreave[$number]=$mpexpresum[$number]/$mpexpren[$number];
+ $mpexpostave[$number]=$mpexpostsum[$number]/$mpexpostn[$number];
+ $mpexave[$number]=$mpexsum[$number]/$mpexn[$number];
+}
+
+foreach my $user (@userkeys) {
+ foreach my $number (1..34) {
+ if (defined($mpexpre{$user.':'.$number})) {
+ $mpexpresumq[$number]+=($mpexpre{$user.':'.$number}-$mpexpreave[$number])**2;
+ }
+ if (defined($mpexpost{$user.':'.$number})) {
+ $mpexpostsumq[$number]+=($mpexpost{$user.':'.$number}-$mpexpostave[$number])**2;
+ }
+ if (defined($mpex{$user.':'.$number})) {
+ $mpexsumq[$number]+=($mpex{$user.':'.$number}-$mpexave[$number])**2;
+ }
+ }
+}
+
+foreach my $number (1..34) {
+ $mpexprestd[$number]=int(100*sqrt($mpexpresumq[$number]/$mpexpren[$number])+0.5)/100;
+ $mpexpoststd[$number]=int(100*sqrt($mpexpostsumq[$number]/$mpexpostn[$number])+0.5)/100;
+ $mpexstd[$number]=int(100*sqrt($mpexsumq[$number]/$mpexn[$number])+0.5)/100;
+ $mpexpreave[$number]=int(100*$mpexpreave[$number]+0.5)/100;
+ $mpexpostave[$number]=int(100*$mpexpostave[$number]+0.5)/100;
+ $mpexave[$number]=int(100*$mpexave[$number]+0.5)/100;
+}
+
print "\nGrade/Solution: ".&hashcorrelate(\%grade,'',\%solution,'',\@userkeys,'',0.01);
print "\nGrade/Math: ".&hashcorrelate(\%grade,'',\%math,'',\@userkeys,'',0.01);
print "\nGrade/Physics: ".&hashcorrelate(\%grade,'',\%physics,'',\@userkeys,'',0.01);
@@ -143,6 +207,13 @@
print "\nGrade/Procedural: ".&hashcorrelate(\%grade,'',\%procedural,'',\@userkeys,'',0.01);
print "\nGrade/Conceptual: ".&hashcorrelate(\%grade,'',\%conceptual,'',\@userkeys,'',0.01);
+print "\nFCIFinal/Solution: ".&hashcorrelate(\%fcipost,'',\%solution,'',\@userkeys,'',0.01);
+print "\nFCIFinal/Math: ".&hashcorrelate(\%fcipost,'',\%math,'',\@userkeys,'',0.01);
+print "\nFCIFinal/Physics: ".&hashcorrelate(\%fcipost,'',\%physics,'',\@userkeys,'',0.01);
+print "\nFCIFinal/Surface: ".&hashcorrelate(\%fcipost,'',\%surface,'',\@userkeys,'',0.01);
+print "\nFCIFinal/Procedural: ".&hashcorrelate(\%fcipost,'',\%procedural,'',\@userkeys,'',0.01);
+print "\nFCIFinal/Conceptual: ".&hashcorrelate(\%fcipost,'',\%conceptual,'',\@userkeys,'',0.01);
+
print "\nFCIg/Solution: ".&hashcorrelate(\%fcigain,'',\%solution,'',\@userkeys,'',0.01);
print "\nFCIg/Math: ".&hashcorrelate(\%fcigain,'',\%math,'',\@userkeys,'',0.01);
print "\nFCIg/Physics: ".&hashcorrelate(\%fcigain,'',\%physics,'',\@userkeys,'',0.01);
@@ -153,6 +224,9 @@
foreach my $mpexidx (1..34) {
print "\n$mpexidx - ";
+ print ' Pre: '.$mpexpreave[$mpexidx].'+/-'.$mpexprestd[$mpexidx].'('.$mpexpren[$mpexidx].')'.
+ ' Post: '.$mpexpostave[$mpexidx].'+/-'.$mpexpoststd[$mpexidx].'('.$mpexpostn[$mpexidx].')'.
+ ' Both: '.$mpexave[$mpexidx].'+/-'.$mpexstd[$mpexidx].'('.$mpexn[$mpexidx].')';
print &hashcorrelate(\%fci,'',\%mpex,$mpexidx,\@userkeys,'FCI').
&hashcorrelate(\%fcipre,'',\%mpex,$mpexidx,\@userkeys,'FCIInit').
&hashcorrelate(\%fcipost,'',\%mpex,$mpexidx,\@userkeys,'FCIFinal').
@@ -207,7 +281,7 @@
#
sub buildarrays {
my ($array1,$arrayidx1,$array2,$arrayidx2,$userkeys)=@_;
- my $index=1;
+ my $index=0;
my @x=();
my @y=();
foreach my $user (@$userkeys) {
@@ -215,7 +289,7 @@
if ($arrayidx1) { $firstindex.=':'.$arrayidx1; }
my $secondindex=$user;
if ($arrayidx2) { $secondindex.=':'.$arrayidx2; }
- if (($$array1{$firstindex} ne '') && ($$array2{$secondindex} ne '')) {
+ if ((defined($$array1{$firstindex})) && (defined($$array2{$secondindex}))) {
$index++;
$x[$index]=$$array1{$firstindex};
$y[$index]=$$array2{$secondindex};