// Numbas version: exam_results_page_options {"name": "Decide if a coin is biased", "extensions": ["stats"], "custom_part_types": [{"source": {"pk": 1, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/1/edit"}, "name": "Yes/no", "short_name": "yes-no", "description": "

The student is shown two radio choices: \"Yes\" and \"No\". One of them is correct.

", "help_url": "", "input_widget": "radios", "input_options": {"correctAnswer": "if(eval(settings[\"correct_answer_expr\"]), 0, 1)", "hint": {"static": true, "value": ""}, "choices": {"static": true, "value": ["Yes", "No"]}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nif(studentanswer=correct_answer,\n correct(),\n incorrect()\n)\n\ninterpreted_answer:\nstudentAnswer=0\n\ncorrect_answer:\nif(eval(settings[\"correct_answer_expr\"]),0,1)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=correct_answer,\n correct(),\n incorrect()\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer=0"}, {"name": "correct_answer", "description": "", "definition": "if(eval(settings[\"correct_answer_expr\"]),0,1)"}], "settings": [{"name": "correct_answer_expr", "label": "Is the answer \"Yes\"?", "help_url": "", "hint": "An expression which evaluates to true or false.", "input_type": "mathematical_expression", "default_value": "true", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Decide if a coin is biased", "tags": [], "metadata": {"description": "An interactive experiment about probability: the student must first 'design' the experiment by deciding how many times they're going to flip a coin, and define what number of heads would make them believe the coin is biased. They must then enter the results of their coin flips, calculate the percentage of heads, and finally decide if the coin is biased, using the condition they specified in the design stage. There are optional hints at each stage.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "extensions": ["stats"], "variables": {"flips": {"name": "flips", "group": "Ungrouped variables", "definition": "parse_flips(flips_string)", "description": "", "templateType": "anything"}, "flips_string": {"name": "flips_string", "group": "Ungrouped variables", "definition": "join(repeat(random(\"h\",\"t\"),num_flips),\" \")", "description": "", "templateType": "anything"}, "num_flips": {"name": "num_flips", "group": "Ungrouped variables", "definition": "100", "description": "", "templateType": "anything"}, "num_heads": {"name": "num_heads", "group": "Ungrouped variables", "definition": "len(filter(x,x,flips))", "description": "", "templateType": "anything"}, "num_tails": {"name": "num_tails", "group": "Ungrouped variables", "definition": "len(flips)-num_heads", "description": "", "templateType": "anything"}, "percent_heads": {"name": "percent_heads", "group": "Ungrouped variables", "definition": "100*num_heads/len(flips)", "description": "", "templateType": "anything"}, "cleaned_flips_string": {"name": "cleaned_flips_string", "group": "Ungrouped variables", "definition": "join(map(if(x,\"H\",\"T\"),x,flips),\" \")", "description": "", "templateType": "anything"}, "critical_number": {"name": "critical_number", "group": "Ungrouped variables", "definition": "max(raw_critical_number, num_flips-raw_critical_number)", "description": "", "templateType": "anything"}, "is_biased": {"name": "is_biased", "group": "Ungrouped variables", "definition": "num_heads>=critical_number or num_tails>=critical_number", "description": "", "templateType": "anything"}, "raw_critical_number": {"name": "raw_critical_number", "group": "Ungrouped variables", "definition": "60", "description": "", "templateType": "anything"}, "critical_likelihood": {"name": "critical_likelihood", "group": "Ungrouped variables", "definition": "critical_number/num_flips", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["num_flips", "raw_critical_number", "critical_number", "flips_string", "flips", "num_heads", "num_tails", "percent_heads", "cleaned_flips_string", "is_biased", "critical_likelihood"], "variable_groups": [], "functions": {"parse_flips": {"parameters": [["s", "string"]], "type": "list", "language": "javascript", "definition": "s = s.toLowerCase().replace(/[^ht]/g,'');\nreturn s.split('').map(function(c) { return new Numbas.jme.types.TBool(c=='h'); });"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "information", "useCustomName": true, "customName": "Introduction", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Decide number of flips", "rawLabel": "", "otherPart": 1, "variableReplacements": [], "availabilityCondition": "", "penalty": "", "penaltyAmount": 0, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

In this exercise you will decide if a coin is biased by flipping it repeatedly and deciding if it lands heads more often than you'd expect.

"}, {"type": "numberentry", "useCustomName": true, "customName": "Decide number of flips", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Define 'biased'", "rawLabel": "", "otherPart": 2, "variableReplacements": [{"variable": "num_flips", "definition": "interpreted_answer"}], "availabilityCondition": "answered", "penalty": "", "penaltyAmount": 0, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Design the experiment", "prompt": "

How many times will you flip your coin?

", "minValue": "1", "maxValue": "infinity", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Define 'biased'", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Enter data", "rawLabel": "", "otherPart": 4, "variableReplacements": [{"variable": "raw_critical_number", "definition": "interpreted_answer"}], "availabilityCondition": "answered and credit=1", "penalty": "", "penaltyAmount": 0, "lockAfterLeaving": false}, {"label": "What do you expect an unbiased coin do?", "rawLabel": "", "otherPart": 3, "variableReplacements": [], "availabilityCondition": "not (answered or credit=1)", "penalty": "", "penaltyAmount": 0, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Design the experiment", "prompt": "

How many heads would make you think the coin is biased?

", "minValue": "0", "maxValue": "100", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "What do you expect an unbiased coin do?", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": true, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

With an unbiased coin, how many flips would you expect to land heads up?

", "minValue": "num_flips/2-0.5", "maxValue": "num_flips/2+0.5", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "patternmatch", "useCustomName": true, "customName": "Enter data", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "right_length:\n if(len(parse_flips(studentAnswer))=num_flips,\n correct(\"You have entered your data correctly.\"),\n incorrect(\"You have not entered the right number of flips.\")\n )\n\nmark:\n apply(right_length)\n", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Calculate proportion of heads", "rawLabel": "", "otherPart": 5, "variableReplacements": [{"variable": "flips_string", "definition": "interpreted_answer"}], "availabilityCondition": "answered", "penalty": "", "penaltyAmount": 0, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Enter data", "prompt": "

Flip the coin {num_flips} times. Each time it lands heads, write an H in the box below. Each time it lands tails, write a T.

", "answer": "[, hHtT]*", "displayAnswer": "", "matchMode": "regex"}, {"type": "numberentry", "useCustomName": true, "customName": "Calculate proportion of heads", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Show frequencies of heads and tails", "rawLabel": "", "otherPart": 6, "variableReplacements": [], "availabilityCondition": "not (answered and credit=1)", "penalty": "Showed frequencies of heads and tails", "penaltyAmount": "1", "lockAfterLeaving": false}, {"label": "Is the coin biased?", "rawLabel": "", "otherPart": 7, "variableReplacements": [], "availabilityCondition": "answered", "penalty": "", "penaltyAmount": 0, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Calculate proportion of heads", "prompt": "

Your flips were:

\n

{cleaned_flips_string}

\n

What percentage of the flips landed heads?

", "minValue": "percent_heads", "maxValue": "percent_heads", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": 0, "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "information", "useCustomName": true, "customName": "Show frequencies of heads and tails", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": true, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "\n\n\n\n\n\n\n\n\n\n\n\n\n
ResultHeadsTails
Frequency{num_heads}{num_tails}
"}, {"type": "yes-no", "useCustomName": true, "customName": "Is the coin biased?", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Calculate the critical likelihood", "rawLabel": "", "otherPart": 8, "variableReplacements": [], "availabilityCondition": "not (answered and credit=1)", "penalty": "Hint about critical likelihood", "penaltyAmount": "1", "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Decide if the coin is biased", "prompt": "

Do you think your coin is biased?

", "settings": {"correct_answer_expr": "is_biased"}}, {"type": "numberentry", "useCustomName": true, "customName": "Calculate the critical likelihood", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": true, "adaptiveMarkingPenalty": 0, "exploreObjective": "Decide if the coin is biased", "prompt": "

You said that a coin is biased if it comes up heads at least {critical_number} times out of {num_flips}. What's that as a percentage?

", "minValue": "100*critical_likelihood", "maxValue": "100*critical_likelihood", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": 0, "precisionPartialCredit": "100", "precisionMessage": "", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "explore", "maxMarks": 0, "objectives": [{"name": "Calculate proportion of heads", "limit": "2", "mode": "sum"}, {"name": "Decide if the coin is biased", "limit": "5", "mode": "sum"}, {"name": "Design the experiment", "limit": "2", "mode": "sum"}, {"name": "Enter data", "limit": "1", "mode": "sum"}], "penalties": [{"name": "Showed frequencies of heads and tails", "limit": "1", "mode": "sum"}, {"name": "Hint about critical likelihood", "limit": "1", "mode": "sum"}], "objectiveVisibility": "always", "penaltyVisibility": "when-active", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "http://localhost:8000/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "http://localhost:8000/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}