// Numbas version: exam_results_page_options {"name": "Creating Frequency Tables", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"extensions": ["stats"], "rulesets": {}, "name": "Creating Frequency Tables", "functions": {"tally": {"parameters": [["n", "number"]], "language": "javascript", "type": "string", "definition": "var s = ''\n// Add strikethrough if n>=5\n// For simplicity, I have not handled the case where n reaches 10, which is unlikely.\nif(n>=5){\n s = '|||| ';\n n = n-5;\n}\n// Tally for each n\nfor (i=1; i <= n; i++) { \n s+= '|';\n}\nreturn ''+s+'';"}}, "ungrouped_variables": ["data", "frequencies", "tallies"], "metadata": {"description": "

Present some given data in a frequency table.

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "variable_groups": [], "advice": "

\n

Frequency is the number of times that an event occurs (in this case, obtaining a certain score) within a particular experiment (in this case, the exam).

\n

We are given enough data that keeping a mental count of the frequencies is difficult:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 \$\\var{data[0]}\$ \$\\var{data[1]}\$ \$\\var{data[2]}\$ \$\\var{data[3]}\$ \$\\var{data[4]}\$ \$\\var{data[5]}\$ \$\\var{data[6]}\$ \$\\var{data[7]}\$ \$\\var{data[8]}\$ \$\\var{data[9]}\$ \$\\var{data[10]}\$ \$\\var{data[11]}\$ \$\\var{data[12]}\$ \$\\var{data[13]}\$ \$\\var{data[14]}\$ \$\\var{data[15]}\$ \$\\var{data[16]}\$ \$\\var{data[17]}\$ \$\\var{data[18]}\$ \$\\var{data[19]}\$
\n

Therefore, a better way to approach this problem would be to add an extra column to the frequency table, as illustrated below, to tally the number of students with each score. The number of tally marks for each score can then be read off and insterted into the frequency column.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 Score Tally Frequency \$0\$ {tallies[0]} \$\\var{frequencies[0]}\$ \$1\$ {tallies[1]} \$\\var{frequencies[1]}\$ \$2\$ {tallies[2]} \$\\var{frequencies[2]}\$ \$3\$ {tallies[3]} \$\\var{frequencies[3]}\$ \$4\$ {tallies[4]} \$\\var{frequencies[4]}\$ \$5\$ {tallies[5]} \$\\var{frequencies[5]}\$ \$6\$ {tallies[6]} \$\\var{frequencies[6]}\$ \$7\$ {tallies[7]} \$\\var{frequencies[7]}\$ \$8\$ {tallies[8]} \$\\var{frequencies[8]}\$ \$9\$ {tallies[9]} \$\\var{frequencies[9]}\$ \$10\$ {tallies[10]} \$\\var{frequencies[10]}\$
\n

", "statement": "

A maths test in a Year 7 class of \$20\$ students was scored out of \$10\$. The marks awarded to the students were as follows:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 \$\\var{data[0]}\$ \$\\var{data[1]}\$ \$\\var{data[2]}\$ \$\\var{data[3]}\$ \$\\var{data[4]}\$ \$\\var{data[5]}\$ \$\\var{data[6]}\$ \$\\var{data[7]}\$ \$\\var{data[8]}\$ \$\\var{data[9]}\$ \$\\var{data[10]}\$ \$\\var{data[11]}\$ \$\\var{data[12]}\$ \$\\var{data[13]}\$ \$\\var{data[14]}\$ \$\\var{data[15]}\$ \$\\var{data[16]}\$ \$\\var{data[17]}\$ \$\\var{data[18]}\$ \$\\var{data[19]}\$
", "preamble": {"css": "", "js": ""}, "tags": ["Frequency", "Frequency Table", "frequency table", "Frequency table", "taxonomy"], "parts": [{"variableReplacementStrategy": "originalfirst", "prompt": "

\n

Complete the frequency table for this data.

\n

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 Score Frequency \$0\$ [[0]] \$1\$ [[1]] \$2\$ [[2]] \$3\$ [[3]] \$4\$ [[4]] \$5\$ [[5]] \$6\$ [[6]] \$7\$ [[7]] \$8\$ [[8]] \$9\$ [[9]] \$10\$ [[10]]
\n