// Numbas version: exam_results_page_options {"name": "Two sample t-test: paired data", "extensions": ["stats", "polynomials"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Two sample t-test: paired data", "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "
Trace metals in drinking water affect the flavor and an unusually high concentration can pose a health hazard. Twelve locations were selected and pairs of data were taken measuring zinc concentration in bottom water and surface water. (\\(\\mu g/l\\))
\nThe data is presented below:
\n\n
\n | 1 | \n2 | \n3 | \n4 | \n5 | \n6 | \n7 | \n8 | \n9 | \n10 | \n11 | \n12 | \n
Surface Water | \n{r1[0]} | \n{r1[1]} | \n{r1[2]} | \n{r1[3]} | \n{r1[4]} | \n{r1[5]} | \n{r1[6]} | \n{r1[7]} | \n{r1[8]} | \n{r1[9]} | \n{r1[10]} | \n{r1[11]} | \n
Bottom Water | \n{r2[0]} | \n{r2[1]} | \n{r2[2]} | \n{r2[3]} | \n{r2[4]} | \n{r2[5]} | \n{r2[6]} | \n{r2[7]} | \n{r2[8]} | \n{r2[9]} | \n{r2[10]} | \n{r2[11]} | \n
\n
It is believed that the bottom water will contain more zinc per litre than the surface water.
", "advice": "In this example we are dealing with paired data.
\n\\(H_0:\\) \\(\\mu_d=0\\) i.e. The mean zinc concentration for surface water and bottom water is the same.
\n\\(H_1:\\) \\(\\mu_d<0\\) i.e The mean zinc concentration for surface water is less than the mean zinc concentration for bottom water.
\nWe must evaluate the differences: for each pair of values \\(d=x_1-x_2\\)
\n\\(\\var{diff}\\)
\nWe now have a sample of \\(n=\\var{sample_size}\\) differences.
\nRecall:
\nthe formula for the mean difference: \\(\\overline{d}=\\frac{\\sum {d}}{n}=\\var{diff_mean}\\)
\nthe formula for the standard deviation: \\(s=\\sqrt{\\frac{\\sum{(d-\\overline{d})^2}}{n-1}}=\\var{diff_stdev}\\)
\nthe formula for the t-statistic: \\(t=\\frac{\\overline{d}}{\\frac{s}{\\sqrt{n}}}=\\frac{\\var{diff_mean}}{\\frac{\\var{diff_stdev}}{\\sqrt{12}}}=\\var{test_statistic}\\)
\nThe t-table value will be for a one-tailed test and will have \\(n-1=11\\) degrees of freedom. Because of the alternative hypothesis the t-value chosen will be negative.
\n\\[\\begin{array}{r|rrrr}&0.10&0.05&0.01\\\\\\hline11&-\\var{t90}&-\\var{t95}&-\\var{t99}\\end{array}\\]
\nCompare the test statistic with the t-table values and choose your conclusion.
", "rulesets": {}, "extensions": ["polynomials", "stats"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"r1": {"name": "r1", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu1,sigm1)),sample_size)", "description": "", "templateType": "anything", "can_override": false}, "sigm1": {"name": "sigm1", "group": "Ungrouped variables", "definition": "{mu1}/8", "description": "", "templateType": "anything", "can_override": false}, "mu1": {"name": "mu1", "group": "Ungrouped variables", "definition": "random(380 .. 420#1)", "description": "", "templateType": "randrange", "can_override": false}, "t99": {"name": "t99", "group": "Ungrouped variables", "definition": "2.718", "description": "", "templateType": "number", "can_override": false}, "t90": {"name": "t90", "group": "Ungrouped variables", "definition": "1.363", "description": "", "templateType": "number", "can_override": false}, "mu2": {"name": "mu2", "group": "Ungrouped variables", "definition": "{mu1}*1.05", "description": "", "templateType": "anything", "can_override": false}, "diff": {"name": "diff", "group": "Ungrouped variables", "definition": "list(vector(r1)-vector(r2))", "description": "", "templateType": "anything", "can_override": false}, "sample_size": {"name": "sample_size", "group": "Ungrouped variables", "definition": "12", "description": "", "templateType": "number", "can_override": false}, "r2": {"name": "r2", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu2,sigm2)),sample_size)", "description": "", "templateType": "anything", "can_override": false}, "t95": {"name": "t95", "group": "Ungrouped variables", "definition": "1.796", "description": "", "templateType": "number", "can_override": false}, "test_statistic": {"name": "test_statistic", "group": "Ungrouped variables", "definition": "precround(diff_mean/(diff_stdev/sqrt(12)),2)", "description": "t
", "templateType": "anything", "can_override": false}, "sigm2": {"name": "sigm2", "group": "Ungrouped variables", "definition": "{mu1}/8", "description": "", "templateType": "anything", "can_override": false}, "diff_mean": {"name": "diff_mean", "group": "Ungrouped variables", "definition": "precround(mean(diff),2)", "description": "", "templateType": "anything", "can_override": false}, "diff_stdev": {"name": "diff_stdev", "group": "Ungrouped variables", "definition": "precround(sqrt(12*stdev(diff)^2/11),2)", "description": "", "templateType": "anything", "can_override": false}, "atvalue": {"name": "atvalue", "group": "Ungrouped variables", "definition": "abs(test_statistic)", "description": "", "templateType": "anything", "can_override": false}, "v": {"name": "v", "group": "Ungrouped variables", "definition": "if(atvalue>=t99,[1,0,0,0],if(atvalue>=t95,[0,1,0,0],if(atvalue>=t90,[0,0,1,0],[0,0,0,1])))", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["r1", "diff_mean", "diff_stdev", "sigm1", "mu1", "test_statistic", "t95", "t99", "t90", "r2", "sigm2", "mu2", "sample_size", "diff", "atvalue", "v"], "variable_groups": [{"name": "Unnamed group", "variables": []}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Input the appropriate sample mean: [[0]]
\nInput the appropriate sample standard deviation: [[1]]
\nEnter the value for the test statistic: t = [[2]]
\n", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "diff_mean", "maxValue": "diff_mean", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "2", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "diff_stdev", "maxValue": "diff_stdev", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "2", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "sample_mean_2", "part": "p0g0", "must_go_first": true}, {"variable": "sample_stdev_2", "part": "p0g1", "must_go_first": true}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "test_statistic", "maxValue": "test_statistic", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "2", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "test_statistic", "part": "p0g2", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "\nHaving compared your test statistic with the table value, select one of the following conclusions that best describes your conclusion.
", "minMarks": "2", "maxMarks": "2", "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": "1", "showCellAnswerState": true, "choices": ["Reject the Null Hypothesis and conclude that the mean zinc concentration is greater for bottom water than surface water
", "Reject the Null Hypothesis at the 5% significance level but accept the Null Hypothesis at the 1% significance level and conclude that the mean zinc concentration is the same for bottom water and surface water
", "Reject the Null Hypothesis at the 10% significance level but accept the Null Hypothesis at the 5% significance level and conclude that the mean zinc concentration is the same for bottom water and surface water
", "Accept the Null Hypothesis at the 10% significance level and conclude that the mean zinc concentration is the same for bottom water and surface water
"], "matrix": "v"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}]}]}], "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}]}