// 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": [{"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
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]}$
", "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
ScoreFrequency
$0$[[0]]
$1$[[1]]
$2$[[2]]
$3$[[3]]
$4$[[4]]
$5$[[5]]
$6$[[6]]
$7$[[7]]
$8$[[8]]
$9$[[9]]
$10$[[10]]
\n

", "gaps": [{"mustBeReducedPC": 0, "marks": 1, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[0]}", "allowFractions": false, "minValue": "{frequencies[0]}", "mustBeReduced": false, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "scripts": {}}, {"mustBeReducedPC": 0, "marks": 1, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[1]}", "allowFractions": false, "minValue": "{frequencies[1]}", "mustBeReduced": false, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "scripts": {}}, {"mustBeReducedPC": 0, "marks": 1, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[2]}", "allowFractions": false, "minValue": "{frequencies[2]}", "mustBeReduced": false, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "scripts": {}}, {"mustBeReducedPC": 0, "marks": 1, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[3]}", "allowFractions": false, "minValue": "{frequencies[3]}", "mustBeReduced": false, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "scripts": {}}, {"mustBeReducedPC": 0, "marks": 1, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[4]}", "allowFractions": false, "minValue": "{frequencies[4]}", "mustBeReduced": false, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "scripts": {}}, {"mustBeReducedPC": 0, "marks": 1, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[5]}", "allowFractions": false, "minValue": "{frequencies[5]}", "mustBeReduced": false, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "scripts": {}}, {"mustBeReducedPC": 0, "marks": 1, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[6]}", "allowFractions": false, "minValue": "{frequencies[6]}", "mustBeReduced": false, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "scripts": {}}, {"mustBeReducedPC": 0, "marks": 1, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[7]}", "allowFractions": false, "minValue": "{frequencies[7]}", "mustBeReduced": false, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "scripts": {}}, {"mustBeReducedPC": 0, "marks": 1, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[8]}", "allowFractions": false, "minValue": "{frequencies[8]}", "mustBeReduced": false, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "scripts": {}}, {"mustBeReducedPC": 0, "marks": 1, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[9]}", "allowFractions": false, "minValue": "{frequencies[9]}", "mustBeReduced": false, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "scripts": {}}, {"mustBeReducedPC": 0, "marks": 1, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "type": "numberentry", "correctAnswerFraction": false, "maxValue": "{frequencies[10]}", "allowFractions": false, "minValue": "{frequencies[10]}", "mustBeReduced": false, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "scripts": {}}], "variableReplacements": [], "showFeedbackIcon": true, "scripts": {}, "type": "gapfill", "marks": 0, "showCorrectAnswer": true}], "variables": {"data": {"name": "data", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(min(max(precround(normalsample(6,2.5),0),0),10),20)"}, "tallies": {"name": "tallies", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "map(tally(frequencies[x]),x,0..10)"}, "frequencies": {"name": "frequencies", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "map(\nlen(filter(x=j,x,data)),\nj,0..10)"}}, "variablesTest": {"maxRuns": 100, "condition": ""}, "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/"}]}]}], "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/"}]}