# The LearningOnline Network with CAPA # # $Id: lonproblemstatistics.pm,v 1.47 2003/03/27 19:26:33 matthew Exp $ # # Copyright Michigan State University Board of Trustees # # This file is part of the LearningOnline Network with CAPA (LON-CAPA). # # LON-CAPA is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # LON-CAPA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with LON-CAPA; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # /home/httpd/html/adm/gpl.txt # # http://www.lon-capa.org/ # # (Navigate problems for statistical reports # ############################################### ############################################### =pod =head1 NAME lonproblemstatistics =head1 SYNOPSIS Routines to present problem statistics to instructors via tables, Excel files, and plots. =over 4 =cut ############################################### ############################################### package Apache::lonproblemstatistics; use strict; use Apache::lonnet(); use Apache::lonhtmlcommon; use Apache::loncoursedata; use Apache::lonstatistics; use Spreadsheet::WriteExcel; ############################################### ############################################### =pod =item &CreateInterface() Create the main intereface for the statistics page. Allows the user to select sections, maps, and output. =cut ############################################### ############################################### sub CreateInterface { my $Str = ''; $Str .= '
Sections | '; $Str .= 'Sequences and Folders | '; $Str .= 'Output | '; $Str .= '
'."\n"; $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); $Str .= ' | '; # my $only_seq_with_assessments = sub { my $s=shift; if ($s->{'num_assess'} < 1) { return 0; } else { return 1; } }; $Str .= &Apache::lonstatistics::MapSelect('Maps','multiple,all',5, $only_seq_with_assessments); $Str .= ' | '."\n"; $Str .= &CreateAndParseOutputSelector(); $Str .= ' |
'."\n");
$r->print('
|
'."\n");
$r->rflush();
#
# Compile the data
my @Statsarray;
foreach my $sequence (@Sequences) {
next if ($sequence->{'num_assess'}<1);
foreach my $resource (@{$sequence->{'contents'}}) {
next if ($resource->{'type'} ne 'assessment');
foreach my $part (@{$resource->{'parts'}}) {
$problem_num++;
my ($num,$tries,$mod,$mean,$Solved,$solved,$DegOfDiff,$STD,
$SKEW) = &Apache::loncoursedata::get_problem_statistics
(undef,$resource->{'symb'},$part,
$ENV{'request.course.id'});
#
$show_part = 1 if ($part ne '0');
$part = ' ' if ($part == 0);
#
my $wrongpercent = 0;
if (defined($num) && $num > 0) {
$wrongpercent=int(10*100*($num-$Solved+$solved)/$num)/10;
}
push (@Statsarray,
{ 'sequence' => $sequence,
'resource' => $resource,
'Title' => $resource->{'title'},
'Part' => $part,
'#Stdnts' => $num,
'Tries' => $tries,
'Mod' => $mod,
'Mean' => $mean,
'#YES' => $Solved,
'#yes' => $solved,
'%Wrng' => $wrongpercent,
'DoDiff' => $DegOfDiff,
'S.D.' => $STD,
'Skew' => $SKEW,
'problem_num' => $problem_num,
});
}
}
}
#
# Table Headers
$r->print('
|
".&DrawGraph(\@Data,$title,'Problem Number',$yaxis, $Max)."
\n"); # # Print out the data $ENV{'form.sortby'} = 'Contents'; &output_html_ungrouped($r,'show probnum'); return; } ############################################### ############################################### =pod =item &DrawGraph() =cut ############################################### ############################################### sub DrawGraph { my ($values,$title,$xaxis,$yaxis,$Max)=@_; $title = '' if (! defined($title)); $xaxis = '' if (! defined($xaxis)); $yaxis = '' if (! defined($yaxis)); # my $sendValues = join(',', @$values); my $sendCount = scalar(@$values); if ( $Max > 1 ) { if ($Max % 10) { if ( int($Max) < $Max ) { $Max++; $Max = int($Max); } } } else { $Max = 1; } my @GData = ($title,$xaxis,$yaxis,$Max,$sendCount,$sendValues); return ''; } ############################################### ############################################### =pod =item &ProblemStatisticsLegend() =cut ############################################### ############################################### sub ProblemStatisticsLegend { my $Ptr = ''; $Ptr = ''; $Ptr .= '#Stdnts | '; $Ptr .= 'Total number of students attempted the problem.'; $Ptr .= ' |
'; $Ptr .= 'Tries | '; $Ptr .= 'Total number of tries for solving the problem.'; $Ptr .= ' |
'; $Ptr .= 'Mod | '; $Ptr .= 'Largest number of tries for solving the problem by a student.'; $Ptr .= ' |
'; $Ptr .= 'Mean | '; $Ptr .= 'Average number of tries. [ Tries / #Stdnts ]'; $Ptr .= ' |
'; $Ptr .= '#YES | '; $Ptr .= 'Number of students solved the problem correctly.'; $Ptr .= ' |
'; $Ptr .= '#yes | '; $Ptr .= 'Number of students solved the problem by override.'; $Ptr .= ' |
'; $Ptr .= '%Wrong | '; $Ptr .= 'Percentage of students who tried to solve the problem '; $Ptr .= 'but is still incorrect. [ 100*((#Stdnts-(#YES+#yes))/#Stdnts) ]'; $Ptr .= ' |
'; $Ptr .= 'DoDiff | '; $Ptr .= 'Degree of Difficulty of the problem. '; $Ptr .= '[ 1 - ((#YES+#yes) / Tries) ]'; $Ptr .= ' |
'; $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 .= 'Skewness of the students tries.'; $Ptr .= '[(sqrt( sum((Xi - Mean)^3) / #Stdnts)) / (S.D.^3)]'; $Ptr .= ' |
'; $Ptr .= 'Dis.F. | '; $Ptr .= 'Discrimination Factor: A Standard for evaluating the ';
$Ptr .= 'problem according to a Criterion '; $Ptr .= '[Criterion to group students into %27 Upper Students - '; $Ptr .= 'and %27 Lower Students] '; $Ptr .= '1st Criterion for Sorting the Students: '; $Ptr .= 'Sum of Partial Credit Awarded / Total Number of Tries '; $Ptr .= '2nd Criterion for Sorting the Students: '; $Ptr .= 'Total number of Correct Answers / Total Number of Tries'; $Ptr .= ' |
Disc. | '; $Ptr .= 'Number of Students had at least one discussion.'; $Ptr .= ' |