// Numbas version: exam_results_page_options {"name": "Brad's copy of Two sample t-test: paired data", "extensions": ["polynomials", "stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "variables": {"diff_stdev": {"definition": "precround(sqrt(12*stdev(diff)^2/11),2)", "name": "diff_stdev", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "sigm1": {"definition": "{mu1}/8", "name": "sigm1", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "mu1": {"definition": "random(380..480#1)", "name": "mu1", "templateType": "randrange", "description": "", "group": "Ungrouped variables"}, "sample_size": {"definition": "12", "name": "sample_size", "templateType": "number", "description": "", "group": "Ungrouped variables"}, "sigm2": {"definition": "{mu1}/5", "name": "sigm2", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "r2": {"definition": "repeat(round(normalsample(mu2,sigm2)),sample_size)", "name": "r2", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "t95": {"definition": "1.796", "name": "t95", "templateType": "number", "description": "", "group": "Ungrouped variables"}, "r1": {"definition": "repeat(round(normalsample(mu1,sigm1)),sample_size)", "name": "r1", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "t99": {"definition": "2.718", "name": "t99", "templateType": "number", "description": "", "group": "Ungrouped variables"}, "mu2": {"definition": "{mu1}*1.1", "name": "mu2", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "diff": {"definition": "list(vector(r1)-vector(r2))", "name": "diff", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "scenario": {"definition": "sum(map(abs(test_statistic)t

", "group": "Ungrouped variables"}, "t90": {"definition": "1.363", "name": "t90", "templateType": "number", "description": "", "group": "Ungrouped variables"}}, "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
 1 2 3 4 5 6 7 8 9 10 11 12 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.

", "name": "Brad's copy of Two sample t-test: paired data", "type": "question", "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.

", "tags": [], "rulesets": {}, "variable_groups": [], "extensions": ["polynomials", "stats"], "variablesTest": {"condition": "", "maxRuns": 100}, "preamble": {"css": "", "js": ""}, "functions": {}, "ungrouped_variables": ["r1", "diff_mean", "diff_stdev", "mu1", "sigm1", "test_statistic", "t95", "scenario", "decision_matrix", "t99", "t90", "r2", "mu2", "sigm2", "sample_size", "diff"], "parts": [{"variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "gapfill", "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

\n

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

", "type": "1_n_2", "marks": 0, "matrix": "decision_matrix", "scripts": {}, "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "shuffleChoices": false, "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

"], "maxMarks": "2", "displayColumns": "1", "minMarks": "2", "showCorrectAnswer": true}], "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "Brad Allison", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3394/"}]}]}], "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "Brad Allison", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3394/"}]}