Annotation of loncom/interface/statistics/lonproblemstatistics.pm, revision 1.122.2.2
1.1 stredwic 1: # The LearningOnline Network with CAPA
2: #
1.122.2.2! raeburn 3: # $Id: lonproblemstatistics.pm,v 1.122.2.1 2012/05/12 03:17:43 raeburn Exp $
1.1 stredwic 4: #
5: # Copyright Michigan State University Board of Trustees
6: #
7: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
8: #
9: # LON-CAPA is free software; you can redistribute it and/or modify
10: # it under the terms of the GNU General Public License as published by
11: # the Free Software Foundation; either version 2 of the License, or
12: # (at your option) any later version.
13: #
14: # LON-CAPA is distributed in the hope that it will be useful,
15: # but WITHOUT ANY WARRANTY; without even the implied warranty of
16: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: # GNU General Public License for more details.
18: #
19: # You should have received a copy of the GNU General Public License
20: # along with LON-CAPA; if not, write to the Free Software
21: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22: #
23: # /home/httpd/html/adm/gpl.txt
24: #
25: # http://www.lon-capa.org/
26: #
27: # (Navigate problems for statistical reports
28: #
1.47 matthew 29: ###############################################
30: ###############################################
31:
32: =pod
33:
34: =head1 NAME
35:
36: lonproblemstatistics
37:
38: =head1 SYNOPSIS
39:
40: Routines to present problem statistics to instructors via tables,
41: Excel files, and plots.
42:
43: =over 4
44:
45: =cut
46:
47: ###############################################
48: ###############################################
1.1 stredwic 49:
1.36 minaeibi 50: package Apache::lonproblemstatistics;
1.1 stredwic 51:
52: use strict;
1.104 albertel 53: use Apache::lonnet;
1.62 matthew 54: use Apache::loncommon();
1.1 stredwic 55: use Apache::lonhtmlcommon;
56: use Apache::loncoursedata;
1.41 matthew 57: use Apache::lonstatistics;
1.84 matthew 58: use LONCAPA::lonmetadata();
1.59 matthew 59: use Apache::lonlocal;
1.44 matthew 60: use Spreadsheet::WriteExcel;
1.70 matthew 61: use Apache::lonstathelpers();
1.71 matthew 62: use Time::HiRes;
1.109 www 63: use LONCAPA;
64:
1.73 matthew 65:
66: my @StatsArray;
1.79 matthew 67: my %SeqStat; # keys are symbs, values are hash refs
1.73 matthew 68:
1.59 matthew 69: ##
70: ## Localization notes:
71: ##
72: ## in @Fields[0]->{'long_title'} is placed in Excel files and is used as the
73: ## header for plots created with Graph.pm, both of which more than likely do
74: ## not support localization.
75: ##
1.122.2.2! raeburn 76: ## Additional Notes:
! 77: ## Localization can be done and is done before passing the phrases
! 78: ## to the output.
! 79: ## This might conflict with special characters, e.g. German Umlaute or
! 80: ## chinese characters. Do not use such characters in this case.
! 81: ## If this failed, consider that the sequence and folder names
! 82: ## are also passed to the output and would fail the same way.
! 83: ##
1.79 matthew 84: #
85: #
86: ##
87: ## Description of Field attributes
88: ##
89: ## Attribute Required Value Meaning or Use
90: ##
91: ## name yes any scalar Used to uniquely identify field
92: ## title yes any scalar This is what the user sees to identify
93: ## the field. Passed through &mt().
94: ## long_title yes any scalar Used as graph heading and in excel
1.122.2.2! raeburn 95: ## output. Passed through &mt().
1.79 matthew 96: ## align no (left|right|center) HTML cell contents alignment
97: ## color yes html color HTML cell background color
98: ## used to visually group statistics
99: ## special no (link) Indicates a link, target is name.link
100: ## Currently set in &get_statistics()
101: ## graphable no (yes|no) Can a bar graph of the field be
102: ## produced?
103: ## sortable no (yes|no) Should a sort link be put in the
104: ## column header?
105: ## selectable yes (yes|no) Can the column be removed from the
106: ## statistics display?
107: ## selected yes (yes|no) Is the column selected by default?
108: ##
1.85 matthew 109: ## format no sprintf format string
110: ##
111: ## excel_format no excel format type
112: ## (see &Apache::loncommon::define_excel_formats
1.49 matthew 113: my @Fields = (
114: { name => 'problem_num',
115: title => 'P#',
116: align => 'right',
1.76 matthew 117: color => '#FFFFE6',
118: selectable => 'no',
1.80 matthew 119: defaultselected => 'yes',
1.76 matthew 120: },
1.49 matthew 121: { name => 'container',
1.51 matthew 122: title => 'Sequence or Folder',
1.49 matthew 123: align => 'left',
124: color => '#FFFFE6',
1.76 matthew 125: sortable => 'yes',
126: selectable => 'no',
1.80 matthew 127: defaultselected => 'yes',
1.76 matthew 128: },
1.49 matthew 129: { name => 'title',
130: title => 'Title',
131: align => 'left',
132: color => '#FFFFE6',
133: special => 'link',
1.117 bisitz 134: sortable => 'yes',
1.76 matthew 135: selectable => 'no',
1.80 matthew 136: defaultselected => 'yes',
1.76 matthew 137: },
1.117 bisitz 138: { name => 'part',
1.49 matthew 139: title => 'Part',
140: align => 'left',
1.55 matthew 141: color => '#FFFFE6',
1.76 matthew 142: selectable => 'no',
1.80 matthew 143: defaultselected => 'yes',
1.76 matthew 144: },
1.49 matthew 145: { name => 'num_students',
146: title => '#Stdnts',
147: align => 'right',
148: color => '#EEFFCC',
149: format => '%d',
150: sortable => 'yes',
151: graphable => 'yes',
1.76 matthew 152: long_title => 'Number of Students Attempting Problem',
153: selectable => 'yes',
1.80 matthew 154: defaultselected => 'yes',
1.76 matthew 155: },
1.49 matthew 156: { name => 'tries',
157: title => 'Tries',
158: align => 'right',
159: color => '#EEFFCC',
160: format => '%d',
161: sortable => 'yes',
162: graphable => 'yes',
1.76 matthew 163: long_title => 'Total Number of Tries',
164: selectable => 'yes',
1.80 matthew 165: defaultselected => 'yes',
1.76 matthew 166: },
1.49 matthew 167: { name => 'max_tries',
168: title => 'Max Tries',
169: align => 'right',
170: color => '#DDFFFF',
171: format => '%d',
172: sortable => 'yes',
173: graphable => 'yes',
1.76 matthew 174: long_title => 'Maximum Number of Tries',
175: selectable => 'yes',
1.80 matthew 176: defaultselected => 'yes',
1.76 matthew 177: },
1.73 matthew 178: { name => 'min_tries',
179: title => 'Min Tries',
180: align => 'right',
181: color => '#DDFFFF',
182: format => '%d',
183: sortable => 'yes',
184: graphable => 'yes',
1.76 matthew 185: long_title => 'Minumum Number of Tries',
186: selectable => 'yes',
1.80 matthew 187: defaultselected => 'yes',
1.76 matthew 188: },
1.49 matthew 189: { name => 'mean_tries',
190: title => 'Mean Tries',
191: align => 'right',
192: color => '#DDFFFF',
193: format => '%5.2f',
194: sortable => 'yes',
195: graphable => 'yes',
1.76 matthew 196: long_title => 'Average Number of Tries',
197: selectable => 'yes',
1.80 matthew 198: defaultselected => 'yes',
1.76 matthew 199: },
1.49 matthew 200: { name => 'std_tries',
201: title => 'S.D. tries',
202: align => 'right',
203: color => '#DDFFFF',
204: format => '%5.2f',
205: sortable => 'yes',
206: graphable => 'yes',
1.76 matthew 207: long_title => 'Standard Deviation of Number of Tries',
208: selectable => 'yes',
1.80 matthew 209: defaultselected => 'yes',
1.76 matthew 210: },
1.49 matthew 211: { name => 'skew_tries',
212: title => 'Skew Tries',
213: align => 'right',
214: color => '#DDFFFF',
215: format => '%5.2f',
216: sortable => 'yes',
217: graphable => 'yes',
1.76 matthew 218: long_title => 'Skew of Number of Tries',
219: selectable => 'yes',
1.80 matthew 220: defaultselected => 'no',
1.76 matthew 221: },
1.49 matthew 222: { name => 'num_solved',
223: title => '#YES',
224: align => 'right',
225: color => '#FFDDDD',
1.63 matthew 226: format => '%4.1f',# format => '%d',
1.49 matthew 227: sortable => 'yes',
228: graphable => 'yes',
1.76 matthew 229: long_title => 'Number of Students able to Solve',
1.77 matthew 230: selectable => 'yes',
1.80 matthew 231: defaultselected => 'yes',
1.76 matthew 232: },
1.49 matthew 233: { name => 'num_override',
234: title => '#yes',
235: align => 'right',
236: color => '#FFDDDD',
1.63 matthew 237: format => '%4.1f',# format => '%d',
1.49 matthew 238: sortable => 'yes',
239: graphable => 'yes',
1.76 matthew 240: long_title => 'Number of Students given Override',
241: selectable => 'yes',
1.80 matthew 242: defaultselected => 'yes',
1.76 matthew 243: },
1.95 matthew 244: { name => 'tries_per_correct',
245: title => 'tries/correct',
246: align => 'right',
247: color => '#FFDDDD',
248: format => '%4.1f',
249: sortable => 'yes',
250: graphable => 'yes',
251: long_title => 'Tries per Correct Answer',
252: selectable => 'yes',
253: defaultselected => 'yes',
254: },
1.73 matthew 255: { name => 'num_wrong',
256: title => '#Wrng',
1.49 matthew 257: align => 'right',
1.73 matthew 258: color => '#FFDDDD',
1.49 matthew 259: format => '%4.1f',
260: sortable => 'yes',
261: graphable => 'yes',
1.93 matthew 262: long_title => 'Number of students whose final answer is wrong',
263: selectable => 'yes',
264: defaultselected => 'yes',
265: },
266: { name => 'per_wrong',
267: title => '%Wrng',
268: align => 'right',
269: color => '#FFDDDD',
270: format => '%4.1f',
271: sortable => 'yes',
272: graphable => 'yes',
1.76 matthew 273: long_title => 'Percent of students whose final answer is wrong',
274: selectable => 'yes',
1.80 matthew 275: defaultselected => 'yes',
1.76 matthew 276: },
1.73 matthew 277: { name => 'deg_of_diff',
278: title => 'DoDiff',
279: align => 'right',
280: color => '#FFFFE6',
281: format => '%5.2f',
282: sortable => 'yes',
283: graphable => 'yes',
284: long_title => 'Degree of Difficulty'.
1.122.2.2! raeburn 285: ' ~[ 1 - ((#YES+#yes) / Tries) ~]',
1.76 matthew 286: selectable => 'yes',
1.80 matthew 287: defaultselected => 'yes',
1.76 matthew 288: },
1.71 matthew 289: { name => 'deg_of_disc',
1.73 matthew 290: title => 'DoDisc',
1.71 matthew 291: align => 'right',
292: color => '#FFFFE6',
293: format => '%4.2f',
294: sortable => 'yes',
295: graphable => 'yes',
1.76 matthew 296: long_title => 'Degree of Discrimination',
297: selectable => 'yes',
1.89 matthew 298: defaultselected => 'yes',
1.76 matthew 299: },
1.85 matthew 300: ## duedate included for research purposes. Commented out most of the time.
301: # { name => 'duedate',
302: # title => 'Due Date',
303: # align => 'left',
304: # color => '#FFFFFF',
305: # sortable => 'yes',
306: # graphable => 'no',
307: # long_title => 'Due date of resource for instructor',
308: # selectable => 'no',
309: # defaultselected => 'yes',
310: # },
311: ## opendate included for research purposes. Commented out most of the time.
312: # { name => 'opendate',
313: # title => 'Open Date',
314: # align => 'left',
315: # color => '#FFFFFF',
316: # sortable => 'yes',
317: # graphable => 'no',
318: # long_title => 'date resource became answerable',
319: # selectable => 'no',
320: # defaultselected => 'yes',
321: # },
322: ## symb included for research purposes. Commented out most of the time.
323: # { name => 'symb',
324: # title => 'Symb',
325: # align => 'left',
326: # color => '#FFFFFF',
327: # sortable => 'yes',
328: # graphable => 'no',
329: # long_title => 'Unique LON-CAPA identifier for problem',
330: # selectable => 'no',
331: # defaultselected => 'yes',
332: # },
1.86 matthew 333: ## resptypes included for research purposes. Commented out most of the time.
334: # { name => 'resptypes',
335: # title => 'Response Types',
336: # align => 'left',
337: # color => '#FFFFFF',
338: # sortable => 'no',
339: # graphable => 'no',
340: # long_title => 'Response Types used in this problem',
341: # selectable => 'no',
342: # defaultselected => 'yes',
343: # },
1.94 matthew 344: ## maxtries included for research purposes. Commented out most of the time.
345: # { name => 'maxtries',
346: # title => 'Maxtries',
347: # align => 'left',
348: # color => '#FFFFFF',
349: # sortable => 'no',
350: # graphable => 'no',
351: # long_title => 'Maximum number of tries',
352: # selectable => 'no',
353: # defaultselected => 'yes',
354: # },
355: ## hinttries included for research purposes. Commented out most of the time.
356: # { name => 'hinttries',
357: # title => 'hinttries',
358: # align => 'left',
359: # color => '#FFFFFF',
360: # sortable => 'no',
361: # graphable => 'no',
362: # long_title => 'Number of tries before a hint appears',
363: # selectable => 'no',
364: # defaultselected => 'yes',
365: # },
1.98 matthew 366: #
367: ## problem weight for instructor
368: { name => 'weight',
369: title => 'weight',
370: align => 'right',
371: color => '#FFFFFF',
372: sortable => 'no',
373: graphable => 'no',
374: long_title => 'Problem weight (for instructor)',
1.100 matthew 375: selectable => 'yes',
1.98 matthew 376: defaultselected => 'yes',
377: },
1.49 matthew 378: );
379:
1.79 matthew 380: my @SeqFields = (
381: { name => 'title',
382: title => 'Sequence',
383: align => 'left',
384: color => '#FFFFE6',
385: special => 'no',
1.117 bisitz 386: sortable => 'no',
1.79 matthew 387: selectable => 'yes',
1.80 matthew 388: defaultselected => 'no',
1.79 matthew 389: },
390: { name => 'items',
391: title => '#Items',
392: align => 'right',
393: color => '#FFFFE6',
394: format => '%4d',
395: sortable => 'no',
396: graphable => 'no',
397: long_title => 'Number of Items in Sequence',
398: selectable => 'yes',
1.80 matthew 399: defaultselected => 'no',
1.79 matthew 400: },
401: { name => 'scoremean',
402: title => 'Score Mean',
403: align => 'right',
404: color => '#FFFFE6',
405: format => '%4.2f',
406: sortable => 'no',
407: graphable => 'no',
408: long_title => 'Mean Sequence Score',
409: selectable => 'yes',
1.80 matthew 410: defaultselected => 'no',
1.79 matthew 411: },
412: { name => 'scorestd',
413: title => 'Score STD',
414: align => 'right',
415: color => '#FFFFE6',
416: format => '%4.2f',
417: sortable => 'no',
418: graphable => 'no',
419: long_title => 'Standard Deviation of Sequence Scores',
420: selectable => 'yes',
1.80 matthew 421: defaultselected => 'no',
1.79 matthew 422: },
423: { name => 'scoremax',
424: title => 'Score Max',
425: align => 'right',
426: color => '#FFFFE6',
427: format => '%4.2f',
428: sortable => 'no',
429: graphable => 'no',
430: long_title => 'Maximum Sequence Score',
431: selectable => 'yes',
1.80 matthew 432: defaultselected => 'no',
1.79 matthew 433: },
434: { name => 'scoremin',
435: title => 'Score Min',
436: align => 'right',
437: color => '#FFFFE6',
438: format => '%4.2f',
439: sortable => 'no',
440: graphable => 'no',
441: long_title => 'Minumum Sequence Score',
442: selectable => 'yes',
1.80 matthew 443: defaultselected => 'no',
1.79 matthew 444: },
445: { name => 'scorecount',
446: title => 'Score N',
447: align => 'right',
448: color => '#FFFFE6',
449: format => '%4d',
450: sortable => 'no',
451: graphable => 'no',
452: long_title => 'Number of Students in score computations',
453: selectable => 'yes',
1.80 matthew 454: defaultselected => 'no',
1.79 matthew 455: },
456: { name => 'countmean',
457: title => 'Count Mean',
458: align => 'right',
459: color => '#FFFFFF',
460: format => '%4.2f',
461: sortable => 'no',
462: graphable => 'no',
463: long_title => 'Mean Sequence Score',
464: selectable => 'yes',
1.80 matthew 465: defaultselected => 'no',
1.79 matthew 466: },
467: { name => 'countstd',
468: title => 'Count STD',
469: align => 'right',
470: color => '#FFFFFF',
471: format => '%4.2f',
472: sortable => 'no',
473: graphable => 'no',
474: long_title => 'Standard Deviation of Sequence Scores',
475: selectable => 'yes',
1.80 matthew 476: defaultselected => 'no',
1.79 matthew 477: },
478: { name => 'countmax',
479: title => 'Count Max',
480: align => 'right',
481: color => '#FFFFFF',
482: format => '%4.2f',
483: sortable => 'no',
484: graphable => 'no',
485: long_title => 'Maximum Number of Correct Problems',
486: selectable => 'yes',
1.80 matthew 487: defaultselected => 'no',
1.79 matthew 488: },
489: { name => 'countmin',
490: title => 'Count Min',
491: align => 'right',
492: color => '#FFFFFF',
493: format => '%4.2f',
494: sortable => 'no',
495: graphable => 'no',
496: long_title => 'Minumum Number of Correct Problems',
497: selectable => 'yes',
1.80 matthew 498: defaultselected => 'no',
1.79 matthew 499: },
500: { name => 'count',
501: title => 'Count N',
502: align => 'right',
503: color => '#FFFFFF',
504: format => '%4d',
505: sortable => 'no',
506: graphable => 'no',
507: long_title => 'Number of Students in score computations',
508: selectable => 'yes',
1.80 matthew 509: defaultselected => 'no',
1.79 matthew 510: },
511: { name => 'KR-21',
512: title => 'KR-21',
513: align => 'right',
514: color => '#FFAAAA',
515: format => '%4.2f',
516: sortable => 'no',
517: graphable => 'no',
518: long_title => 'KR-21 reliability statistic',
519: selectable => 'yes',
1.80 matthew 520: defaultselected => 'no',
1.117 bisitz 521: },
1.79 matthew 522: );
523:
1.76 matthew 524: my %SelectedFields;
525:
526: sub parse_field_selection {
527: #
528: # Pull out the defaults
1.104 albertel 529: if (! defined($env{'form.fieldselections'})) {
530: $env{'form.fieldselections'} = [];
1.76 matthew 531: foreach my $field (@Fields) {
532: next if ($field->{'selectable'} ne 'yes');
1.80 matthew 533: if ($field->{'defaultselected'} eq 'yes') {
1.104 albertel 534: push(@{$env{'form.fieldselections'}},$field->{'name'});
1.76 matthew 535: }
536: }
537: }
538: #
1.80 matthew 539: # Make sure the data we are plotting is there
540: my %NeededFields;
1.104 albertel 541: if (exists($env{'form.plot'}) && $env{'form.plot'} ne '' &&
542: $env{'form.plot'} ne 'none') {
543: if ($env{'form.plot'} eq 'degrees') {
1.80 matthew 544: $NeededFields{'deg_of_diff'}++;
545: $NeededFields{'deg_of_disc'}++;
1.104 albertel 546: } elsif ($env{'form.plot'} eq 'tries statistics') {
1.80 matthew 547: $NeededFields{'mean_tries'}++;
548: $NeededFields{'std_tries'}++;
549: $NeededFields{'problem_num'}++;
550: } else {
1.104 albertel 551: $NeededFields{$env{'form.plot'}}++;
1.80 matthew 552: }
553: }
554: #
1.76 matthew 555: # This should not happen, but in case it does...
1.104 albertel 556: if (ref($env{'form.fieldselections'}) ne 'ARRAY') {
557: $env{'form.fieldselections'} = [$env{'form.fieldselections'}];
1.76 matthew 558: }
559: #
560: # Set the field data and the selected fields (for easier checking)
561: undef(%SelectedFields);
562: foreach my $field (@Fields) {
1.80 matthew 563: if ($field->{'selectable'} ne 'yes') {
564: $field->{'selected'} = 'yes';
565: } else {
566: $field->{'selected'} = 'no';
567: }
568: if (exists($NeededFields{$field->{'name'}})) {
569: $field->{'selected'} = 'yes';
570: $SelectedFields{$field->{'name'}}++;
571: }
1.104 albertel 572: foreach my $selection (@{$env{'form.fieldselections'}}) {
1.76 matthew 573: if ($selection eq $field->{'name'} || $selection eq 'all') {
574: $field->{'selected'} = 'yes';
575: $SelectedFields{$field->{'name'}}++;
576: }
577: }
578: }
1.82 matthew 579: #
580: # Always show all the sequence statistics (for now)
581: foreach my $field (@SeqFields) {
582: $field->{'selected'} = 'yes';
583: }
1.76 matthew 584: return;
585: }
586:
587: sub field_selection_input {
1.116 bisitz 588: my $Str = '<select name="fieldselections" multiple="multiple" size="5">'."\n";
1.76 matthew 589: $Str .= '<option value="all">all</option>'."\n";
590: foreach my $field (@Fields) {
591: next if ($field->{'selectable'} ne 'yes');
592: $Str .= ' <option value="'.$field->{'name'}.'" ';
593: if ($field->{'selected'} eq 'yes') {
594: $Str .= 'selected ';
595: }
596: $Str .= '>'.$field->{'title'}.'</option>'."\n";
597: }
598: $Str .= "</select>\n";
599: }
600:
1.47 matthew 601: ###############################################
602: ###############################################
603:
604: =pod
605:
606: =item &CreateInterface()
607:
608: Create the main intereface for the statistics page. Allows the user to
609: select sections, maps, and output.
610:
611: =cut
1.1 stredwic 612:
1.47 matthew 613: ###############################################
614: ###############################################
1.41 matthew 615: sub CreateInterface {
1.87 matthew 616: my ($r) = @_;
1.80 matthew 617: #
1.76 matthew 618: &parse_field_selection();
1.80 matthew 619: #
1.41 matthew 620: my $Str = '';
1.115 bisitz 621: $Str .= '<p>';
622: $Str .= &Apache::loncommon::start_data_table();
623: $Str .= &Apache::loncommon::start_data_table_header_row();
624: $Str .= '<th>'.&mt('Sections').'</th>';
625: $Str .= '<th>'.&mt('Groups').'</th>';
626: $Str .= '<th>'.&mt('Access Status').'</th>';
627: $Str .= '<th>'.&mt('Sequences and Folders').'</th>';
628: $Str .= '<th>'.&mt('Statistics').'</th>';
629: $Str .= '<th>'.&mt('Plot Graph').'</th>';
630: $Str .= '<th>'.&mt('Time Period').'</th>';
631: $Str .= &Apache::loncommon::end_data_table_header_row();
1.41 matthew 632: #
1.115 bisitz 633: $Str .= &Apache::loncommon::start_data_table_row();
634: $Str .= '<td align="center" valign="top">'."\n";
1.41 matthew 635: $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5);
1.115 bisitz 636: $Str .= '</td><td align="center" valign="top">';
1.108 raeburn 637: $Str .= &Apache::lonstatistics::GroupSelect('Group','multiple',5);
1.115 bisitz 638: $Str .= '</td><td align="center" valign="top">';
1.50 matthew 639: $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5);
1.115 bisitz 640: $Str .= '</td><td align="center" valign="top">';
1.41 matthew 641: #
1.97 matthew 642: $Str .= &Apache::lonstatistics::map_select('Maps','multiple,all',5);
1.115 bisitz 643: $Str .= '</td><td align="center" valign="top">';
644: $Str .= &field_selection_input();
645: $Str .= '</td><td align="center" valign="top">';
646: $Str .= &plot_dropdown();
647: $Str .= '</td>'."\n";
648: $Str .= '</td><td align="center" valign="top">';
649: $Str .= &Apache::lonstathelpers::limit_by_time_form();
650: $Str .= '</td>'."\n";
651: $Str .= &Apache::loncommon::end_data_table_row();
652: $Str .= &Apache::loncommon::end_data_table();
1.87 matthew 653: #
1.115 bisitz 654: $Str .= '</p>';
1.59 matthew 655: $Str .= '<input type="submit" name="GenerateStatistics" value="'.
656: &mt('Generate Statistics').'" />';
1.115 bisitz 657: $Str .= (' 'x10);
1.87 matthew 658: #
1.73 matthew 659: return $Str;
1.41 matthew 660: }
1.25 stredwic 661:
1.41 matthew 662: ###############################################
663: ###############################################
1.28 stredwic 664:
1.47 matthew 665: =pod
666:
667: =item &BuildProblemStatisticsPage()
668:
669: Main interface to problem statistics.
670:
671: =cut
672:
1.41 matthew 673: ###############################################
674: ###############################################
1.97 matthew 675: my $navmap;
676: my @sequences;
677:
1.105 albertel 678: sub clean_up {
679: undef($navmap);
680: undef(@sequences);
681: }
682:
1.41 matthew 683: sub BuildProblemStatisticsPage {
684: my ($r,$c)=@_;
1.97 matthew 685: undef($navmap);
686: undef(@sequences);
1.61 matthew 687: #
688: my %Saveable_Parameters = ('Status' => 'scalar',
689: 'statsoutputmode' => 'scalar',
690: 'Section' => 'array',
1.108 raeburn 691: 'Groups' => 'array',
1.61 matthew 692: 'StudentData' => 'array',
1.77 matthew 693: 'Maps' => 'array',
694: 'fieldselections'=> 'array');
1.61 matthew 695: &Apache::loncommon::store_course_settings('statistics',
696: \%Saveable_Parameters);
697: &Apache::loncommon::restore_course_settings('statistics',
698: \%Saveable_Parameters);
699: #
700: &Apache::lonstatistics::PrepareClasslist();
1.41 matthew 701: #
1.73 matthew 702: # Clear the package variables
703: undef(@StatsArray);
1.79 matthew 704: undef(%SeqStat);
1.71 matthew 705: #
1.73 matthew 706: # Finally let the user know we are here
1.119 www 707: $r->print(&Apache::lonhtmlcommon::breadcrumbs('Overall Problem Statistics',
708: 'Statistics_Overall_Key'));
709:
1.87 matthew 710: my $interface = &CreateInterface($r);
1.57 matthew 711: $r->print($interface);
1.104 albertel 712: $r->print('<input type="hidden" name="sortby" value="'.$env{'form.sortby'}.
1.41 matthew 713: '" />');
1.73 matthew 714: #
1.117 bisitz 715: my @CacheButtonHTML =
1.87 matthew 716: &Apache::lonstathelpers::manage_caches($r,'Statistics','stats_status');
717: my $Str;
718: foreach my $html (@CacheButtonHTML) {
719: $Str.=$html.(' 'x5);
720: }
721: #
722: $r->print($Str);
1.104 albertel 723: if (! exists($env{'form.firstrun'})) {
1.117 bisitz 724: $r->print('<p class="LC_info"><b>'.
1.73 matthew 725: &mt('Press "Generate Statistics" when you are ready.').
1.117 bisitz 726: '</b></p>'.
727: '<p class="LC_info">'.
1.73 matthew 728: &mt('It may take some time to update the student data '.
1.117 bisitz 729: 'for the first analysis. Future analysis this session '.
1.113 bisitz 730: 'will not have this delay.').
1.73 matthew 731: '</p>');
1.105 albertel 732: &clean_up();
1.41 matthew 733: return;
1.28 stredwic 734: }
1.73 matthew 735: $r->rflush();
1.41 matthew 736: #
1.73 matthew 737: # This probably does not need to be done each time we are called, but
738: # it does not slow things down noticably.
739: &Apache::loncoursedata::populate_weight_table();
1.75 matthew 740: #
1.117 bisitz 741: ($navmap,@sequences) =
1.99 matthew 742: &Apache::lonstatistics::selected_sequences_with_assessments();
743: if (! ref($navmap)) {
1.115 bisitz 744: $r->print('<div class="LC_error">'.&mt('A course-wide error occurred.').'</div>'.
1.99 matthew 745: '<h3>'.$navmap.'</h3>');
1.105 albertel 746: &clean_up();
1.99 matthew 747: return;
748: }
1.104 albertel 749: if (exists($env{'form.Excel'})) {
1.122 golterma 750: $r->print('<p>'.
1.102 matthew 751: &Apache::lonstatistics::section_and_enrollment_description().
1.122 golterma 752: '</p>');
1.73 matthew 753: &Excel_output($r);
1.117 bisitz 754: } else {
1.87 matthew 755: $r->print('<input type="submit" name="Excel" value="'.
756: &mt('Produce Excel Output').'" />'.' 'x5);
757: $r->rflush();
1.122 golterma 758: $r->print('<p>'.
1.102 matthew 759: &Apache::lonstatistics::section_and_enrollment_description().
1.122 golterma 760: '</p>');
1.75 matthew 761: my $count = 0;
1.97 matthew 762: foreach my $seq (@sequences) {
1.117 bisitz 763: my @resources =
1.97 matthew 764: &Apache::lonstathelpers::get_resources($navmap,$seq);
765: $count += scalar(@resources);
1.75 matthew 766: }
767: if ($count > 10) {
1.122.2.2! raeburn 768: $r->print('<p>'.
! 769: &mt('Compiling statistics for [quant,_1,problem]',$count).
! 770: '</p>');
1.75 matthew 771: if ($count > 30) {
1.122.2.2! raeburn 772: $r->print('<p class="LC_info">'.&mt('This will take some time.').'</p>');
1.75 matthew 773: }
774: $r->rflush();
775: }
776: #
1.104 albertel 777: my $sortby = $env{'form.sortby'};
1.73 matthew 778: $sortby = 'container' if (! defined($sortby) || $sortby =~ /^\s*$/);
1.104 albertel 779: my $plot = $env{'form.plot'};
1.75 matthew 780: if ($plot eq '' || $plot eq 'none') {
781: undef($plot);
782: }
1.73 matthew 783: if ($sortby eq 'container' && ! defined($plot)) {
1.79 matthew 784: &output_sequence_statistics($r);
1.73 matthew 785: &output_html_by_sequence($r);
786: } else {
787: if (defined($plot)) {
788: &make_plot($r,$plot);
789: }
790: &output_html_stats($r);
1.79 matthew 791: &output_sequence_statistics($r);
1.73 matthew 792: }
793: }
1.105 albertel 794: &clean_up();
1.73 matthew 795: return;
796: }
797:
1.79 matthew 798: sub output_sequence_statistics {
799: my ($r) = @_;
800: my $c=$r->connection();
1.90 matthew 801: $r->print('<h2>'.&mt('Sequence Statistics').
802: &Apache::loncommon::help_open_topic('Statistics_Sequence').
803: '</h2>');
1.122 golterma 804: $r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row());
1.79 matthew 805: $r->print(&sequence_html_header());
1.122 golterma 806: $r->print(&Apache::loncommon::end_data_table_header_row());
1.117 bisitz 807: foreach my $seq (@sequences) {
1.79 matthew 808: last if ($c->aborted);
809: &compute_sequence_statistics($seq);
810: $r->print(&sequence_html_output($seq));
811: }
1.122 golterma 812: $r->print(&Apache::loncommon::end_data_table());
1.79 matthew 813: $r->rflush();
814: return;
815: }
816:
817:
1.73 matthew 818: ##########################################################
819: ##########################################################
820: ##
821: ## HTML output routines
822: ##
823: ##########################################################
824: ##########################################################
825: sub output_html_by_sequence {
826: my ($r) = @_;
827: my $c = $r->connection();
1.122 golterma 828: $r->print('<br>'.&html_preamble());
1.41 matthew 829: #
1.97 matthew 830: foreach my $seq (@sequences) {
1.73 matthew 831: last if ($c->aborted);
1.97 matthew 832: $r->print("<h3>".$seq->compTitle."</h3>".
1.122 golterma 833: &Apache::loncommon::start_data_table().
834: &Apache::loncommon::start_data_table_header_row().
835: &statistics_table_header('no container').
836: &Apache::loncommon::end_data_table_header_row()."\n");
1.73 matthew 837: my @Data = &compute_statistics_on_sequence($seq);
838: foreach my $data (@Data) {
1.122 golterma 839: $r->print(&Apache::loncommon::start_data_table_row().
840: &statistics_html_table_data($data,'no container').
841: &Apache::loncommon::end_data_table_row()."\n");
1.70 matthew 842: }
1.122 golterma 843: $r->print(&Apache::loncommon::end_data_table()."\n");
1.41 matthew 844: $r->rflush();
1.28 stredwic 845: }
1.41 matthew 846: return;
847: }
1.21 stredwic 848:
1.73 matthew 849: sub output_html_stats {
850: my ($r)=@_;
851: &compute_all_statistics($r);
852: $r->print(&html_preamble());
1.104 albertel 853: &sort_data($env{'form.sortby'});
1.73 matthew 854: #
855: my $count=0;
856: foreach my $data (@StatsArray) {
857: if ($count++ % 50 == 0) {
1.122 golterma 858: $r->print(&Apache::loncommon::end_data_table());
859: $r->print(&Apache::loncommon::start_data_table().
860: &Apache::loncommon::start_data_table_row().
861: &statistics_table_header().
862: &Apache::loncommon::end_data_table_row());
863: }
864: $r->print(&Apache::loncommon::start_data_table_row().
865: &statistics_html_table_data($data).
866: &Apache::loncommon::end_data_table_row());
1.73 matthew 867: }
1.122 golterma 868: $r->print(&Apache::loncommon::end_data_table_row());
1.73 matthew 869: return;
870: }
1.47 matthew 871:
1.73 matthew 872: sub html_preamble {
873: my $Str='';
874: $Str .= "<h2>".
1.104 albertel 875: $env{'course.'.$env{'request.course.id'}.'.description'}.
1.73 matthew 876: "</h2>\n";
877: my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits();
878: if (defined($starttime) || defined($endtime)) {
879: # Inform the user what the time limits on the data are.
880: $Str .= '<h3>'.&mt('Statistics on submissions from [_1] to [_2]',
881: &Apache::lonlocal::locallocaltime($starttime),
882: &Apache::lonlocal::locallocaltime($endtime)
883: ).'</h3>';
884: }
1.122 golterma 885: $Str .= "<p>".&mt('Compiled on [_1]',
886: &Apache::lonlocal::locallocaltime(time))."</p>";
1.73 matthew 887: return $Str;
888: }
1.47 matthew 889:
890:
1.44 matthew 891: ###############################################
892: ###############################################
1.73 matthew 893: ##
894: ## Misc HTML output routines
895: ##
896: ###############################################
897: ###############################################
898: sub statistics_html_table_data {
899: my ($data,$options) = @_;
900: my $row = '';
901: foreach my $field (@Fields) {
902: next if ($options =~ /no $field->{'name'}/);
1.76 matthew 903: next if ($field->{'selected'} ne 'yes');
1.122 golterma 904: $row .= '<td style="background-color:'.$field->{'color'}.'"';
1.73 matthew 905: if (exists($field->{'align'})) {
906: $row .= ' align="'.$field->{'align'}.'"';
1.41 matthew 907: }
1.73 matthew 908: $row .= '>';
909: if (exists($field->{'special'}) && $field->{'special'} eq 'link') {
910: $row .= '<a href="'.$data->{$field->{'name'}.'.link'}.'">';
1.41 matthew 911: }
1.92 matthew 912: if (exists($field->{'format'}) && $data->{$field->{'name'}} !~ /[A-Z]/i) {
1.73 matthew 913: $row .= sprintf($field->{'format'},$data->{$field->{'name'}});
914: } else {
915: $row .= $data->{$field->{'name'}};
916: }
917: if (exists($field->{'special'}) && $field->{'special'} eq 'link') {
918: $row.= '</a>';
919: }
920: $row .= '</td>';
1.21 stredwic 921: }
1.73 matthew 922: return $row;
1.41 matthew 923: }
1.25 stredwic 924:
1.73 matthew 925: sub statistics_table_header {
926: my ($options) = @_;
927: my $header_row;
928: foreach my $field (@Fields) {
929: next if ($options =~ /no $field->{'name'}/);
1.76 matthew 930: next if ($field->{'selected'} ne 'yes');
1.73 matthew 931: $header_row .= '<th>';
932: if (exists($field->{'sortable'}) && $field->{'sortable'} eq 'yes') {
933: $header_row .= '<a href="javascript:'.
934: 'document.Statistics.sortby.value='."'".$field->{'name'}."'".
935: ';document.Statistics.submit();">';
936: }
937: $header_row .= &mt($field->{'title'});
938: if ($options =~ /sortable/) {
939: $header_row.= '</a>';
940: }
941: if ($options !~ /no plots/ &&
942: exists($field->{'graphable'}) &&
943: $field->{'graphable'} eq 'yes') {
944: $header_row.=' (';
945: $header_row .= '<a href="javascript:'.
946: "document.Statistics.plot.value='$field->{'name'}'".
947: ';document.Statistics.submit();">';
948: $header_row .= &mt('plot').'</a>)';
949: }
950: $header_row .= '</th>';
951: }
952: return $header_row;
953: }
1.26 stredwic 954:
1.79 matthew 955: sub sequence_html_header {
956: my $Str .= '<tr>';
957: foreach my $field (@SeqFields) {
958: # next if ($field->{'selected'} ne 'yes');
959: $Str .= '<th bgcolor="'.$field->{'color'}.'"';
960: $Str .= '>'.$field->{'title'}.'</th>';
961: }
962: $Str .= '</tr>';
963: return $Str;
964: }
965:
966:
967: sub sequence_html_output {
968: my ($seq) = @_;
1.97 matthew 969: my $data = $SeqStat{$seq->symb};
1.79 matthew 970: my $row = '<tr>';
971: foreach my $field (@SeqFields) {
1.82 matthew 972: next if ($field->{'selected'} ne 'yes');
1.79 matthew 973: $row .= '<td bgcolor="'.$field->{'color'}.'"';
974: if (exists($field->{'align'})) {
975: $row .= ' align="'.$field->{'align'}.'"';
976: }
977: $row .= '>';
978: if (exists($field->{'format'})) {
979: $row .= sprintf($field->{'format'},$data->{$field->{'name'}});
980: } else {
981: $row .= $data->{$field->{'name'}};
982: }
983: $row .= '</td>';
984: }
985: $row .= '</tr>'."\n";
986: return $row;
987: }
988:
1.73 matthew 989: ####################################################
990: ####################################################
991: ##
992: ## Plotting Routines
993: ##
994: ####################################################
995: ####################################################
996: sub make_plot {
997: my ($r,$plot) = @_;
998: &compute_all_statistics($r);
1.104 albertel 999: &sort_data($env{'form.sortby'});
1.73 matthew 1000: if ($plot eq 'degrees') {
1001: °rees_plot($r);
1.74 matthew 1002: } elsif ($plot eq 'tries statistics') {
1003: &tries_data_plot($r);
1.73 matthew 1004: } else {
1005: &make_single_stat_plot($r,$plot);
1006: }
1007: return;
1008: }
1.47 matthew 1009:
1.73 matthew 1010: sub make_single_stat_plot {
1011: my ($r,$datafield) = @_;
1.41 matthew 1012: #
1.73 matthew 1013: my $title; my $yaxis;
1014: foreach my $field (@Fields) {
1015: next if ($field->{'name'} ne $datafield);
1.122.2.2! raeburn 1016: $title = &mt($field->{'long_title'});
! 1017: $yaxis = &mt($field->{'title'});
1.73 matthew 1018: last;
1019: }
1020: if ($title eq '' || $yaxis eq '') {
1021: # datafield is something we do not know enough about to plot
1.122.2.2! raeburn 1022: $r->print('<p class="LC_warning">'.
1.73 matthew 1023: &mt('Unable to plot the requested statistic.').
1.122.2.2! raeburn 1024: '</p>');
1.73 matthew 1025: return;
1.49 matthew 1026: }
1027: #
1.73 matthew 1028: # Build up the data sets to plot
1.117 bisitz 1029: my @Labels;
1.73 matthew 1030: my @Data;
1031: my $max = 1;
1032: foreach my $data (@StatsArray) {
1033: push(@Labels,$data->{'problem_num'});
1034: push(@Data,$data->{$datafield});
1035: if ($data->{$datafield}>$max) {
1036: $max = $data->{$datafield};
1037: }
1038: }
1039: foreach (1,2,3,4,5,10,15,20,25,40,50,75,100,150,200,250,300,500,600,750,
1040: 1000,1500,2000,2500,3000,3500,4000,5000,7500,10000,15000,20000) {
1041: if ($max <= $_) {
1042: $max = $_;
1043: last;
1.42 matthew 1044: }
1045: }
1.73 matthew 1046: if ($max > 20000) {
1047: $max = 10000*(int($max/10000)+1);
1.42 matthew 1048: }
1.73 matthew 1049: #
1050: $r->print("<p>".&Apache::loncommon::DrawBarGraph($title,
1.122.2.2! raeburn 1051: &mt('Problem Number'),
1.73 matthew 1052: $yaxis,
1053: $max,
1054: undef, # colors
1055: \@Labels,
1056: \@Data)."</p>\n");
1057: return;
1058: }
1059:
1060: sub degrees_plot {
1061: my ($r)=@_;
1062: my $count = scalar(@StatsArray);
1063: my $width = 50 + 10*$count;
1064: $width = 300 if ($width < 300);
1065: my $height = 300;
1066: my $plot = '';
1067: my $ymax = 0;
1068: my $ymin = 0;
1.117 bisitz 1069: my @Disc; my @Diff; my @Labels;
1.73 matthew 1070: foreach my $data (@StatsArray) {
1071: push(@Labels,$data->{'problem_num'});
1072: my $disc = $data->{'deg_of_disc'};
1073: my $diff = $data->{'deg_of_diff'};
1074: push(@Disc,$disc);
1075: push(@Diff,$diff);
1076: #
1077: $ymin = $disc if ($ymin > $disc);
1078: $ymin = $diff if ($ymin > $diff);
1079: $ymax = $disc if ($ymax < $disc);
1080: $ymax = $diff if ($ymax < $diff);
1081: }
1082: #
1083: # Make sure we show relevant information.
1084: if ($ymin < 0) {
1085: if (abs($ymin) < 0.05) {
1086: $ymin = 0;
1087: } else {
1088: $ymin = -1;
1.42 matthew 1089: }
1090: }
1.73 matthew 1091: if ($ymax > 0) {
1092: if (abs($ymax) < 0.05) {
1093: $ymax = 0;
1.42 matthew 1094: } else {
1.73 matthew 1095: $ymax = 1;
1.42 matthew 1096: }
1.43 matthew 1097: }
1.49 matthew 1098: #
1.73 matthew 1099: my $xmax = $Labels[-1];
1100: if ($xmax > 50) {
1101: if ($xmax % 10 != 0) {
1102: $xmax = 10 * (int($xmax/10)+1);
1103: }
1104: } else {
1105: if ($xmax % 5 != 0) {
1106: $xmax = 5 * (int($xmax/5)+1);
1.49 matthew 1107: }
1.26 stredwic 1108: }
1.41 matthew 1109: #
1.73 matthew 1110: my $discdata .= '<data>'.join(',',@Labels).'</data>'.$/.
1111: '<data>'.join(',',@Disc).'</data>'.$/;
1112: #
1113: my $diffdata .= '<data>'.join(',',@Labels).'</data>'.$/.
1114: '<data>'.join(',',@Diff).'</data>'.$/;
1115: #
1.122.2.2! raeburn 1116: my $title = &mt('Degree of Discrimination[_1]and Degree of Difficulty','\n');
1.81 matthew 1117: if ($xmax > 50) {
1.122.2.2! raeburn 1118: $title = &mt('Degree of Discrimination and Degree of Difficulty');
1.81 matthew 1119: }
1.122.2.2! raeburn 1120: my %lt = &Apache::lonlocal::texthash(
! 1121: 'alttag' => 'Degree of Discrimination and Degree of Difficulty Plot',
! 1122: 'xlabel' => 'Problem Number',
! 1123: );
1.81 matthew 1124: #
1.73 matthew 1125: $plot=<<"END";
1126: <gnuplot
1127: texfont="10"
1128: fgcolor="x000000"
1129: plottype="Cartesian"
1130: font="large"
1131: grid="on"
1132: align="center"
1133: border="on"
1134: transparent="on"
1.122.2.2! raeburn 1135: alttag="$lt{'alttag'}"
1.73 matthew 1136: samples="100"
1137: bgcolor="xffffff"
1138: height="$height"
1139: width="$width">
1140: <key
1141: pos="top right"
1142: title=""
1143: box="off" />
1.81 matthew 1144: <title>$title</title>
1.73 matthew 1145: <axis xmin="0" ymin="$ymin" xmax="$xmax" ymax="$ymax" color="x000000" />
1.122.2.2! raeburn 1146: <xlabel>$lt{'xlabel'}</xlabel>
1.73 matthew 1147: <curve
1148: linestyle="linespoints"
1149: name="DoDisc"
1150: pointtype="0"
1151: color="x000000">
1152: $discdata
1153: </curve>
1154: <curve
1155: linestyle="linespoints"
1156: name="DoDiff"
1157: pointtype="0"
1158: color="xFF0000">
1159: $diffdata
1160: </curve>
1161: </gnuplot>
1162: END
1.117 bisitz 1163: my $plotresult =
1.73 matthew 1164: '<p>'.&Apache::lonxml::xmlparse($r,'web',$plot).'</p>'.$/;
1165: $r->print($plotresult);
1.41 matthew 1166: return;
1.42 matthew 1167: }
1168:
1.74 matthew 1169: sub tries_data_plot {
1170: my ($r)=@_;
1171: my $count = scalar(@StatsArray);
1172: my $width = 50 + 10*$count;
1173: $width = 300 if ($width < 300);
1174: my $height = 300;
1175: my $plot = '';
1176: my @STD; my @Mean; my @Max; my @Min;
1177: my @Labels;
1178: my $ymax = 5;
1179: foreach my $data (@StatsArray) {
1180: my $max = $data->{'mean_tries'} + $data->{'std_tries'};
1181: $ymax = $max if ($ymax < $max);
1182: $ymax = $max if ($ymax < $max);
1183: push(@Labels,$data->{'problem_num'});
1184: push(@STD,$data->{'std_tries'});
1185: push(@Mean,$data->{'mean_tries'});
1186: }
1187: #
1188: # Make sure we show relevant information.
1189: my $xmax = $Labels[-1];
1190: if ($xmax > 50) {
1191: if ($xmax % 10 != 0) {
1192: $xmax = 10 * (int($xmax/10)+1);
1193: }
1194: } else {
1195: if ($xmax % 5 != 0) {
1196: $xmax = 5 * (int($xmax/5)+1);
1197: }
1198: }
1199: $ymax = int($ymax)+1+2;
1200: #
1201: my $std_data .= '<data>'.join(',',@Labels).'</data>'.$/.
1202: '<data>'.join(',',@Mean).'</data>'.$/;
1203: #
1204: my $std_error_data .= '<data>'.join(',',@Labels).'</data>'.$/.
1205: '<data>'.join(',',@Mean).'</data>'.$/.
1206: '<data>'.join(',',@STD).'</data>'.$/;
1207: #
1.122.2.2! raeburn 1208: my $title = &mt('Mean and S.D. of Tries');
! 1209: if ($xmax > 30) {
! 1210: $title = &mt('Mean and Standard Deviation of Tries');
1.81 matthew 1211: }
1212: #
1.122.2.2! raeburn 1213: my %lt = &Apache::lonlocal::texthash(
! 1214: 'alttag' => 'Mean and S.D of Tries Plot',
! 1215: 'xlabel' => 'Problem Number',
! 1216: 'ylabel' => 'Number of Tries',
! 1217: );
1.74 matthew 1218: $plot=<<"END";
1219: <gnuplot
1220: texfont="10"
1221: fgcolor="x000000"
1222: plottype="Cartesian"
1223: font="large"
1224: grid="on"
1225: align="center"
1226: border="on"
1227: transparent="on"
1.122.2.2! raeburn 1228: alttag="$lt{'alttag'}"
1.74 matthew 1229: samples="100"
1230: bgcolor="xffffff"
1231: height="$height"
1232: width="$width">
1.81 matthew 1233: <title>$title</title>
1.74 matthew 1234: <axis xmin="0" ymin="0" xmax="$xmax" ymax="$ymax" color="x000000" />
1.122.2.2! raeburn 1235: <xlabel>$lt{'xlabel'}</xlabel>
! 1236: <ylabel>$lt{'ylabel'}</ylabel>
1.74 matthew 1237: <curve
1238: linestyle="yerrorbars"
1239: name="S.D. Tries"
1240: pointtype="1"
1241: color="x666666">
1242: $std_error_data
1243: </curve>
1244: <curve
1245: linestyle="points"
1246: name="Mean Tries"
1247: pointtype="1"
1248: color="xCC4444">
1249: $std_data
1250: </curve>
1251: </gnuplot>
1252: END
1.117 bisitz 1253: my $plotresult =
1.74 matthew 1254: '<p>'.&Apache::lonxml::xmlparse($r,'web',$plot).'</p>'.$/;
1255: $r->print($plotresult);
1256: return;
1257: }
1258:
1.73 matthew 1259: sub plot_dropdown {
1260: my $current = '';
1.122.2.2! raeburn 1261: my $title;
1.73 matthew 1262: #
1.104 albertel 1263: if (defined($env{'form.plot'})) {
1264: $current = $env{'form.plot'};
1.73 matthew 1265: }
1266: #
1267: my @Additional_Plots = (
1268: { graphable=>'yes',
1269: name => 'degrees',
1.81 matthew 1270: title => 'Difficulty Indexes' },
1.74 matthew 1271: { graphable=>'yes',
1272: name => 'tries statistics',
1.81 matthew 1273: title => 'Tries Statistics' });
1.73 matthew 1274: #
1275: my $Str= "\n".'<select name="plot" size="1">';
1276: $Str .= '<option name="none"></option>'."\n";
1.122.2.2! raeburn 1277: $Str .= '<option name="none2">'.&mt('none').'</option>'."\n";
1.81 matthew 1278: foreach my $field (@Additional_Plots,@Fields) {
1.73 matthew 1279: if (! exists($field->{'graphable'}) ||
1280: $field->{'graphable'} ne 'yes') {
1281: next;
1282: }
1283: $Str .= '<option value="'.$field->{'name'}.'"';
1284: if ($field->{'name'} eq $current) {
1.122.2.2! raeburn 1285: $Str .= ' selected="selected"';
1.73 matthew 1286: }
1.122.2.2! raeburn 1287: $title = &mt($field->{'long_title'});
! 1288: $title = &mt($field->{'title'}) if (!$title);
! 1289: $Str.= '>'.$title.'</option>'."\n";
1.73 matthew 1290: }
1291: $Str .= '</select>'."\n";
1292: return $Str;
1293: }
1294:
1.41 matthew 1295: ###############################################
1296: ###############################################
1.73 matthew 1297: ##
1298: ## Excel output routines
1299: ##
1.41 matthew 1300: ###############################################
1301: ###############################################
1.73 matthew 1302: sub Excel_output {
1.44 matthew 1303: my ($r) = @_;
1.73 matthew 1304: $r->print('<h2>'.&mt('Preparing Excel Spreadsheet').'</h2>');
1305: ##
1306: ## Compute the statistics
1307: &compute_all_statistics($r);
1308: my $c = $r->connection;
1309: return if ($c->aborted());
1.101 matthew 1310: #
1311: my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits();
1.73 matthew 1312: ##
1313: ## Create the excel workbook
1.101 matthew 1314: my ($excel_workbook,$filename,$format) =
1315: &Apache::loncommon::create_workbook($r);
1316: return if (! defined($excel_workbook));
1.44 matthew 1317: #
1318: # Add a worksheet
1.104 albertel 1319: my $sheetname = $env{'course.'.$env{'request.course.id'}.'.description'};
1.44 matthew 1320: if (length($sheetname) > 31) {
1321: $sheetname = substr($sheetname,0,31);
1322: }
1.73 matthew 1323: my $excel_sheet = $excel_workbook->addworksheet(
1324: &Apache::loncommon::clean_excel_name($sheetname));
1325: ##
1326: ## Begin creating excel sheet
1327: ##
1328: my ($rows_output,$cols_output) = (0,0);
1.44 matthew 1329: #
1330: # Put the course description in the header
1331: $excel_sheet->write($rows_output,$cols_output++,
1.104 albertel 1332: $env{'course.'.$env{'request.course.id'}.'.description'},
1.82 matthew 1333: $format->{'h1'});
1.44 matthew 1334: $cols_output += 3;
1335: #
1336: # Put a description of the sections listed
1337: my $sectionstring = '';
1.82 matthew 1338: $excel_sheet->write($rows_output,$cols_output++,
1.103 matthew 1339: &Apache::lonstatistics::section_and_enrollment_description('plaintext'),
1.82 matthew 1340: $format->{'h3'});
1.102 matthew 1341: $cols_output += scalar(&Apache::lonstatistics::get_selected_sections());
1.108 raeburn 1342: $cols_output += scalar(&Apache::lonstatistics::get_selected_groups());
1.44 matthew 1343: #
1.70 matthew 1344: # Time restrictions
1345: my $time_string;
1346: if (defined($starttime)) {
1347: # call localtime but not lonlocal:locallocaltime because excel probably
1348: # cannot handle localized text. Probably.
1349: $time_string .= 'Data collected from '.localtime($time_string);
1350: if (defined($endtime)) {
1351: $time_string .= ' to '.localtime($endtime);
1352: }
1353: $time_string .= '.';
1354: } elsif (defined($endtime)) {
1355: # See note above about lonlocal:locallocaltime
1356: $time_string .= 'Data collected before '.localtime($endtime).'.';
1357: }
1.82 matthew 1358: if (defined($time_string)) {
1359: $excel_sheet->write($rows_output,$cols_output++,$time_string);
1360: $cols_output+= 5;
1361: }
1.70 matthew 1362: #
1.44 matthew 1363: # Put the date in there too
1364: $excel_sheet->write($rows_output,$cols_output++,
1365: 'Compiled on '.localtime(time));
1366: #
1.117 bisitz 1367: $rows_output++;
1.44 matthew 1368: $cols_output=0;
1.82 matthew 1369: ##
1370: ## Sequence Statistics
1.117 bisitz 1371: ##
1.82 matthew 1372: &write_headers($excel_sheet,$format,\$rows_output,\$cols_output,
1373: \@SeqFields);
1.97 matthew 1374: foreach my $seq (@sequences) {
1375: my $data = $SeqStat{$seq->symb};
1.82 matthew 1376: $cols_output=0;
1377: foreach my $field (@SeqFields) {
1378: next if ($field->{'selected'} ne 'yes');
1.85 matthew 1379: my $fieldformat = undef;
1380: if (exists($field->{'excel_format'})) {
1381: $fieldformat = $format->{$field->{'excel_format'}};
1382: }
1.55 matthew 1383: $excel_sheet->write($rows_output,$cols_output++,
1.85 matthew 1384: $data->{$field->{'name'}},$fieldformat);
1.55 matthew 1385: }
1.82 matthew 1386: $rows_output++;
1387: $cols_output=0;
1.55 matthew 1388: }
1.82 matthew 1389: ##
1390: ## Resource Statistics
1391: ##
1.55 matthew 1392: $rows_output++;
1393: $cols_output=0;
1.82 matthew 1394: &write_headers($excel_sheet,$format,\$rows_output,\$cols_output,
1395: \@Fields);
1396: #
1.73 matthew 1397: foreach my $data (@StatsArray) {
1398: $cols_output=0;
1399: foreach my $field (@Fields) {
1.76 matthew 1400: next if ($field->{'selected'} ne 'yes');
1.73 matthew 1401: next if ($field->{'name'} eq 'problem_num');
1.85 matthew 1402: my $fieldformat = undef;
1403: if (exists($field->{'excel_format'})) {
1404: $fieldformat = $format->{$field->{'excel_format'}};
1405: }
1.73 matthew 1406: $excel_sheet->write($rows_output,$cols_output++,
1.85 matthew 1407: $data->{$field->{'name'}},$fieldformat);
1.44 matthew 1408: }
1.73 matthew 1409: $rows_output++;
1.82 matthew 1410: $cols_output=0;
1.44 matthew 1411: }
1412: #
1413: $excel_workbook->close();
1.73 matthew 1414: #
1.44 matthew 1415: # Tell the user where to get their excel file
1416: $r->print('<br />'.
1.59 matthew 1417: '<a href="'.$filename.'">'.
1418: &mt('Your Excel Spreadsheet').'</a>'."\n");
1.44 matthew 1419: $r->rflush();
1420: return;
1421: }
1422:
1.82 matthew 1423: ##
1424: ## &write_headers
1425: ##
1426: sub write_headers {
1427: my ($excel_sheet,$format,$rows_output,$cols_output,$Fields) = @_;
1428: ##
1429: ## First the long titles
1430: foreach my $field (@{$Fields}) {
1431: next if ($field->{'name'} eq 'problem_num');
1432: next if ($field->{'selected'} ne 'yes');
1433: if (exists($field->{'long_title'})) {
1434: $excel_sheet->write($$rows_output,${$cols_output},
1435: $field->{'long_title'},
1436: $format->{'bold'});
1437: } else {
1438: $excel_sheet->write($$rows_output,${$cols_output},'');
1439: }
1440: ${$cols_output}+= 1;
1441: }
1442: ${$cols_output} =0;
1443: ${$rows_output}+=1;
1444: ##
1445: ## Then the short titles
1446: foreach my $field (@{$Fields}) {
1447: next if ($field->{'selected'} ne 'yes');
1448: next if ($field->{'name'} eq 'problem_num');
1.117 bisitz 1449: # Use english for excel as I am not sure how well excel handles
1.82 matthew 1450: # other character sets....
1451: $excel_sheet->write($$rows_output,$$cols_output,
1452: $field->{'title'},
1453: $format->{'bold'});
1454: $$cols_output+=1;
1455: }
1456: ${$cols_output} =0;
1457: ${$rows_output}+=1;
1458: return;
1459: }
1460:
1.73 matthew 1461: ##################################################
1462: ##################################################
1463: ##
1464: ## Statistics Gathering and Manipulation Routines
1465: ##
1466: ##################################################
1467: ##################################################
1468: sub compute_statistics_on_sequence {
1469: my ($seq) = @_;
1470: my @Data;
1.97 matthew 1471: foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)) {
1472: foreach my $part (@{$res->parts}) {
1.118 raeburn 1473: next if (($res->is_survey($part)) || ($res->is_anonsurvey($part))) ;
1.73 matthew 1474: #
1475: # This is where all the work happens
1476: my $data = &get_statistics($seq,$res,$part,scalar(@StatsArray)+1);
1477: push (@Data,$data);
1478: push (@StatsArray,$data);
1.49 matthew 1479: }
1.26 stredwic 1480: }
1.73 matthew 1481: return @Data;
1.41 matthew 1482: }
1.26 stredwic 1483:
1.73 matthew 1484: sub compute_all_statistics {
1485: my ($r) = @_;
1486: if (@StatsArray > 0) {
1487: # Assume we have already computed the statistics
1488: return;
1489: }
1490: my $c = $r->connection;
1.97 matthew 1491: foreach my $seq (@sequences) {
1.73 matthew 1492: last if ($c->aborted);
1.82 matthew 1493: &compute_sequence_statistics($seq);
1.73 matthew 1494: &compute_statistics_on_sequence($seq);
1.49 matthew 1495: }
1496: }
1497:
1.73 matthew 1498: sub sort_data {
1499: my ($sortkey) = @_;
1500: return if (! @StatsArray);
1.45 matthew 1501: #
1.73 matthew 1502: # Sort the data
1503: my $sortby = undef;
1.49 matthew 1504: foreach my $field (@Fields) {
1.73 matthew 1505: if ($sortkey eq $field->{'name'}) {
1506: $sortby = $field->{'name'};
1.45 matthew 1507: }
1.26 stredwic 1508: }
1.73 matthew 1509: if (! defined($sortby) || $sortby eq '' || $sortby eq 'problem_num') {
1510: $sortby = 'container';
1511: }
1512: if ($sortby ne 'container') {
1513: # $sortby is already defined, so we can charge ahead
1514: if ($sortby =~ /^(title|part)$/i) {
1515: # Alpha comparison
1516: @StatsArray = sort {
1517: lc($a->{$sortby}) cmp lc($b->{$sortby}) ||
1518: lc($a->{'title'}) cmp lc($b->{'title'}) ||
1519: lc($a->{'part'}) cmp lc($b->{'part'});
1520: } @StatsArray;
1.24 stredwic 1521: } else {
1.73 matthew 1522: # Numerical comparison
1523: @StatsArray = sort {
1524: my $retvalue = 0;
1525: if ($b->{$sortby} eq 'nan') {
1526: if ($a->{$sortby} ne 'nan') {
1527: $retvalue = -1;
1528: } else {
1529: $retvalue = 0;
1530: }
1531: }
1532: if ($a->{$sortby} eq 'nan') {
1533: if ($b->{$sortby} ne 'nan') {
1534: $retvalue = 1;
1535: }
1536: }
1537: if ($retvalue eq '0') {
1538: $retvalue = $b->{$sortby} <=> $a->{$sortby} ||
1539: lc($a->{'title'}) <=> lc($b->{'title'}) ||
1540: lc($a->{'part'}) <=> lc($b->{'part'});
1541: }
1542: $retvalue;
1543: } @StatsArray;
1.24 stredwic 1544: }
1545: }
1.45 matthew 1546: #
1.73 matthew 1547: # Renumber the data set
1548: my $count;
1549: foreach my $data (@StatsArray) {
1550: $data->{'problem_num'} = ++$count;
1551: }
1.24 stredwic 1552: return;
1.48 matthew 1553: }
1554:
1.70 matthew 1555: ########################################################
1556: ########################################################
1557:
1558: =pod
1559:
1560: =item &get_statistics()
1561:
1.117 bisitz 1562: Wrapper routine from the call to loncoursedata::get_problem_statistics.
1.73 matthew 1563: Calls lonstathelpers::get_time_limits() to limit the data set by time
1564: and &compute_discrimination_factor
1.70 matthew 1565:
1566: Inputs: $sequence, $resource, $part, $problem_num
1567:
1.117 bisitz 1568: Returns: Hash reference with statistics data from
1.70 matthew 1569: loncoursedata::get_problem_statistics.
1570:
1571: =cut
1572:
1573: ########################################################
1574: ########################################################
1.48 matthew 1575: sub get_statistics {
1.49 matthew 1576: my ($sequence,$resource,$part,$problem_num) = @_;
1.48 matthew 1577: #
1.70 matthew 1578: my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits();
1.97 matthew 1579: my $symb = $resource->symb;
1.104 albertel 1580: my $courseid = $env{'request.course.id'};
1.48 matthew 1581: #
1.49 matthew 1582: my $data = &Apache::loncoursedata::get_problem_statistics
1.102 matthew 1583: ([&Apache::lonstatistics::get_selected_sections()],
1.108 raeburn 1584: [&Apache::lonstatistics::get_selected_groups()],
1.66 matthew 1585: $Apache::lonstatistics::enrollment_status,
1.70 matthew 1586: $symb,$part,$courseid,$starttime,$endtime);
1.85 matthew 1587: $data->{'symb'} = $symb;
1.49 matthew 1588: $data->{'part'} = $part;
1589: $data->{'problem_num'} = $problem_num;
1.97 matthew 1590: $data->{'container'} = $sequence->compTitle;
1591: $data->{'title'} = $resource->compTitle;
1592: $data->{'title.link'} = $resource->src.'?symb='.
1.109 www 1593: &escape($resource->symb);
1.49 matthew 1594: #
1.76 matthew 1595: if ($SelectedFields{'deg_of_disc'}) {
1.117 bisitz 1596: $data->{'deg_of_disc'} =
1.76 matthew 1597: &compute_discrimination_factor($resource,$part,$sequence);
1598: }
1.83 matthew 1599: #
1600: # Store in metadata if computations were done for all students
1.84 matthew 1601: if ($data->{'num_students'} > 1) {
1.102 matthew 1602: my @Sections = &Apache::lonstatistics::get_selected_sections();
1.84 matthew 1603: my $sections = '"'.join(' ',@Sections).'"';
1604: $sections =~ s/&+/_/g; # Ensure no special characters
1605: $data->{'sections'}=$sections;
1.104 albertel 1606: $data->{'course'} = $env{'request.course.id'};
1.97 matthew 1607: my $urlres=(&Apache::lonnet::decode_symb($resource->symb))[2];
1.117 bisitz 1608: my %storestats =
1.84 matthew 1609: &LONCAPA::lonmetadata::dynamic_metadata_storage($data);
1.117 bisitz 1610: my ($dom,$user) = ($urlres=~m{^($LONCAPA::domain_re)/($LONCAPA::username_re)});
1.83 matthew 1611: &Apache::lonnet::put('nohist_resevaldata',\%storestats,$dom,$user);
1612: }
1.85 matthew 1613: #
1.95 matthew 1614: $data->{'tries_per_correct'} = $data->{'tries'} /
1615: ($data->{'num_solved'}+0.1);
1616: #
1.85 matthew 1617: # Get the due date for research purposes (commented out most of the time)
1.112 raeburn 1618: # my $duedate = &Apache::lonnet::EXT('resource.'.$part.'.duedate',$symb);;
1619: # my $opendate = &Apache::lonnet::EXT('resource.'.$part.'.opendate',$symb);
1620: # my $maxtries = &Apache::lonnet::EXT('resource.'.$part.'.maxtries',$symb);
1621: # my $hinttries = &Apache::lonnet::EXT('resource.'.$part.'.hinttries',$symb);
1622: my $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight',$symb);
1623: $data->{'weight'} = $weight;
1.117 bisitz 1624: # $data->{'duedate'} = $duedate;
1.112 raeburn 1625: # $data->{'opendate'} = $opendate;
1626: # $data->{'maxtries'} = $maxtries;
1627: # $data->{'hinttries'} = $hinttries;
1.86 matthew 1628: # $data->{'resptypes'} = join(',',@{$resource->{'partdata'}->{$part}->{'ResponseTypes'}});
1.49 matthew 1629: return $data;
1.71 matthew 1630: }
1631:
1632: ###############################################
1633: ###############################################
1634:
1635: =pod
1636:
1637: =item &compute_discrimination_factor()
1638:
1639: Inputs: $Resource, $Sequence
1640:
1641: Returns: integer between -1 and 1
1642:
1643: =cut
1644:
1645: ###############################################
1646: ###############################################
1647: sub compute_discrimination_factor {
1.97 matthew 1648: my ($resource,$part,$seq) = @_;
1649: my $symb = $resource->symb;
1.71 matthew 1650: my @Resources;
1.97 matthew 1651: foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)){
1652: next if ($res->symb eq $symb);
1653: push (@Resources,$res->symb);
1.71 matthew 1654: }
1655: #
1656: # rank
1.83 matthew 1657: my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits();
1.117 bisitz 1658: my $ranking =
1.71 matthew 1659: &Apache::loncoursedata::rank_students_by_scores_on_resources
1660: (\@Resources,
1.102 matthew 1661: [&Apache::lonstatistics::get_selected_sections()],
1.108 raeburn 1662: [&Apache::lonstatistics::get_selected_groups()],
1.83 matthew 1663: $Apache::lonstatistics::enrollment_status,undef,
1.106 bowersj2 1664: $starttime,$endtime, $symb);
1.71 matthew 1665: #
1666: # compute their percent scores on the problems in the sequence,
1667: my $number_to_grab = int(scalar(@{$ranking})/4);
1668: my $num_students = scalar(@{$ranking});
1.117 bisitz 1669: my @BottomSet = map { $_->[&Apache::loncoursedata::RNK_student()];
1.71 matthew 1670: } @{$ranking}[0..$number_to_grab];
1.117 bisitz 1671: my @TopSet =
1672: map {
1673: $_->[&Apache::loncoursedata::RNK_student()];
1.106 bowersj2 1674: } @{$ranking}[-$number_to_grab..0];
1.91 matthew 1675: if (! @BottomSet || (@BottomSet == 1 && $BottomSet[0] eq '') ||
1676: ! @TopSet || (@TopSet == 1 && $TopSet[0] eq '')) {
1677: return 'nan';
1678: }
1.117 bisitz 1679: my ($bottom_sum,$bottom_max) =
1.97 matthew 1680: &Apache::loncoursedata::get_sum_of_scores($symb,$part,\@BottomSet,
1.83 matthew 1681: undef,$starttime,$endtime);
1.117 bisitz 1682: my ($top_sum,$top_max) =
1.97 matthew 1683: &Apache::loncoursedata::get_sum_of_scores($symb,$part,\@TopSet,
1.83 matthew 1684: undef,$starttime,$endtime);
1.71 matthew 1685: my $deg_of_disc;
1686: if ($top_max == 0 || $bottom_max==0) {
1687: $deg_of_disc = 'nan';
1688: } else {
1689: $deg_of_disc = ($top_sum/$top_max) - ($bottom_sum/$bottom_max);
1690: }
1691: #&Apache::lonnet::logthis(' '.$top_sum.'/'.$top_max.
1692: # ' - '.$bottom_sum.'/'.$bottom_max);
1693: return $deg_of_disc;
1.1 stredwic 1694: }
1.12 minaeibi 1695:
1.45 matthew 1696: ###############################################
1697: ###############################################
1.79 matthew 1698: ##
1699: ## Compute KR-21
1700: ##
1701: ## To compute KR-21, you need the following information:
1702: ##
1703: ## K=the number of items in your test
1704: ## M=the mean score on the test
1.117 bisitz 1705: ## s=the standard deviation of the scores on your test
1.79 matthew 1706: ##
1707: ## then:
1.117 bisitz 1708: ##
1.79 matthew 1709: ## KR-21 rk= [K/(K-1)] * [1- (M*(K-M))/(K*s^2))]
1710: ##
1711: ###############################################
1712: ###############################################
1713: sub compute_sequence_statistics {
1714: my ($seq) = @_;
1.97 matthew 1715: my $symb = $seq->symb;
1.79 matthew 1716: my @Resources;
1.97 matthew 1717: my $part_count;
1718: foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)) {
1719: push (@Resources,$res->symb);
1720: $part_count += scalar(@{$res->parts});
1.79 matthew 1721: }
1722: my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits();
1723: #
1724: # First compute statistics based on student scores
1.117 bisitz 1725: my ($smin,$smax,$sMean,$sSTD,$scount,$sMAX) =
1.79 matthew 1726: &Apache::loncoursedata::score_stats
1.102 matthew 1727: ([&Apache::lonstatistics::get_selected_sections()],
1.108 raeburn 1728: [&Apache::lonstatistics::get_selected_groups()],
1.79 matthew 1729: $Apache::lonstatistics::enrollment_status,
1730: \@Resources,$starttime,$endtime,undef);
1.97 matthew 1731: $SeqStat{$symb}->{'title'} = $seq->compTitle;
1.79 matthew 1732: $SeqStat{$symb}->{'scoremax'} = $smax;
1733: $SeqStat{$symb}->{'scoremin'} = $smin;
1734: $SeqStat{$symb}->{'scoremean'} = $sMean;
1735: $SeqStat{$symb}->{'scorestd'} = $sSTD;
1736: $SeqStat{$symb}->{'scorecount'} = $scount;
1737: $SeqStat{$symb}->{'max_possible'} = $sMAX;
1738: #
1739: # Compute statistics based on the number of correct problems
1.117 bisitz 1740: # 'correct' is taken to mean
1.79 matthew 1741: my ($cmin,$cmax,$cMean,$cSTD,$ccount)=
1742: &Apache::loncoursedata::count_stats
1.102 matthew 1743: ([&Apache::lonstatistics::get_selected_sections()],
1.108 raeburn 1744: [&Apache::lonstatistics::get_selected_groups()],
1.79 matthew 1745: $Apache::lonstatistics::enrollment_status,
1746: \@Resources,$starttime,$endtime,undef);
1.97 matthew 1747: my $K = $part_count;
1.79 matthew 1748: my $kr_21;
1749: if ($K > 1 && $cSTD > 0) {
1750: $kr_21 = ($K/($K-1)) * (1 - $cMean*($K-$cMean)/($K*$cSTD**2));
1751: } else {
1752: $kr_21 = 'nan';
1753: }
1754: $SeqStat{$symb}->{'countmax'} = $cmax;
1755: $SeqStat{$symb}->{'countmin'} = $cmin;
1756: $SeqStat{$symb}->{'countstd'} = $cSTD;
1.82 matthew 1757: $SeqStat{$symb}->{'countmean'} = $cMean;
1.79 matthew 1758: $SeqStat{$symb}->{'count'} = $ccount;
1759: $SeqStat{$symb}->{'items'} = $K;
1760: $SeqStat{$symb}->{'KR-21'}=$kr_21;
1761: return;
1762: }
1763:
1764:
1.47 matthew 1765:
1766: =pod
1767:
1.73 matthew 1768: =item ProblemStatisticsLegend
1769:
1770: =over 4
1771:
1772: =item #Stdnts
1773: Total number of students attempted the problem.
1774:
1775: =item Tries
1776: Total number of tries for solving the problem.
1.59 matthew 1777:
1.73 matthew 1778: =item Max Tries
1779: Largest number of tries for solving the problem by a student.
1780:
1781: =item Mean
1782: Average number of tries. [ Tries / #Stdnts ]
1783:
1784: =item #YES
1785: Number of students solved the problem correctly.
1786:
1787: =item #yes
1788: Number of students solved the problem by override.
1789:
1790: =item %Wrong
1791: Percentage of students who tried to solve the problem
1792: but is still incorrect. [ 100*((#Stdnts-(#YES+#yes))/#Stdnts) ]
1793:
1794: =item DoDiff
1795: Degree of Difficulty of the problem.
1796: [ 1 - ((#YES+#yes) / Tries) ]
1797:
1798: =item S.D.
1799: Standard Deviation of the tries.
1800: [ sqrt(sum((Xi - Mean)^2)) / (#Stdnts-1)
1801: where Xi denotes every student\'s tries ]
1802:
1803: =item Skew.
1804: Skewness of the students tries.
1805: [(sqrt( sum((Xi - Mean)^3) / #Stdnts)) / (S.D.^3)]
1806:
1807: =item Dis.F.
1808: Discrimination Factor: A Standard for evaluating the
1809: problem according to a Criterion<br>
1810:
1811: =item [Criterion to group students into %27 Upper Students -
1812: and %27 Lower Students]
1813: 1st Criterion for Sorting the Students:
1814: Sum of Partial Credit Awarded / Total Number of Tries
1815: 2nd Criterion for Sorting the Students:
1816: Total number of Correct Answers / Total Number of Tries
1817:
1818: =item Disc.
1819: Number of Students had at least one discussion.
1820:
1821: =back
1.47 matthew 1822:
1823: =cut
1.73 matthew 1824:
1825: ############################################################
1826: ############################################################
1.4 minaeibi 1827:
1.1 stredwic 1828: 1;
1829: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>