--- loncom/interface/statistics/lonproblemstatistics.pm 2002/07/29 21:23:22 1.5 +++ loncom/interface/statistics/lonproblemstatistics.pm 2002/07/30 22:09:01 1.7 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonproblemstatistics.pm,v 1.5 2002/07/29 21:23:22 minaeibi Exp $ +# $Id: lonproblemstatistics.pm,v 1.7 2002/07/30 22:09:01 minaeibi Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,7 +31,7 @@ # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei # YEAR=2002 # 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei -# 5/12,5/14,5/15,5/19,5/26,7/16,7/25 Behrouz Minaei +# 5/12,5/14,5/15,5/19,5/26,7/16,7/25,7/29 Behrouz Minaei # ### @@ -80,24 +80,23 @@ sub BuildProblemStatisticsPage { unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) { return '
Unable to tie database.'; } - my $discriminantFactor; + my %discriminant=(); my @list=(); my %Discuss=&Apache::loncoursedata::LoadDiscussion($courseID); my $index=0; foreach (@$students) { $index++; #&Apache::lonstatistics::Update_PrgWin(++$index,$r); - $discriminantFactor = &ExtractStudentData(\%cache, $_, \@list, - \%Discuss, $r); + &ExtractStudentData(\%cache, $_, \@list,\%Discuss, $r, \%discriminant); } #&Apache::lonstatistics::Close_PrgWin($r); - my ($upper, $lower) = &Discriminant($discriminantFactor); + my ($upper, $lower) = &Discriminant(\%discriminant,$r); my %Header = (0,"Homework Sets Order",1,"#Stdnts",2,"Tries",3,"Mod", 4,"Mean",5,"#YES",6,"#yes",7,"%Wrng",8,"DoDiff", 9,"S.D.",10,"Skew.",11,"D.F.1st",12,"D.F.2nd", 13, "Disc."); my $color=&setbgcolor(0); - my %GraphDat= &BuildStatisticsTable(\%cache, $discriminantFactor, \@list, + my %GraphDat= &BuildStatisticsTable(\%cache, $upper, $lower, \@list, \%Header, $students, $r, $color); untie(%cache); } @@ -146,9 +145,7 @@ sub CloseTable { # ------ Dump the Student's DB file and handling the data for statistics table sub ExtractStudentData { - my ($cache,$name,$list,$Discuss,$r)=@_; - my %discriminantFactor; - + my ($cache,$name,$list,$Discuss,$r,$discriminant)=@_; my $totalTries = 0; my $totalAwarded = 0; my $spent=0; @@ -160,6 +157,7 @@ sub ExtractStudentData { my $TotFirst = 0; my $TimeTot = 0; my $Discussed=0; + my $discrim=''; my $tempSequenceOrder=100; #$Apache::lonxml::debug=1; @@ -176,7 +174,7 @@ sub ExtractStudentData { # next; # } - my $Dis = ''; + #$discrim .= '&'; foreach my $problemID (split(':', $cache->{$sequence.':problems'})) { # $r->print("'; - $Ptr .= '#Stdnts: | '; + $Ptr .= '#Stdnts'; $Ptr .= 'Total Number of Students opened the problem.'; $Ptr .= ' |
'; - $Ptr .= 'Tries: | '; + $Ptr .= 'Tries'; $Ptr .= 'Total Number of Tries for solving the problem.'; $Ptr .= ' |
'; - $Ptr .= 'Mod: | '; + $Ptr .= 'Mod'; $Ptr .= 'Maximunm Number of Tries for solving the problem.'; $Ptr .= ' |
'; - $Ptr .= 'Mean: | '; + $Ptr .= 'Mean'; $Ptr .= 'Average Number of the tries. [ Tries / #Stdnts ]'; $Ptr .= ' |
'; - $Ptr .= '#YES: | '; + $Ptr .= '#YES'; $Ptr .= 'Number of students solved the problem correctly.'; $Ptr .= ' |
'; - $Ptr .= '#yes: | '; + $Ptr .= '#yes'; $Ptr .= 'Number of students solved the problem by override.'; $Ptr .= ' |
'; - $Ptr .= '%Wrng: | '; + $Ptr .= '%Wrng'; $Ptr .= 'Percentage of students tried to solve the problem '; $Ptr .= 'but still incorrect. [ 100*((#Stdnts-(#YES+#yes))/#Stdnts) ]'; $Ptr .= ' |
'; - $Ptr .= 'DoDiff: | '; + $Ptr .= 'DoDiff'; $Ptr .= 'Degree of Difficulty of the problem. '; $Ptr .= '[ 1 - ((#YES+#yes) / Tries) ]'; $Ptr .= ' |
'; - $Ptr .= 'S.D.: | '; + $Ptr .= 'S.D.'; $Ptr .= 'Standard Deviation of the tries. '; $Ptr .= '[ sqrt(sum((Xi - Mean)^2)) / (#Stdnts-1) '; $Ptr .= 'where Xi denotes every student\'s tries ]'; $Ptr .= ' |
'; - $Ptr .= 'Skew.: | '; + $Ptr .= 'Skew.'; $Ptr .= 'Skewness of the students tries.'; $Ptr .= '[(sqrt( sum((Xi - Mean)^3) / #Stdnts)) / (S.D.^3)]'; $Ptr .= ' |
'; - $Ptr .= 'Dis.F.: | '; + $Ptr .= 'Dis.F.'; $Ptr .= 'Discrimination Factor: A Standard for evaluating the ';
$Ptr .= 'problem according to a Criterion '; $Ptr .= '[Applied Criterion in %27 Upper Students - '; @@ -790,7 +774,7 @@ sub ProblemStatisticsLegend { #------- Processing upperlist and lowerlist according to each problem sub ProcessDiscriminant { - my ($List) = @_; + my ($List,$r) = @_; my @sortedList = sort (@$List); my $Count = scalar @sortedList; my $Problem; @@ -803,6 +787,7 @@ sub ProcessDiscriminant { my $nStudent=0; my %Proc=undef; while ($nIndex<$Count) { +# $r->print(" $nIndex) $sortedList[$nIndex]"); ($Problem,$tmp)=split(/\=/,$sortedList[$nIndex]); @Dis=split(/\+/,$tmp); my $Temp = $Problem; @@ -814,9 +799,8 @@ sub ProcessDiscriminant { ($Problem,$tmp)=split(/\=/,$sortedList[$nIndex]); @Dis=split(/\+/,$tmp); } while ( $Problem eq $Temp && $nIndex < $Count ); -# $Proc{$Temp}=($Sum1/$nStudent).':'.$nStudent; $Proc{$Temp}=($Sum1/$nStudent).':'.($Sum2/$nStudent); -# $r->print("$nIndex) $Temp --> ($nStudent) $Proc{$Temp} "); +# $r->print(" $nIndex) $Temp --> ($nStudent) $Proc{$Temp}"); $Sum1=0; $Sum2=0; $nStudent=0; @@ -827,8 +811,11 @@ sub ProcessDiscriminant { #------- Creating Discimination factor sub Discriminant { - my ($discriminantFactor)=@_; - my @discriminantKeys=keys(%$discriminantFactor); + my ($discriminant,$r)=@_; +#$Apache::lonxml::debug=1; +#&Apache::lonhomework::showhash(%$discriminant); +#$Apache::lonxml::debug=0; + my @discriminantKeys=keys(%$discriminant); my $Count = scalar @discriminantKeys; my $UpCnt = int(0.27*$Count); @@ -842,8 +829,8 @@ sub Discriminant { $Count++; if($low < $UpCnt || $Count > $up) { $low++; - my $str=$discriminantFactor->{$key}; - foreach(split(/\:/,$str)){ + my $str=$discriminant->{$key}; + foreach(split(/\&/,$str)){ if($_) { if($low<$UpCnt) { push(@LowList,$_); } else { push(@UpList,$_); } @@ -851,8 +838,8 @@ sub Discriminant { } } } - my %DisUp = &ProcessDiscriminant(\@UpList); - my %DisLow = &ProcessDiscriminant(\@LowList); + my %DisUp = &ProcessDiscriminant(\@UpList,$r); + my %DisLow = &ProcessDiscriminant(\@LowList,$r); return (\%DisUp, \%DisLow); } |