// Numbas version: exam_results_page_options {"name": "Creating Frequency Tables", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {}, "variable_groups": [], "tags": ["Frequency", "Frequency Table", "frequency table", "Frequency table", "taxonomy"], "name": "Creating Frequency Tables", "functions": {"tally": {"parameters": [["n", "number"]], "language": "javascript", "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+'';", "type": "string"}}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Present some given data in a frequency table.

"}, "ungrouped_variables": ["data", "frequencies", "tallies"], "parts": [{"variableReplacementStrategy": "originalfirst", "gaps": [{"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "{frequencies[0]}", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[0]}"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "{frequencies[1]}", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[1]}"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "{frequencies[2]}", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[2]}"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "{frequencies[3]}", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[3]}"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "{frequencies[4]}", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[4]}"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "{frequencies[5]}", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[5]}"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "{frequencies[6]}", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[6]}"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "{frequencies[7]}", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[7]}"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "{frequencies[8]}", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[8]}"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "{frequencies[9]}", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[9]}"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "{frequencies[10]}", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[10]}"}], "showCorrectAnswer": true, "showFeedbackIcon": true, "type": "gapfill", "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
ScoreFrequency
$0$[[0]]
$1$[[1]]
$2$[[2]]
$3$[[3]]
$4$[[4]]
$5$[[5]]
$6$[[6]]
$7$[[7]]
$8$[[8]]
$9$[[9]]
$10$[[10]]
\n

", "variableReplacements": [], "scripts": {}, "marks": 0}], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"data": {"description": "", "templateType": "anything", "name": "data", "definition": "repeat(min(max(precround(normalsample(6,2.5),0),0),10),20)", "group": "Ungrouped variables"}, "frequencies": {"description": "", "templateType": "anything", "name": "frequencies", "definition": "map(\nlen(filter(x=j,x,data)),\nj,0..10)", "group": "Ungrouped variables"}, "tallies": {"description": "", "templateType": "anything", "name": "tallies", "definition": "map(tally(frequencies[x]),x,0..10)", "group": "Ungrouped variables"}}, "extensions": ["stats"], "type": "question", "preamble": {"js": "", "css": ""}, "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
ScoreTallyFrequency
$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]}$
", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}