// Numbas version: finer_feedback_settings {"name": "Calculate the standard deviation", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"tags": [], "parts": [{"scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "gapfill", "showCorrectAnswer": true, "prompt": "\n \n \n
Sample Standard Deviation = [[0]] (to one decimal place)
\n \n ", "marks": 0, "showFeedbackIcon": true, "variableReplacements": [], "sortAnswers": false, "variableReplacementStrategy": "originalfirst", "gaps": [{"scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "numberentry", "showCorrectAnswer": true, "mustBeReduced": false, "marks": "3", "maxValue": "{stdev1+tol}", "showFeedbackIcon": true, "variableReplacements": [], "mustBeReducedPC": 0, "allowFractions": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "minValue": "{stdev1-tol}", "customMarkingAlgorithm": "", "correctAnswerFraction": false, "unitTests": []}], "customMarkingAlgorithm": "", "unitTests": []}, {"scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "gapfill", "showCorrectAnswer": true, "prompt": "\n \n \nSample Standard Deviation = [[0]] (to one decimal place)
\n \n ", "marks": 0, "showFeedbackIcon": true, "variableReplacements": [], "sortAnswers": false, "variableReplacementStrategy": "originalfirst", "gaps": [{"scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "numberentry", "showCorrectAnswer": true, "mustBeReduced": false, "marks": "3", "maxValue": "{stdev2+tol}", "showFeedbackIcon": true, "variableReplacements": [], "mustBeReducedPC": 0, "allowFractions": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "minValue": "{stdev2-tol}", "customMarkingAlgorithm": "", "correctAnswerFraction": false, "unitTests": []}], "customMarkingAlgorithm": "", "unitTests": []}, {"scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "gapfill", "showCorrectAnswer": true, "prompt": "\n \n \nSample Standard Deviation = [[0]] (to one decimal place)
\n \n ", "marks": 0, "showFeedbackIcon": true, "variableReplacements": [], "sortAnswers": false, "variableReplacementStrategy": "originalfirst", "gaps": [{"scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "numberentry", "showCorrectAnswer": true, "mustBeReduced": false, "marks": "3", "maxValue": "{stdevoverall+tol}", "showFeedbackIcon": true, "variableReplacements": [], "mustBeReducedPC": 0, "allowFractions": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "minValue": "{stdevoverall-tol}", "customMarkingAlgorithm": "", "correctAnswerFraction": false, "unitTests": []}], "customMarkingAlgorithm": "", "unitTests": []}], "preamble": {"js": "", "css": ""}, "functions": {}, "advice": "\n \n \nThe solution to the first part is here – the other parts can be done in the same way.
\n \n \n \nFor {exam1} we have the mean is:
\n \n \n \n\\[\\simplify[]{({r0[0]} + {r0[1]} + {r0[2]} + {r0[3]} + {r0[4]} + {r0[5]} + {r0[6]} + {r0[7]} + {r0[8]} + {r0[9]}) / {n} = {mean1}}\\]
\n \n \n \nThe sample variance is given by the formula:
\n \n \n \n\\[\\textrm{Sample Variance} = \\frac{1}{n-1}\\left(\\sum_{j=1}^{n}x_j^2 -n\\mu^2\\right)\\]
\n \n \n \nwhere the $x_j$ are the exam scores for {exam1}, $n=\\var{n}$ the number of students and $\\mu=\\var{mean1}$ the sample mean.
\n \n \n \nWe find that
\\[\\begin{eqnarray*}\\sum_{j=1}^{n}x_j^2 &=& \\simplify[]{({r0[0]}^2 + {r0[1]}^2 + {r0[2]}^2 + {r0[3]}^2 + {r0[4]}^2 + {r0[5]}^2 + {r0[6]}^2 + {r0[7]}^2 + {r0[8]}^2 + {r0[9]}^2)}\\\\ \n \n &=& \\var{ssq1}\\\\\n \n \\\\\n \n \\\\\n \n n\\mu^2 &=&\\var{n} \\times\\var{mean1}^2\\\\\n \n &=& \\var{n*mean1^2}\n \n \\end{eqnarray*}\n \n \\]
Hence substituting these values into the formula we find that:
\\[\\begin{eqnarray*}\n \n \\textrm{Sample Variance} &=& \\frac{1}{\\var{n-1}}\\left(\\var{ssq1}-\\var{n*mean1^2}\\right)\\\\\n \n &=& \\var{var1}\n \n \\end{eqnarray*}\n \n \\] to 3 decimal places.
\n \n \n \nThe Sample Standard Deviation is then the square root of the Sample Variance i.e.
\n \n \n \nSample Standard Deviation = $\\sqrt{\\var{var1}} = \\var{stdev1}$ to one decimal place.
\n \n ", "metadata": {"description": "Two ordered data sets, each with 10 numbers. Find the sample standard deviation for each and for their sum.
", "licence": "Creative Commons Attribution 4.0 International"}, "extensions": ["stats"], "variablesTest": {"maxRuns": 100, "condition": ""}, "statement": "The following table gives the examination marks in '{exam1}' and in '{exam2}' and the total for a group of $n=\\var{n}$ students.
\n\n | S1 | \nS2 | \nS3 | \nS4 | \nS5 | \nS6 | \nS7 | \nS8 | \nS9 | \nS10 | \n\n |
---|---|---|---|---|---|---|---|---|---|---|---|
{exam1} | \n$\\var{r0[0]}$ | \n$\\var{r0[1]}$ | \n$\\var{r0[2]}$ | \n$\\var{r0[3]}$ | \n$\\var{r0[4]}$ | \n$\\var{r0[5]}$ | \n$\\var{r0[6]}$ | \n$\\var{r0[7]}$ | \n$\\var{r0[8]}$ | \n$\\var{r0[9]}$ | \nMean = $\\var{mean1}$ | \n
{exam2} | \n$\\var{r1[0]}$ | \n$\\var{r1[1]}$ | \n$\\var{r1[2]}$ | \n$\\var{r1[3]}$ | \n$\\var{r1[4]}$ | \n$\\var{r1[5]}$ | \n$\\var{r1[6]}$ | \n$\\var{r1[7]}$ | \n$\\var{r1[8]}$ | \n$\\var{r1[9]}$ | \nMean = $\\var{mean2}$ | \n
{total} | \n$\\var{sscores[0]}$ | \n$\\var{sscores[1]}$ | \n$\\var{sscores[2]}$ | \n$\\var{sscores[3]}$ | \n$\\var{sscores[4]}$ | \n$\\var{sscores[5]}$ | \n$\\var{sscores[6]}$ | \n$\\var{sscores[7]}$ | \n$\\var{sscores[8]}$ | \n$\\var{sscores[9]}$ | \nMean = $\\var{overallmean}$ | \n
Find the sample standard deviation for each of {exam1}, {exam2} and Total Score.
", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "name": "Calculate the standard deviation", "ungrouped_variables": ["overallmean", "mean1", "mean2", "overallvar", "ssq1", "ssq2", "total", "exam2", "tol", "exam1", "stdev1", "stdev2", "var1", "var2", "sig1", "sig0", "stdevoverall", "r0", "r1", "n", "mu", "s", "sscores"], "variables": {"tol": {"name": "tol", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "0"}, "mu": {"name": "mu", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(55..65)"}, "exam1": {"name": "exam1", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "'Anatomy'"}, "ssq2": {"name": "ssq2", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "sum(map(x^2,x,r1))"}, "n": {"name": "n", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "10"}, "total": {"name": "total", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "'Total Score'"}, "overallvar": {"name": "overallvar", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "variance(sscores,true)"}, "overallmean": {"name": "overallmean", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "mean(sscores)"}, "exam2": {"name": "exam2", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "'Cell Biology'"}, "var2": {"name": "var2", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "precround(variance(r1,true),3)"}, "sscores": {"name": "sscores", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "map(r0[x]+r1[x],x,0..n-1)"}, "r1": {"name": "r1", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu,sig1)),n)"}, "stdev2": {"name": "stdev2", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(r1,true),1)"}, "var1": {"name": "var1", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "precround(variance(r0,true),3)"}, "stdev1": {"name": "stdev1", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(r0,true),1)"}, "sig0": {"name": "sig0", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(6..12)"}, "stdevoverall": {"name": "stdevoverall", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(sscores,true),1)"}, "mean1": {"name": "mean1", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "mean(r0)"}, "mean2": {"name": "mean2", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "mean(r1)"}, "ssq1": {"name": "ssq1", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "sum(map(x^2,x,r0))"}, "s": {"name": "s", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "2"}, "sig1": {"name": "sig1", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(9..15)"}, "r0": {"name": "r0", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalSample(mu,sig0)),n)"}}, "variable_groups": [], "type": "question", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Paul Finley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2232/"}, {"name": "Charlie Earle", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3054/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Paul Finley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2232/"}, {"name": "Charlie Earle", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3054/"}]}