WeBWorK Main Forum

Displaying statistics for multiple choice problems

Displaying statistics for multiple choice problems

by Michael Shulman -
Number of replies: 11
For a multiple-choice question, is there a way to get webwork to display statistics on how many students chose each answer?
In reply to Michael Shulman

Re: Displaying statistics for multiple choice problems

by Danny Glin -
There is not a built-in feature to do this.  Whether it is possible somewhat depends on how the question was coded.

This will be nearly impossible for questions using the old style (pre-MathObjects) answer checkers.  The old code would scramble the order of the answers, and only record the letter corresponding to the answer the student chose.  So for example, looking at how many students chose "A" doesn't help, because "A" will be a different answer for each student.

For the MathObjects answer checker, you should be able to get this information from the Past Answer table.  Navigate to the question, then click "Show Past Answers".  From that screen you can select to show all old answers for all students for that question, and export to csv.  You can then use Excel to count how many of each answer was submitted.
In reply to Danny Glin

Re: Displaying statistics for multiple choice problems

by Michael Shulman -
Thanks! I discovered the Past Answer page after posting my question. (Aside: why is that so hard to find? I have to view a problem in student view and then click a button at the bottom of the page?) I wanted a quicker way to get an answer than having to download a CSV and use Libreoffice to slice and dice it by hand (I'm hoping to use webwork as a BYOD system for clicker questions), so I did some hacking in the source code for the Past Answer page and got it to display a nice table with counts.
In reply to Michael Shulman

Re: Displaying statistics for multiple choice problems

by Edward Sternin -

Michael,

Could you explain how you did this? I am unable to find any way to extract "Past Answer"s for the class, in one place.

I can go student-by-student, and press "Past Answers" for each, which is ridiculous for a class of 300, but how do I extract the distribution of answers for the class?

My problem involved a poll, with a fixed order of (all correct) answers, like this:

DOCUMENT(); 
loadMacros("PGstandard.pl","MathObjects.pl","parserPopUp.pl","parserOneOf.pl","PGML.pl","PGcourse.pl");
TEXT(beginproblem());
$showPartialCorrectAnswers = 0;
@choices = ("?","Windows laptop","MacOS laptop", "Chromebook","Linux laptop","Android tablet",
   "Windows desktop","MacOS desktop", "Linux desktop","Other");
$popup = PopUp([@choices], $choices[0]);  # It doesn't matter which is used as the "correct answer".
Context($popup->context);  # use the pop-up's context (already has the choices as strings);
BEGIN_PGML
We would like to know what kind of platforms are students using to participate in this online course, 
so that we can tailor our support requirements better.  Please help us by indicating below the kind 
of device that will be your primary platform this term. 
[@$popup->menu@]*
END_PGML
ANS(OneOf(@choices[1..9])->cmp());
ENDDOCUMENT(); 

In reply to Edward Sternin

Re: Displaying statistics for multiple choice problems

by Danny Glin -

Once you get to the past answers screen for any student, you can select any or all students (ctrl-click to select more than one, or shift-click to select a range) and any or all sets and problems.  There is a button underneath to "Create CSV" of your selection.

As an aside, I agree with Michael that the path to finding the Past Answers page is rather counterintuitive.  It would be nice if there was a direct link to it.

In reply to Danny Glin

Re: Displaying statistics for multiple choice problems

by Edward Sternin -

Danny, thanks for your suggestion, but:

I cannot see what you say should be there... This is a "Past Answers" page for one problem, for one student. There is no way to select anything or anybody else here.  I suppose I can type another id, and refresh, which would be faster than clicking my way back out and back into another user, but it's still a purely manual process.  I tried * as a widlcard, it did not produce a valid selection, it treated it as a literal *.

snapshot of Past Answers screen

Am I in a wrong place?

It seems the path is TRULY obscure.


In reply to Edward Sternin

Re: Displaying statistics for multiple choice problems

by Glenn Rice -

What are your permissions for the course?  Do you have professor permissions?

In reply to Edward Sternin

Re: Displaying statistics for multiple choice problems

by Alex Jordan -

Is this your WW server?

https://webwork2.brocku.ca/webwork2

It identifies as version 2.8. The feature you are looking for was introduced in version 2.12. The current version is 2.15.

In reply to Alex Jordan

Re: Displaying statistics for multiple choice problems

by Edward Sternin -

Yes!

Thanks, that explains it.

If I ask my admin to update the server, and migrate the course to it, I assume I will be able to extract this information even though the course was created under older version, right? I am assuming the database format dd not chage between versions.

In reply to Edward Sternin

Re: Displaying statistics for multiple choice problems

by Danny Glin -

Unfortunately there was a database change with respect to this.  Prior to 2.12 past answers were stored in a text file, and they were migrated to a database table (well, duplicated since the text file still exists).  Thus any answers submitted in a pre-2.12 version of WeBWorK won't show up in the database.

In your case the best you'll probably be able to do is to parse the answer_log file to try to get the data you need.  You can download it from the File Manager by going up a level (via the caret to the left of the directory dropdown), then going to the logs directory.  The format of the file is pretty self-explanatory.

In reply to Danny Glin

Re: Displaying statistics for multiple choice problems

by Edward Sternin -

I knew you could help me out here... THANKS, Danny, that's exactly what I was missing.  Somehow I thought this database was internal and not available to me.  If it's just a text file, I can parse anything!

And it removes the need for an emergency upgrade, they can take their time.  Awesome!

Again, thanks very much! 

P.S. And if anyone is interested, this is the way my online class accesses WeBWorK (I am now really curious about Other - Android?):

Windows desktop    37
Windows laptop    119
MacOS desktop    6
MacOS laptop    159
Chromebook    7
Linux    1
Other    6