// Numbas version: finer_feedback_settings {"name": "Find expectation, variance and probability sample mean in range for normal distribution", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"description": "
Normal distribution $X \\sim N(\\mu,\\sigma^2)$ given. Find $P(a \\lt X \\lt b)$. Find expectation, variance, $P(c \\lt \\overline{X} \\lt d)$ for sample mean $\\overline{X}$.
", "notes": "13/07/2012:
\nAdded tags.
\nCannot check calculations as yet as cannot access stats extension.
\nSet new tolerance variable tol=0.0001 for numeric entries to 4 dps.
\nSet new tolerance variable tol=0 for numeric entries to 2 dps.
\n21/12/2012:
\nChecked calculations against standard tables, OK. Added tested1 tag.
\nCorrected a typos and improved display in Advice.
\nChecked rounding, OK. Added tag cr1.
\nThis has scenarios - could be extended. Added sc tag.
\n", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "variables": {"nationality": {"definition": "random('English','Australian','African','American','Chinese','Mediterranean')", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "nationality"}, "probsam": {"definition": "precround(pupsam+plowsam-1,4)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "probsam"}, "pup": {"definition": "precround(normalcdf(zup,0,1),6)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "pup"}, "animals": {"definition": "random('rabbits','goats','mice','cows','rats')", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "animals"}, "lower": {"definition": "m-slow*s", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "lower"}, "tol1": {"definition": "0", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "tol1"}, "sup": {"definition": "random(0.1..0.75#0.005)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "sup"}, "plow": {"definition": "precround(normalcdf(abs(zlow),0,1),6)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "plow"}, "sb": {"definition": "if(sa=9,random(16,25,36),if(sa=16,random(25,36),36))", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "sb"}, "zlowsam": {"definition": "sqrt(sa)*zlow", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "zlowsam"}, "tol": {"definition": "0.0001", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "tol"}, "zlow": {"definition": "(lower-m)/s", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "zlow"}, "slow": {"definition": "random(0.1..0.75#0.005)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "slow"}, "prob": {"definition": "precround(pup+plow-1,4)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "prob"}, "sva": {"definition": "precround(s^2/sa,2)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "sva"}, "s": {"definition": "random(15..30#5)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "s"}, "upper": {"definition": "m+sup*s", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "upper"}, "zup": {"definition": "(upper-m)/s", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "zup"}, "pupsam": {"definition": "precround(normalCDF(zupsam,0,1),6)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "pupsam"}, "plowsam": {"definition": "precround(normalCDF(abs(zlowsam),0,1),6)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "plowsam"}, "stuff": {"definition": "random('sodium choride','fatty acid','potassium','protein','carbonic anhydrase','fibrinogen')", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "stuff"}, "zupsam": {"definition": "sqrt(sa)*zup", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "zupsam"}, "sa": {"definition": "if(s=25,random(9,16),random(9,16,25))", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "sa"}, "m": {"definition": "random(100..300#10)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "m"}, "svb": {"definition": "precround(s^2/sb,2)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "svb"}}, "advice": "
a) Converting to $Z$ scores in $N(0,1)$ we have for $X \\sim N(\\var{m},\\var{s^2})$
\n\\[\\begin{eqnarray*} P(\\var{lower} \\lt X \\lt \\var{upper})&=&P(X \\lt \\var{upper})-P(X \\lt \\var{lower})\\\\ &=&P\\left(Z \\lt \\frac{\\var{upper}-\\var{m}}{\\var{s}}\\right)-P\\left(Z \\lt \\frac{\\var{lower}-\\var{m}}{\\var{s}}\\right)\\\\ &=&P(Z \\lt \\var{zup})-P( Z \\lt \\var{zlow})\\\\ &=&\\var{pup}-\\var{1-plow}\\\\ &=&\\var{prob} \\end{eqnarray*} \\] to 4 decimal places.
\nHere the probabilities could have been looked up from normal CDF tables. Alternatively we can simply do the whole calculation in
\nR by typing $\\operatorname{pnorm}(\\var{upper},\\var{m},\\var{s})-\\operatorname{pnorm}(\\var{lower},\\var{m},\\var{s})$.
\nb)
This part reminds you that for the sample mean for samples of size $n$ from a normal distribution $N(\\mu,\\sigma^2)$ has a normal distribution $\\displaystyle N\\left(\\mu,\\frac{\\sigma^2}{n}\\right)$.
Hence for a sample size $\\var{sa}$:
\n$\\displaystyle \\operatorname{E}[\\overline{X}] = \\mu=\\var{m}$ and $\\displaystyle \\operatorname{Var}(\\overline{X}) = \\frac{\\sigma^2}{n}=\\frac{\\var{s^2}}{\\var{sa}}=\\var{sva}$
\nHence for a sample size $\\var{sb}$:
\n$\\operatorname{E}[\\overline{X}] = \\mu=\\var{m}$ and $\\displaystyle \\operatorname{Var}(\\overline{X}) = \\frac{\\sigma^2}{n}=\\frac{\\var{s^2}}{\\var{sb}}=\\var{svb}$
\nc)
Since the sample size is $\\var{sa}$ we are dealing with the normal distribution $N(\\var{m},\\simplify[std]{{s^2}/{sa}})$.
Converting to $Z$ scores in $N(0,1)$ we have for $\\overline{X} \\sim N(\\var{m},\\simplify[std]{{s^2}/{sa}})$
\n\\[\\begin{eqnarray*} P(\\var{lower} \\lt \\overline{X} \\lt \\var{upper})&=&P(\\overline{X} \\lt \\var{upper})-P(\\overline{X}\\lt \\var{lower})\\\\ &=&P\\left(Z \\lt \\frac{\\sqrt{\\var{sa}}(\\var{upper}-\\var{m})}{\\var{s}}\\right)-P\\left(Z \\lt \\frac{\\sqrt{\\var{sa}}(\\var{lower}-\\var{m})}{\\var{s}}\\right)\\\\ &=&P(Z \\lt \\var{zupsam})-P( Z \\lt \\var{zlowsam})\\\\ &=&\\var{pupsam}-\\var{1-plowsam}\\\\ &=&\\var{probsam} \\end{eqnarray*} \\] to 4 decimal places.
\nHere the probabilities could have been looked up from normal CDF tables. Alternatively we can simply do the whole calculation in
\nR by typing $\\operatorname{pnorm}(\\var{upper},\\var{m},\\frac{\\var{s}}{\\sqrt{\\var{sa}}})-\\operatorname{pnorm}(\\var{lower},\\var{m},\\frac{\\var{s}}{\\sqrt{\\var{sa}}})$ i.e. $\\operatorname{pnorm}(\\var{upper},\\var{m},\\var{s/sqrt(sa)})-\\operatorname{pnorm}(\\var{lower},\\var{m},\\var{s/sqrt(sa)})$
", "question_groups": [{"pickingStrategy": "all-ordered", "pickQuestions": 0, "name": "", "questions": []}], "ungrouped_variables": ["upper", "zlowsam", "zlow", "m", "plowsam", "plow", "slow", "tol", "sup", "prob", "zup", "probsam", "zupsam", "nationality", "pup", "lower", "animals", "pupsam", "svb", "sva", "s", "stuff", "sb", "sa", "tol1"], "name": "Find expectation, variance and probability sample mean in range for normal distribution", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "tags": ["checked2015", "cr1", "distribution of sample mean", "distributions", "MAS1604", "MAS8380", "MAS8401", "normal distribution", "Normal distribution", "Probability", "probability", "random variables", "sample", "sample distribution", "sample mean", "sc", "statistics", "tested1", "z scores"], "variable_groups": [], "statement": "The total {stuff} content of the blood plasma of {nationality} {animals} ($X$, in mg/100ml) is known to follow a $N(\\var{m},\\var{s^2})$ distribution.
", "showQuestionGroupNames": false, "variablesTest": {"condition": "", "maxRuns": 100}, "parts": [{"type": "gapfill", "marks": 0, "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "showCorrectAnswer": true, "type": "numberentry", "maxValue": "{prob+tol}", "marks": 1, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "minValue": "{prob-tol}"}], "prompt": "\nFind:
\n$P(\\var{lower} \\lt X \\lt \\var{upper})=\\;\\;$[[0]]
\nCorrect to 4 decimal places.
\n ", "scripts": {}}, {"type": "gapfill", "marks": 0, "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "showCorrectAnswer": true, "type": "numberentry", "maxValue": "{m}", "marks": 0.5, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "minValue": "{m}"}, {"correctAnswerFraction": false, "showCorrectAnswer": true, "type": "numberentry", "maxValue": "{sva+tol1}", "marks": 1, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "minValue": "{sva-tol1}"}, {"correctAnswerFraction": false, "showCorrectAnswer": true, "type": "numberentry", "maxValue": "{m}", "marks": 0.5, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "minValue": "{m}"}, {"correctAnswerFraction": false, "showCorrectAnswer": true, "type": "numberentry", "maxValue": "{svb+tol1}", "marks": 1, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "minValue": "{svb-tol1}"}], "prompt": "Let $\\overline{X}$ be the random variable given by the sample mean.
\nFind $\\operatorname{E}[ \\overline{X}]$ and $\\operatorname{Var}(\\overline{X})$ in the following cases:
\n1) A sample of size $\\var{sa}$
\n$\\operatorname{E}[ \\overline{X}]=\\;\\;$[[0]]$\\;\\;\\;\\operatorname{Var}(\\overline{X})=\\;\\;$[[1]]
\n2) A sample of size $\\var{sb}$
\n$\\operatorname{E}[ \\overline{X}]=\\;\\;$[[2]]$\\;\\;\\;\\operatorname{Var}(\\overline{X})=\\;\\;$[[3]]
\nEnter the variances to 2 decimal places.
", "scripts": {}}, {"type": "gapfill", "marks": 0, "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "showCorrectAnswer": true, "type": "numberentry", "maxValue": "{probsam+tol}", "marks": 1, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "minValue": "{probsam-tol}"}], "prompt": "\n \n \nAssuming that $\\overline{X}$ also follows a normal distribution.
\n \n \n \nFind $P(\\var{lower} \\lt \\overline{X} \\lt \\var{upper})$ in a sample of size $\\var{sa}$.
\n \n \n \n$P(\\var{lower} \\lt \\overline{X} \\lt \\var{upper})=\\;\\;$[[0]]
\n \n \n \nEnter the value correct to 4 decimal places.
\n \n \n ", "scripts": {}}], "functions": {}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}