// Numbas version: finer_feedback_settings {"name": "12: Statistics - Comparing Iron Content of Two Lava Flows ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"ungrouped_variables": ["ca", "cb", "meda", "medb", "sampvara", "sampvarb", "meana", "meanb", "similar", "popmeana", "popmeanb", "sea", "seb", "boundsa", "boundsb"], "metadata": {"description": "
Calculate statistics from a table of unpaired data and conclude whether or not they are from the same underlying population and interpret the result.
", "licence": "Creative Commons Attribution 4.0 International"}, "variable_groups": [], "tags": [], "variables": {"sampvarb": {"description": "", "name": "sampvarb", "templateType": "anything", "definition": "variance(cb)", "group": "Ungrouped variables"}, "meda": {"description": "", "name": "meda", "templateType": "anything", "definition": "median(ca)", "group": "Ungrouped variables"}, "boundsb": {"description": "", "name": "boundsb", "templateType": "anything", "definition": "[meanb-2*seb,meanb+2*seb]", "group": "Ungrouped variables"}, "meana": {"description": "", "name": "meana", "templateType": "anything", "definition": "mean(ca)", "group": "Ungrouped variables"}, "cb": {"description": "", "name": "cb", "templateType": "anything", "definition": "repeat(round(normalsample(popmeanb,3)),10)", "group": "Ungrouped variables"}, "popmeana": {"description": "", "name": "popmeana", "templateType": "anything", "definition": "9.50 + random(0..7)", "group": "Ungrouped variables"}, "sea": {"description": "", "name": "sea", "templateType": "anything", "definition": "sqrt({sampvara}*10/90)", "group": "Ungrouped variables"}, "sampvara": {"description": "", "name": "sampvara", "templateType": "anything", "definition": "variance(ca)", "group": "Ungrouped variables"}, "ca": {"description": "", "name": "ca", "templateType": "anything", "definition": "repeat(round(normalsample(popmeana,3)),10)", "group": "Ungrouped variables"}, "boundsa": {"description": "", "name": "boundsa", "templateType": "anything", "definition": "[meana - 2*sea,meana + 2*sea]", "group": "Ungrouped variables"}, "medb": {"description": "", "name": "medb", "templateType": "anything", "definition": "median(cb)", "group": "Ungrouped variables"}, "meanb": {"description": "", "name": "meanb", "templateType": "anything", "definition": "mean(cb)", "group": "Ungrouped variables"}, "seb": {"description": "", "name": "seb", "templateType": "anything", "definition": "sqrt({sampvarb}*10/90)", "group": "Ungrouped variables"}, "similar": {"description": "", "name": "similar", "templateType": "anything", "definition": "random(0,1)", "group": "Ungrouped variables"}, "popmeanb": {"description": "", "name": "popmeanb", "templateType": "anything", "definition": "popmeana + random(1..3)*(1-similar)*random(1,-1)", "group": "Ungrouped variables"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "rulesets": {}, "statement": "The following table presents two samples of the iron content of two lava flows A and B, measured as percent iron oxide (FeO).
\nFeO content of A (%) | \nFeO content of B (%) | \n
{ca[0]} | \n{cb[0]} | \n
{ca[1]} | \n{cb[1]} | \n
{ca[2]} | \n{cb[2]} | \n
{ca[3]} | \n{cb[3]} | \n
{ca[4]} | \n{cb[4]} | \n
{ca[5]} | \n{cb[5]} | \n
{ca[6]} | \n{cb[6]} | \n
{ca[7]} | \n{cb[7]} | \n
{ca[8]} | \n{cb[8]} | \n
{ca[9]} | \n{cb[9]} | \n
Useful formulae
\nFor $N$ measurements, $x_i$, $i = 1,2,3,...,N$
\nmean, $\\bar x = \\frac{1}{N}\\sum\\limits_{i=1}^{N}x_i$
\nsample variance, $s^2 = \\frac{1}{N}\\big(\\sum\\limits_{i=1}^{N}(x_i - \\bar x)^2\\big) = \\overline {x^2} - \\bar x^2$
\nunbiased estimate of population variance, $\\hat s^2 = \\frac{N}{N-1} s^2$
\nstandard deviation is the square root of variance.
\nstandard error in the mean, $SE = \\frac{\\hat s}{\\sqrt{N}}$
", "functions": {"overlaps": {"language": "javascript", "definition": "return (a[1] > b[0])&&(a[0] < b[1]);", "parameters": [["a", "list"], ["b", "list"]], "type": "boolean"}, "ordered": {"language": "javascript", "definition": "return li.sort();", "parameters": [["li", "list"]], "type": "list"}}, "parts": [{"variableReplacementStrategy": "originalfirst", "scripts": {}, "variableReplacements": [], "gaps": [{"correctAnswerStyle": "plain", "scripts": {}, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "variableReplacementStrategy": "originalfirst", "maxValue": "{meana}+0.1", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "minValue": "{meana}-0.1"}, {"correctAnswerStyle": "plain", "scripts": {}, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "variableReplacementStrategy": "originalfirst", "maxValue": "{meanb}+0.1", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "minValue": "{meanb}-0.1"}], "showCorrectAnswer": true, "prompt": "Calculate the mean FeO content for each sample.
\nMean FeO content of sample A: [[0]] years.
\nMean FeO content of sample B: [[1]] years.
", "type": "gapfill", "marks": 0, "showFeedbackIcon": true}, {"variableReplacementStrategy": "originalfirst", "scripts": {}, "variableReplacements": [], "gaps": [{"correctAnswerStyle": "plain", "scripts": {}, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "variableReplacementStrategy": "originalfirst", "maxValue": "{meda}", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "minValue": "{meda}"}, {"correctAnswerStyle": "plain", "scripts": {}, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "variableReplacementStrategy": "originalfirst", "maxValue": "{medb}", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "minValue": "{medb}"}], "showCorrectAnswer": true, "prompt": "Determine the median FeO content for each sample.
\nMedain FeO content of sample A: [[0]] years
\nMedain FeO content of sample B: [[1]] years
", "type": "gapfill", "marks": 0, "showFeedbackIcon": true}, {"variableReplacementStrategy": "originalfirst", "scripts": {}, "variableReplacements": [], "gaps": [{"precisionMessage": "You have not given your answer to the correct precision.", "correctAnswerStyle": "plain", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "precisionPartialCredit": 0, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "precision": "2", "allowFractions": false, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "maxValue": "{sampvara}+0.01", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "{sampvara}-0.01"}, {"precisionMessage": "You have not given your answer to the correct precision.", "correctAnswerStyle": "plain", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "precisionPartialCredit": 0, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "precision": "2", "allowFractions": false, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "maxValue": "{sampvarb}", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "{sampvarb}"}], "showCorrectAnswer": true, "prompt": "Calculate the variance of each sample. Give your answer to two decimal places.
\nSample A variance: [[0]] years2
\nSample B variance: [[1]] years2
", "type": "gapfill", "marks": 0, "showFeedbackIcon": true}, {"variableReplacementStrategy": "originalfirst", "scripts": {}, "variableReplacements": [], "gaps": [{"precisionMessage": "You have not given your answer to the correct precision.", "correctAnswerStyle": "plain", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "precisionPartialCredit": 0, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "precision": "2", "allowFractions": false, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "maxValue": "sqrt({sampvara}*10/9)", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "sqrt({sampvara}*10/9)"}, {"precisionMessage": "You have not given your answer to the correct precision.", "correctAnswerStyle": "plain", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "precisionPartialCredit": 0, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "precision": "2", "allowFractions": false, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "maxValue": "sqrt({sampvarb}*10/9)", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "sqrt({sampvarb}*10/9)"}], "showCorrectAnswer": true, "prompt": "Calculate an unbiased estimate of the standard deviation of the population represented by each sample, showing the formula you use. Give your answers to 2 decimal places.
\n\n$\\hat s_A$ = [[0]] years
\n$\\hat s_B$ = [[1]] years
", "type": "gapfill", "marks": 0, "showFeedbackIcon": true}, {"variableReplacementStrategy": "originalfirst", "scripts": {}, "variableReplacements": [], "gaps": [{"precisionMessage": "You have not given your answer to the correct precision.", "correctAnswerStyle": "plain", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "precisionPartialCredit": 0, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "precision": "2", "allowFractions": false, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "maxValue": "{sea}", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "{sea}"}, {"precisionMessage": "You have not given your answer to the correct precision.", "correctAnswerStyle": "plain", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "precisionPartialCredit": 0, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "precision": "2", "allowFractions": false, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "maxValue": "{seb}", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "{seb}"}], "showCorrectAnswer": true, "prompt": "Determine the standard error in the mean age for the two samples. Give your answers to 2 decimal places.
\n$SE_A$ = [[0]] years
\n$SE_B$ = [[1]] years
", "type": "gapfill", "marks": 0, "showFeedbackIcon": true}, {"variableReplacementStrategy": "originalfirst", "scripts": {}, "variableReplacements": [], "gaps": [{"precisionMessage": "You have not given your answer to the correct precision.", "correctAnswerStyle": "plain", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "precisionPartialCredit": 0, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "precision": "1", "allowFractions": false, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "maxValue": "{boundsa[0]}", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "{boundsa[0]}"}, {"precisionMessage": "-
\n.1
\n0
\n+
\nYou have not given your answer to the correct precision.
", "correctAnswerStyle": "plain", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "precisionPartialCredit": 0, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "precision": "1", "allowFractions": false, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "maxValue": "{boundsa[1]}", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "{boundsa[1]}"}, {"precisionMessage": "You have not given your answer to the correct precision.", "correctAnswerStyle": "plain", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "precisionPartialCredit": 0, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "precision": "1", "allowFractions": false, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "maxValue": "{boundsb[0]}", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "{boundsb[0]}"}, {"precisionMessage": "You have not given your answer to the correct precision.", "correctAnswerStyle": "plain", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "mustBeReducedPC": 0, "showCorrectAnswer": true, "precisionPartialCredit": 0, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "precision": "1", "allowFractions": false, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "maxValue": "{boundsb[1]}", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "{boundsb[1]}"}], "showCorrectAnswer": true, "prompt": "State, with reasons, whether you would be justified in assuming that the lava flows that produced the two outcrops were active at the same time.
\nConstruct a 95% confidence interval for the population mean age of charcoals A and B to 1 decimal places.
\n95% confidence interval for the population mean, $\\mu_A$, of Charcoal A: [[0]] $< \\mu_A <$ [[1]]
\n95% confidence interval for the population mean, $\\mu_B$, of Charcoal B: [[2]]$< \\mu_B <$ [[3]]
\nNow you can compare the means and intervals to justify whether the lava flows were active from the same time.
\n", "type": "gapfill", "marks": 0, "showFeedbackIcon": true}], "name": "12: Statistics - Comparing Iron Content of Two Lava Flows ", "advice": "a) We use the formula for the mean. In our case we have $N$ = 10 since we have 10 measurements for each charcoal sample. We find the total for sample A to be {meana*10} and the total for sample B to be {meanb*10}. All that remains is to divide each by $N$ = 10.
\nb) We first order each list of measurements (ascending or descending order will do!).
\ncharcoal A measurements = {ordered(ca)}
\ncharcoal B measurements = {ordered(cb)}
\nSince we have 10 measurements, the medians lie between the fifth and sixth values in our ordered lists. To calculate them we simply take the average of those respective values:
\nMedian of A = $\\frac{\\var{ordered(ca)[4]} + \\var{ordered(ca)[5]}}{2} = \\var{meda}$
\nMedian of B = $\\frac{\\var{ordered(cb)[4]} + \\var{ordered(cb)[5]}}{2} = \\var{medb}$
\nc) We use either form of the formula for the sample variance. Here we will use the simpler form which requires us to first calculate the sum of squared measurements for each sample. (Make sure you understand and can apply these useful formulae before the exam!)
\nSample A variance = $\\overline {x^2 }- \\bar x^2 = \\frac{\\var{sumsqrd(ca)}}{10} - \\var{meana}^2 = \\var{sampvara}$
\nSample B variance = $\\overline {x^2 }- \\bar x^2 = \\frac{\\var{sumsqrd(cb)}}{10} - \\var{meanb}^2 = \\var{sampvarb}$
\nd) We note that we are asked for the standard deviation, not the variance, so we will need to take a square root at some point. We want to obtain $\\hat s$, so we take the square root of the given formula for the unbiased estimate of population variance: $\\hat s =\\sqrt{ s^2\\frac{N}{N-1}}$. We now plug in our previously calculated values of the sample variance, $s^2$, and round to 2 decimal places:
\n$\\hat s_A = \\sqrt{\\var{sampvara}\\times\\frac{10}{9}} = \\var{sqrt({sampvara}*10/9)} =\\var{precround(sqrt({sampvara}*10/9),2)} $
\n$\\hat s_B = \\sqrt{\\var{sampvarb}\\times\\frac{10}{9}} = \\var{sqrt({sampvarb}*10/9)}=\\var{precround(sqrt({sampvarb}*10/9),2)} $
\ne) We use the formula for the standard error in the mean. We calculated the values of $\\hat s$ in part d), so all that is left to do is to divide these values by $\\sqrt{10}$.
\n$SE_A = \\var{sqrt({sampvara}*1/9)} =\\var{precround(sqrt({sampvara}*1/9),2)} $
\n$SE_B = \\var{sqrt({sampvarb}*1/9)}=\\var{precround(sqrt({sampvarb}*1/9),2)} $
\n(You might have a slightly different answer if you have used the rounded value from part d). It is good practice to use the unrounded values in later calculations unless directed otherwise. You can make this easier by storing the previous answers in your calculator's memory. If you do not know how to do this, please follow the link to see a 30-second tutorial: https://vimeo.com/101615630)
\nf) We need to use the statistics we have just calculated to form a conclusion.
\n95% confidence intervals.
\nFor $\\mu_A$: $\\bar x_A \\pm 2 SE_A = \\var{meana} \\pm2\\times\\var{sea}$
\n$\\var{precround(boundsa[0],1)}< \\mu_A < \\var{precround(boundsa[1],1)}$
\nFor $\\mu_B$: $\\bar x_B \\pm 2 SE_B = \\var{meanb} \\pm2\\times\\var{seb}$
\n$\\var{precround(boundsb[0],1)}< \\mu_B < \\var{precround(boundsb[1],1)}$
\nSince these intervals do not overlap, we have insufficient evidence to suggest that the population mean ages are different at a 5% level of significance (as they are not more than 2 standard errors apart from each other).
\nAlso, the standard errors in the mean ages are quite small. This suggests that the measurements which we are given in the table are representative of the true ages of charcoal A and B, so we are more convinced by our conclusion drawn from the comparison of the confidence intervals.
\nTaking all of this into account, we interpret our previous conclusion that the population mean ages are not different at a 5% level of significance by saying that we would be justified in assuming the lava flows that produced the two outcrops were active at the same time.
\nTaking all of this into account, we interpret our previous conclusion that the population mean ages are different at a 5% level of significance by saying that we would not be justified in assuming the lava flows that produced the two outcrops were active at the same time.
\nNote: the marking of this question does not take into account the size of the overlap of the confidence intervals, just whether or not they actually overlap. If the size of the overlap turns out to be quite small (compared to the sizes of the standard errors) then the conclusion we should make (if any) is a bit more ambiguous. This question uses randomly generated values; in an exam situation the values will most likely be chosen so that their 95% confidence intervals for their population means clearly either do or do not overlap. For example, in the 2015 paper the 95% confidence interval for the population mean of charcoal B lies completely inside that of charcoal A, so there is no ambiguity.
", "preamble": {"js": "", "css": ""}, "extensions": ["stats"], "type": "question", "contributors": [{"name": "Jinhua Mathias", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/353/"}]}]}], "contributors": [{"name": "Jinhua Mathias", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/353/"}]}