// Numbas version: exam_results_page_options {"name": "Probability: From a two-way table 1", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Probability: From a two-way table 1", "tags": [], "metadata": {"description": "

Calculate an intersection probability given a two way table.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "

a) Each row and column must sum to the 'total'.

\n

b) Look for the column containing '$\\var{q1a}$' and the row containing '$\\var{q1b}$'.  The entry where they intersect, $\\var{q1*total}$, is the value we are interested in.  

Since we require a probability, this is $\\var{q1*total}$ out of $\\var{total}$, i.e.

\n

\\[ \\frac{\\var{q1*total}}{\\var{total}} \\]

", "rulesets": {}, "extensions": ["stats"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"nA": {"name": "nA", "group": "Final data", "definition": "pairs[0]", "description": "", "templateType": "anything", "can_override": false}, "pairs": {"name": "pairs", "group": "Final data", "definition": "random(['red','shiny'],['Phenotype A','Phenotype B'],['dairy', 'wheat'],['F','G'],['child','dog owner'],['X','Y'],['hat', 'glasses'])", "description": "", "templateType": "anything", "can_override": false}, "nB": {"name": "nB", "group": "Final data", "definition": "pairs[1]", "description": "", "templateType": "anything", "can_override": false}, "AnB": {"name": "AnB", "group": "Final data", "definition": "random(10..20)", "description": "", "templateType": "anything", "can_override": false}, "AnB'": {"name": "AnB'", "group": "Final data", "definition": "random(1..20)", "description": "", "templateType": "anything", "can_override": false}, "notAnB'": {"name": "notAnB'", "group": "Final data", "definition": "random(1..20)", "description": "", "templateType": "anything", "can_override": false}, "notAnB": {"name": "notAnB", "group": "Final data", "definition": "random(1..20)", "description": "", "templateType": "anything", "can_override": false}, "total": {"name": "total", "group": "Final data", "definition": "AnB+AnB' + notAnB' + notAnB\n", "description": "", "templateType": "anything", "can_override": false}, "A": {"name": "A", "group": "Final data", "definition": "AnB+AnB'", "description": "", "templateType": "anything", "can_override": false}, "B": {"name": "B", "group": "Final data", "definition": "notAnB + AnB", "description": "", "templateType": "anything", "can_override": false}, "q1a": {"name": "q1a", "group": "Final data", "definition": "if(isornot1=0,\"not {pairs[0]}\",pairs[0])", "description": "", "templateType": "anything", "can_override": false}, "q2a": {"name": "q2a", "group": "Final data", "definition": "if(isornot3=0,\"not {pairs[0]}\",pairs[0])", "description": "", "templateType": "anything", "can_override": false}, "q1b": {"name": "q1b", "group": "Final data", "definition": "if(isornot2=0,\"not {pairs[1]}\",pairs[1])", "description": "", "templateType": "anything", "can_override": false}, "q2b": {"name": "q2b", "group": "Final data", "definition": "if(isornot4=0,\"not {pairs[1]}\",pairs[1])", "description": "", "templateType": "anything", "can_override": false}, "q1": {"name": "q1", "group": "Final data", "definition": "if(isornot1=0,if(isornot2=0,notAnB',notAnB),if(isornot2=0,AnB',AnB))/total", "description": "", "templateType": "anything", "can_override": false}, "q2": {"name": "q2", "group": "Final data", "definition": "if(isornot3=0,if(isornot4=0,notAnB'/(total-A),notAnB/(total-A)),if(isornot4=0,AnB'/A,AnB/A))", "description": "", "templateType": "anything", "can_override": false}, "isornot1": {"name": "isornot1", "group": "Final data", "definition": "random(0,1)", "description": "", "templateType": "anything", "can_override": false}, "isornot2": {"name": "isornot2", "group": "Final data", "definition": "random(1,0)", "description": "", "templateType": "anything", "can_override": false}, "isornot3": {"name": "isornot3", "group": "Ungrouped variables", "definition": "random(0,1)", "description": "", "templateType": "anything", "can_override": false}, "isornot4": {"name": "isornot4", "group": "Ungrouped variables", "definition": "random(0,1)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": "1000"}, "ungrouped_variables": ["isornot3", "isornot4"], "variable_groups": [{"name": "Final data", "variables": ["nA", "pairs", "nB", "AnB", "AnB'", "notAnB'", "notAnB", "total", "A", "B", "q1a", "q2a", "q1b", "q2b", "q1", "q2", "isornot1", "isornot2"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

$\\var{total}$ items are sampled.  Complete the table.

\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{nB}$    not $\\var{nB}$   TOTAL  
   $\\var{nA}$    [[0]] $\\var{AnB'}$  $\\var{A}$ 
 not $\\var{nA}$  $\\var{notAnB}$ [[1]] [[2]]
 TOTAL [[3]]  [[4]]$\\var{total}$
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "AnB", "maxValue": "AnB", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{notAnB'}", "maxValue": "{notAnB'}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{total-A}", "maxValue": "{total-A}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{B}", "maxValue": "{B}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{total-B}", "maxValue": "{total-B}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

If one item is picked at random, use the table to calculate the probability that the item is '{q1a}' and '{q1b}'.

Give your answer as a fraction, or a decimal correct to 2dp.

", "alternatives": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "", "useAlternativeFeedback": false, "minValue": "precround(q1,2)", "maxValue": "precround(q1,2)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "2", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "minValue": "{q1}", "maxValue": "{q1}", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}, {"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}, {"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}]}