// Numbas version: exam_results_page_options {"name": "Mean\u00b1error 1", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Mean\u00b1error 1", "tags": [], "metadata": {"description": "

A measurement is performed multiple times for the same object, the student will

\n\n

Advice is provided including on performing the calculations in Python or spreedsheets together with further reading. 

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

Using a metre rule, you performed serveral repeat measurements of your friend's height :

\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
MeasurementHeight [m]
1$\\var{data[0]}$
2$\\var{data[1]}$
3$\\var{data[2]}$
\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\n\n
MeasurementHeight [m]
1$\\var{data[0]}$
2$\\var{data[1]}$
3$\\var{data[2]}$
4$\\var{data[3]}$
5$\\var{data[4]}$
\n
", "advice": "

When studying a parameter of interest, scientists record many repeat measurements. This is to help account for the imperfect precision and accuracy of measurements.
The best estimate of a parameter, $x$, is the mean of \ud835\udc41 repeat measurements:
\\[ \\bar{x} = \\frac{1}{N}(x_1 + x_2 +\\cdots+ x_N) = \\frac{1}{N}\\sum_{i=1}^N x_i \\]

\n

In this example of measuring the height of your friend, the values of $x_i$ are:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$x_1$ =$\\var{data[0]}$
$x_2$ =$\\var{data[1]}$
$x_3$ =$\\var{data[2]}$
\n

Using Python, this can be calculated via:

\n
\n

import numpy as np

\n

x = np.array([$\\var{data[0]}$, $\\var{data[1]}$, $\\var{data[2]}$])

\n

mean = np.mean(x)

\n
\n

Or if using a spreadsheet:

\n
\n

=average($\\var{data[0]}$, $\\var{data[1]}$, $\\var{data[2]}$)

\n
\n

To determine how precise the mean is we need to calculate the average deviation of our measurements $x_i$ with the mean value $\\bar{x}$. 

\n

In this case, we have repeated measurements of the same object (height of your friend) so we can use the population standard deviation:

\n

\\[ \\sigma = \\sqrt{\\frac{1}{N} \\sum_{i=1}^N (x_i - \\overline{x})^2} \\]

\n

which can be calculated using Python via:

\n
\n

sd = np.std(x)

\n
\n

or via a spreadsheet approach:

\n
\n

=stdevp($\\var{data[0]}$, $\\var{data[1]}$, $\\var{data[2]}$)

\n
\n

We can use this standard deviation to determine the error on the mean value:

\n

\\[ \\alpha = \\frac{\\sigma}{\\sqrt{N}} \\]

\n

which indicates that the more repeat measurements we perform, the smaller the error on the mean becomes. 

\n

Typically, the error on the mean is only precise to 1 significant figure. It requires 1000's of repeat measurements for an additional significant figure of precision. Hence we round $\\alpha$ to 1 significant figure and then round the mean to the same number of decimal places to produce the final result:

\n

\\[ \\bar{x} \\pm \\alpha \\] 

\n

See this useful book for more details:

\n

Hughes, I., Hase, T. , \"Measurements and Their Uncertainties\", Oxford University Press (2010)

", "rulesets": {}, "extensions": ["stats"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"data": {"name": "data", "group": "Ungrouped variables", "definition": "repeat(precround(normalsample(mu,sigma), precision), n)", "description": "

Produce values of measurements by repeatively sampling a normal distribution with mean (mu) and standard deviation (sigma).

\n

", "templateType": "anything", "can_override": false}, "result": {"name": "result", "group": "Ungrouped variables", "definition": "mean(data)", "description": "

Mean of repeat measurements 

", "templateType": "anything", "can_override": false}, "error": {"name": "error", "group": "Ungrouped variables", "definition": "population_stdev(data)/sqrt(n)", "description": "

Error on the mean of repeat measurements.

", "templateType": "anything", "can_override": false}, "finalresult": {"name": "finalresult", "group": "Ungrouped variables", "definition": "precround(result, finalprecision)", "description": "

Round mean result to the final precision. 

", "templateType": "anything", "can_override": false}, "finalerror": {"name": "finalerror", "group": "Ungrouped variables", "definition": "siground(error, 1)", "description": "

Round the error to 1 significant figure. 

", "templateType": "anything", "can_override": false}, "mu": {"name": "mu", "group": "Ungrouped variables", "definition": "random(180..190#0.5)*0.01", "description": "

Mean of normal distribution used to generate measurement data. 

", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "5", "description": "

Number of repeat measurements. Conditions set in Statement to display data in table using n=3 or n = 5.

", "templateType": "anything", "can_override": false}, "sigma": {"name": "sigma", "group": "Ungrouped variables", "definition": "random(1..5#0.5)*0.001", "description": "", "templateType": "anything", "can_override": false}, "finalprecision": {"name": "finalprecision", "group": "Ungrouped variables", "definition": "countdp(string(finalerror))", "description": "

Count the number of decimal places when the error has been rounded to 1 significant figure.

", "templateType": "anything", "can_override": false}, "precision": {"name": "precision", "group": "Ungrouped variables", "definition": "3", "description": "

Set the number of decimal places for the initial measurements

", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Ungrouped variables", "definition": "\"m\"", "description": "", "templateType": "anything", "can_override": false}, "std": {"name": "std", "group": "Ungrouped variables", "definition": "population_stdev(data)", "description": "

Population Standard Deviation

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["data", "result", "error", "finalresult", "finalerror", "mu", "n", "sigma", "finalprecision", "precision", "units", "std"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Mean\u00b1Error", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate:

\n

Mean measurement = [[0]]

\n

The standard deviation =[[4]]

\n

Error on the mean  = [[1]]

\n

Now write the final result and error to the correct precision:

\n

[[2]] ± [[3]] m 

\n

\n

\n

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "Mean", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{result}", "maxValue": "{result}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "4", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Error", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{error}", "maxValue": "{error}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "4", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Final mean", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{finalresult}", "maxValue": "{finalresult}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Final Error", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{finalerror}", "maxValue": "{finalerror}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Std", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{std}", "maxValue": "{std}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "4", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Mark Quinn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/13894/"}]}]}], "contributors": [{"name": "Mark Quinn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/13894/"}]}