// Numbas version: exam_results_page_options {"name": "Confidence Interval", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "ungrouped_variables": ["num_monday", "monday_pop_mean", "monday_pop_range", "mon", "num_friday", "friday_pop_mean", "friday_pop_range", "fri", "monday_mean", "monday_sd", "monday_se", "monday_t", "monday_low", "monday_high", "t", "friday_mean", "friday_se", "friday_t", "friday_low", "friday_high", "no_overlap"], "name": "Confidence Interval", "tags": [], "advice": "
The mean of the sample of patients visiting on Mondays is
\n\\[ \\bar{x} = \\frac{1}{n}(\\sum x_i) = \\var{precround(monday_mean,2)} \\text{ (to 2 d.p.)} \\]
\nThe standard deviation is
\n\\[ s = \\sqrt{\\frac{1}{n}\\sum \\left(x_i-\\bar{x}\\right)^2} = \\var{precround(monday_sd,2)} \\text{ (to 2 d.p.)} \\]
\nThe sample mean $\\mu_m$ follows a $t$-distribution with $n-1 = \\var{num_monday-1}$ degrees of freedom centred on the population mean, with a standard error of $\\frac{s}{\\sqrt{n}} = \\simplify{{precround(monday_sd,2)}/sqrt({num_monday})} = \\var{precround(monday_se,2)}$.
\nThat means that the 95% confidence interval for the population mean is as follows:
\n\\begin{array}{lrcl}
&\\left[ \\bar{x} - s \\times t_{\\var{num_monday-1},0.975} \\right. \\kern{-0.5em}&,&\\kern{-0.5em} \\left. \\bar{x} + s \\times t_{\\var{num_monday-1},0.975} \\right] \\\\
= & \\left[ \\simplify[]{{precround(monday_mean,2)} - {precround(monday_se,2)}*{precround(monday_t,2)}} \\right. \\kern{-0.5em}&,&\\kern{-0.5em} \\left. \\simplify[]{{precround(monday_mean,2)} + {precround(monday_se,2)}*{precround(monday_t,2)}} \\right] \\\\
= & \\left[ \\var{precround(monday_low,2)} \\right. \\kern{-0.5em}&,&\\kern{-0.5em} \\left. \\var{precround(monday_high,2)} \\right]
\\end{array}
The 95% confidence intervals for the two population means do not overlap, so they must be significantly different.The 95% confidence intervals for the two populations overlap, so we do not have enough evidence to say whether they are significantly different.
", "rulesets": {}, "parts": [{"prompt": "Calculate the mean and standard deviation of the sample of patients visiting on Mondays.
\nEnter your answers to 2 decimal places.
\nMean: [[0]]
\nStandard Deviation: [[1]]
", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "precision": "2", "maxValue": "monday_mean", "variableReplacementStrategy": "originalfirst", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": 0, "scripts": {}, "marks": 1, "minValue": "monday_mean", "type": "numberentry", "showPrecisionHint": false}, {"precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "precision": "2", "maxValue": "monday_sd", "variableReplacementStrategy": "originalfirst", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": 0, "scripts": {}, "marks": 1, "minValue": "monday_sd", "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "Find the 95% confidence interval for the population mean $\\mu_m$ of the age of patients visiting on Monday, using the $t$-distribution with $\\var{num_monday-1}$ degrees of freedom.
\nEnter your answers to 2 decimal places.
\nLower limit: [[0]]
\nUpper limit: [[1]]
", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "precision": "2", "maxValue": "monday_low", "variableReplacementStrategy": "originalfirst", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": 0, "scripts": {}, "marks": 1, "minValue": "monday_low", "type": "numberentry", "showPrecisionHint": false}, {"precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "precision": "2", "maxValue": "monday_high", "variableReplacementStrategy": "originalfirst", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": 0, "scripts": {}, "marks": 1, "minValue": "monday_high", "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"displayColumns": 0, "prompt": "The 95% confidence interval for the population mean of the age of the patients visiting on a Friday is $\\left[\\var{precround(friday_low,2)}, \\var{precround(friday_high,2)} \\right]$.
\nIs there sufficent evidence to say that the population means for Monday and Friday are significantly different?
", "matrix": "if(no_overlap,[1,0],[0,1])", "shuffleChoices": false, "variableReplacements": [], "choices": ["Yes
", "No
"], "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "maxMarks": 0, "scripts": {}, "distractors": ["", ""], "marks": 0, "showCorrectAnswer": true, "type": "1_n_2", "minMarks": 0}], "statement": "The ages of patients coming into a small rural doctor's surgery during the school holidays are noted down on each Monday and Friday thoughout August.
\n{table([['Monday']+mon,['Friday']+fri],[])}
", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variables": {"monday_t": {"definition": "studenttinv(0.975,num_monday-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "monday_t", "description": ""}, "monday_pop_mean": {"definition": "random(20..70)", "templateType": "anything", "group": "Ungrouped variables", "name": "monday_pop_mean", "description": ""}, "num_friday": {"definition": "random(12..16)", "templateType": "anything", "group": "Ungrouped variables", "name": "num_friday", "description": ""}, "monday_pop_range": {"definition": "20", "templateType": "anything", "group": "Ungrouped variables", "name": "monday_pop_range", "description": ""}, "monday_se": {"definition": "monday_sd/sqrt(num_monday)", "templateType": "anything", "group": "Ungrouped variables", "name": "monday_se", "description": ""}, "num_monday": {"definition": "12", "templateType": "anything", "group": "Ungrouped variables", "name": "num_monday", "description": ""}, "monday_low": {"definition": "monday_mean-monday_t*monday_se", "templateType": "anything", "group": "Ungrouped variables", "name": "monday_low", "description": "Lower end of the confidence interval for Monday's mean
"}, "fri": {"definition": "repeat(friday_pop_mean+random(-friday_pop_range..friday_pop_range),num_monday)", "templateType": "anything", "group": "Ungrouped variables", "name": "fri", "description": "Data for Friday
"}, "monday_sd": {"definition": "stdev(mon)", "templateType": "anything", "group": "Ungrouped variables", "name": "monday_sd", "description": ""}, "monday_high": {"definition": "monday_mean+monday_t*monday_se", "templateType": "anything", "group": "Ungrouped variables", "name": "monday_high", "description": ""}, "no_overlap": {"definition": "friday_low > monday_high or friday_high < monday_low", "templateType": "anything", "group": "Ungrouped variables", "name": "no_overlap", "description": ""}, "friday_low": {"definition": "friday_mean-friday_t*friday_se", "templateType": "anything", "group": "Ungrouped variables", "name": "friday_low", "description": ""}, "t": {"definition": "studenttinv(0.975,11)", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "friday_high": {"definition": "friday_mean+friday_t*friday_se", "templateType": "anything", "group": "Ungrouped variables", "name": "friday_high", "description": ""}, "friday_mean": {"definition": "mean(fri)", "templateType": "anything", "group": "Ungrouped variables", "name": "friday_mean", "description": ""}, "friday_pop_range": {"definition": "20", "templateType": "anything", "group": "Ungrouped variables", "name": "friday_pop_range", "description": ""}, "friday_t": {"definition": "studenttinv(0.975,num_friday-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "friday_t", "description": ""}, "monday_mean": {"definition": "mean(mon)", "templateType": "anything", "group": "Ungrouped variables", "name": "monday_mean", "description": ""}, "friday_se": {"definition": "stdev(fri)/sqrt(num_friday)", "templateType": "anything", "group": "Ungrouped variables", "name": "friday_se", "description": ""}, "friday_pop_mean": {"definition": "random(20..70)", "templateType": "anything", "group": "Ungrouped variables", "name": "friday_pop_mean", "description": ""}, "mon": {"definition": "repeat(monday_pop_mean+random(-monday_pop_range..monday_pop_range),num_monday)", "templateType": "anything", "group": "Ungrouped variables", "name": "mon", "description": "Data for Monday
"}}, "metadata": {"notes": "", "description": "Compute a 95% confidence interval for the population mean given a small sample, and compare it with a confidence interval for a different population.
", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Hayley Moore", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/495/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Hayley Moore", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/495/"}]}