// Numbas version: finer_feedback_settings {"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": [{"metadata": {"licence": "Creative Commons Attribution-NonCommercial 4.0 International", "description": ""}, "type": "question", "preamble": {"css": "", "js": ""}, "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.

\n

We must evaluate the differences: for each pair of values \\(d=x_1-x_2\\)

\n

\\(\\var{diff}\\)

\n

We now have a sample of \\(n=\\var{sample_size}\\) differences.

\n

Recall:

\n

the formula for the mean difference:    \\(\\overline{d}=\\frac{\\sum {d}}{n}=\\var{diff_mean}\\)

\n

the formula for the standard deviation:   \\(s=\\sqrt{\\frac{\\sum{(d-\\overline{d})^2}}{n-1}}=\\var{diff_stdev}\\)

\n

the 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}\\)

\n

The 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}\\]

\n

Compare the test statistic with the t-table values and choose your conclusion.

", "rulesets": {}, "extensions": ["polynomials", "stats"], "name": "Two sample t-test: paired data", "ungrouped_variables": ["r1", "diff_mean", "diff_stdev", "mu1", "sigm1", "test_statistic", "t95", "scenario", "decision_matrix", "t99", "t90", "r2", "mu2", "sigm2", "sample_size", "diff"], "functions": {}, "tags": [], "variablesTest": {"condition": "", "maxRuns": 100}, "variable_groups": [], "variables": {"t90": {"name": "t90", "group": "Ungrouped variables", "definition": "1.363", "description": "", "templateType": "number"}, "diff_mean": {"name": "diff_mean", "group": "Ungrouped variables", "definition": "precround(mean(diff),2)", "description": "", "templateType": "anything"}, "r2": {"name": "r2", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu2,sigm2)),sample_size)", "description": "", "templateType": "anything"}, "scenario": {"name": "scenario", "group": "Ungrouped variables", "definition": "sum(map(abs(test_statistic)t

", "templateType": "anything"}, "t99": {"name": "t99", "group": "Ungrouped variables", "definition": "2.718", "description": "", "templateType": "number"}, "sample_size": {"name": "sample_size", "group": "Ungrouped variables", "definition": "12", "description": "", "templateType": "number"}, "t95": {"name": "t95", "group": "Ungrouped variables", "definition": "1.796", "description": "", "templateType": "number"}, "r1": {"name": "r1", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu1,sigm1)),sample_size)", "description": "", "templateType": "anything"}, "mu2": {"name": "mu2", "group": "Ungrouped variables", "definition": "{mu1}*1.1", "description": "", "templateType": "anything"}, "sigm1": {"name": "sigm1", "group": "Ungrouped variables", "definition": "{mu1}/8", "description": "", "templateType": "anything"}, "decision_matrix": {"name": "decision_matrix", "group": "Ungrouped variables", "definition": "[\n [1,0,0,0],\n [0,1,0,0],\n [0,0,1,0],\n [0,0,0,1]\n][scenario]", "description": "", "templateType": "anything"}}, "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\\))

\n

The data is presented below:

\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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
123456789101112
Surface Water{r1[0]}{r1[1]}{r1[2]}{r1[3]}{r1[4]}{r1[5]}{r1[6]}{r1[7]}{r1[8]}{r1[9]}{r1[10]}{r1[11]}
Bottom Water{r2[0]}{r2[1]}{r2[2]}{r2[3]}{r2[4]}{r2[5]}{r2[6]}{r2[7]}{r2[8]}{r2[9]}{r2[10]}{r2[11]}
\n

                  

\n

It is believed that the bottom water will contain more zinc per litre than the surface water.

", "parts": [{"type": "gapfill", "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": 0, "prompt": "

Input the appropriate sample mean: [[0]]

\n

Input the appropriate sample standard deviation: [[1]]

\n

Enter the value for the test statistic: t = [[2]]

\n

", "showCorrectAnswer": true, "gaps": [{"precision": "2", "maxValue": "diff_mean", "showPrecisionHint": true, "type": "numberentry", "strictPrecision": false, "correctAnswerStyle": "plain", "precisionPartialCredit": 0, "precisionType": "dp", "correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "scripts": {}, "mustBeReduced": false, "marks": 1, "showCorrectAnswer": true, "minValue": "diff_mean", "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "variableReplacements": [], "allowFractions": false}, {"precision": "2", "maxValue": "diff_stdev", "showPrecisionHint": true, "type": "numberentry", "strictPrecision": false, "correctAnswerStyle": "plain", "precisionPartialCredit": 0, "precisionType": "dp", "correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "scripts": {}, "mustBeReduced": false, "marks": 1, "showCorrectAnswer": true, "minValue": "diff_stdev", "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "variableReplacements": [], "allowFractions": false}, {"precision": "2", "maxValue": "test_statistic", "showPrecisionHint": true, "type": "numberentry", "strictPrecision": false, "correctAnswerStyle": "plain", "precisionPartialCredit": 0, "precisionType": "dp", "correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "scripts": {}, "mustBeReduced": false, "marks": 1, "showCorrectAnswer": true, "minValue": "test_statistic", "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "variableReplacements": [{"must_go_first": true, "part": "p0g0", "variable": "sample_mean_2"}, {"must_go_first": true, "part": "p0g1", "variable": "sample_stdev_2"}], "allowFractions": false}], "showFeedbackIcon": true, "variableReplacements": []}, {"type": "1_n_2", "maxMarks": "2", "variableReplacementStrategy": "originalfirst", "marks": 0, "showFeedbackIcon": true, "displayColumns": "1", "minMarks": "2", "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

"], "shuffleChoices": false, "scripts": {}, "matrix": "decision_matrix", "displayType": "radiogroup", "showCorrectAnswer": true, "prompt": "

\n

Having compared your test statistic with the table value, select one of the following conclusions that best describes your conclusion.

", "variableReplacements": [{"must_go_first": false, "part": "p0g2", "variable": "test_statistic"}]}], "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}