// Numbas version: finer_feedback_settings {"name": "Find the confidence interval and mean of a normal distribution", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"tags": ["MAS2302", "MLE", "Normal distribution", "checked2015", "confidence interval", "expected information", "maximum likelihood estimator", "mean ", "mle", "normal distribution", "random sample", "sample mean"], "statement": "
$X_1,\\;X_2,\\;\\dots, X_n$ is a random sample from $\\operatorname{N}(\\mu,\\var{sd}^2)$.
\nLet $\\bar{x}$ denote the mean of this sample and for this exercise we have $n=\\var{n},\\; \\bar{x}=\\var{r11}$
", "showQuestionGroupNames": false, "variable_groups": [], "ungrouped_variables": ["r11", "tulim", "per", "n", "mu", "tol", "sd", "ulim", "inf", "z", "llim", "tllim"], "parts": [{"prompt": "Enter the m.l.e. $\\hat{\\mu}$ for $\\mu$ here:
\n$\\hat{\\mu}=\\;$?[[0]]
", "marks": 0, "type": "gapfill", "gaps": [{"allowFractions": false, "marks": 1, "type": "numberentry", "maxValue": "r11", "showPrecisionHint": false, "minValue": "r11", "showCorrectAnswer": true, "correctAnswerFraction": false, "scripts": {}}], "showCorrectAnswer": true, "scripts": {}}, {"prompt": "Calculate the expected information $I(\\mu)$:
\n$I(\\mu)=\\;$[[0]] (to 2 decimal places).
", "marks": 0, "type": "gapfill", "gaps": [{"allowFractions": false, "marks": 1, "type": "numberentry", "maxValue": "inf+tol", "showPrecisionHint": false, "minValue": "inf-tol", "showCorrectAnswer": true, "correctAnswerFraction": false, "scripts": {}}], "showCorrectAnswer": true, "scripts": {}}, {"prompt": "Calculate a $\\var{per}$% confidence $(a,b)$ interval for $\\mu$:
\n$a=\\;$[[0]]
\n$b=\\;$[[1]]
", "marks": 0, "type": "gapfill", "gaps": [{"allowFractions": false, "marks": 1, "type": "numberentry", "maxValue": "llim+tol", "showPrecisionHint": false, "minValue": "llim-tol", "showCorrectAnswer": true, "correctAnswerFraction": false, "scripts": {}}, {"allowFractions": false, "marks": 1, "type": "numberentry", "maxValue": "ulim+tol", "showPrecisionHint": false, "minValue": "ulim-tol", "showCorrectAnswer": true, "correctAnswerFraction": false, "scripts": {}}], "showCorrectAnswer": true, "scripts": {}}], "functions": {}, "preamble": {"css": "", "js": ""}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "For a sample of size n from a normal distribution and given the mean of the sample and the standard deviation of the distribution, find the MLE for the mean. Also the expected information and a confidence interval for the mean.
", "notes": "27/01/2013:
\nFirst draft completed.
"}, "question_groups": [{"pickingStrategy": "all-ordered", "pickQuestions": 0, "name": "", "questions": []}], "type": "question", "rulesets": {}, "variables": {"tllim": {"group": "Ungrouped variables", "description": "", "definition": "r11-z*sqrt(sd^2/n)", "name": "tllim", "templateType": "anything"}, "ulim": {"group": "Ungrouped variables", "description": "", "definition": "precround(tulim,2)", "name": "ulim", "templateType": "anything"}, "tulim": {"group": "Ungrouped variables", "description": "", "definition": "r11+z*sqrt(sd^2/n)", "name": "tulim", "templateType": "anything"}, "z": {"group": "Ungrouped variables", "description": "", "definition": "switch(per=95,1.96,per=99,2.58,3.29)", "name": "z", "templateType": "anything"}, "per": {"group": "Ungrouped variables", "description": "", "definition": "random(95,99,99.9)", "name": "per", "templateType": "anything"}, "mu": {"group": "Ungrouped variables", "description": "", "definition": "random(150..250)", "name": "mu", "templateType": "anything"}, "inf": {"group": "Ungrouped variables", "description": "", "definition": "precround(n/sd^2,2)", "name": "inf", "templateType": "anything"}, "tol": {"group": "Ungrouped variables", "description": "", "definition": "0.01", "name": "tol", "templateType": "anything"}, "r11": {"group": "Ungrouped variables", "description": "", "definition": "precround(mean(repeat(normalsample(mu,sd),n)),1)", "name": "r11", "templateType": "anything"}, "llim": {"group": "Ungrouped variables", "description": "", "definition": "precround(tllim,2)", "name": "llim", "templateType": "anything"}, "sd": {"group": "Ungrouped variables", "description": "", "definition": "random(5..12)", "name": "sd", "templateType": "anything"}, "n": {"group": "Ungrouped variables", "description": "", "definition": "random(25..100#5)", "name": "n", "templateType": "anything"}}, "advice": "a)
\nThe maximum likelihood estimator (m.l.e) is, in this case, the sample mean i.e. $\\hat{\\mu}=\\var{r11}$.
\nb)
\nThe expected information in this case is $\\displaystyle \\frac{n}{\\sigma^2}$ where $\\sigma=\\var{sd}$ is the standard deviation of the sampled normal distribution.
\nHence $\\displaystyle I(\\mu)=\\frac{\\var{n}}{\\var{sd^2}}=\\var{inf}$ to 2 decimal places.
\nc)
\nThe $\\var{per}$% confidence interval in this case is given by $(a,b)$ where:
\n\\[a=\\bar{x}-z\\sqrt{\\frac{\\sigma^2}{n}},\\;\\;b=\\bar{x}+z\\sqrt{\\frac{\\sigma^2}{n}},\\;\\;\\;z=\\var{z}\\]
\nCalculating to 2 decimal places gives:
\n$a=\\var{llim},\\;\\;\\;b=\\var{ulim}$.
\nHence a $\\var{per}$% confidence interval for the mean is given by $(\\var{llim},\\var{ulim})$.
", "name": "Find the confidence interval and mean of a normal distribution", "variablesTest": {"condition": "", "maxRuns": 100}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}