// Numbas version: exam_results_page_options {"name": "Two sample t-test: comparison of means", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {}, "variable_groups": [], "metadata": {"licence": "Creative Commons Attribution-NonCommercial 4.0 International", "description": ""}, "tags": [], "functions": {}, "name": "Two sample t-test: comparison of means", "ungrouped_variables": ["r1", "sample_mean_1", "sample_stdev_1", "mu1", "sigm1", "test_statistic", "t95", "scenario", "decision_matrix", "t99", "t90", "r2", "mu2", "sigm2", "sample_mean_2", "sample_stdev_2", "pooled_s", "sample_size", "k"], "parts": [{"variableReplacementStrategy": "originalfirst", "scripts": {}, "showCorrectAnswer": true, "showFeedbackIcon": true, "type": "gapfill", "prompt": "

Input the sample mean for 2000 data: [[0]]

\n

Input the sample standard deviation for 2000 data: [[1]]

\n

Input the sample mean for 2010 data: [[3]]

\n

Input the sample standard deviation for 2010 data: [[4]]

\n

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

\n

Reject the Null Hypothesis and conclude that mean hydrocarbon emission rate has decreased.

", "

Reject the Null Hypothesis at the 5% significance level but accept the Null Hypothesis at the 1% significance level and conclude that mean hydrocarbon emission rate is the same for both models.

", "

Reject the Null Hypothesis at the 10% significance level but accept the Null Hypothesis at the 5% significance level and conclude that mean hydrocarbon emission rate is the same for both models.

", "

Accept the Null Hypothesis at the 10% significance level and conclude that mean hydrocarbon emission rate is the same for both models.

"], "type": "1_n_2", "prompt": "

Having compared your test statistic with the table values for a one-tailed t-test with 28 degrees of freedom, select one of the following conclusions that best describes your conclusion.

", "minMarks": "3", "shuffleChoices": false}], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"decision_matrix": {"description": "", "definition": "[\n [1,0,0,0],\n [0,1,0,0],\n [0,0,1,0],\n [0,0,0,1]\n][scenario]", "templateType": "anything", "name": "decision_matrix", "group": "Ungrouped variables"}, "k": {"description": "", "definition": "random(3..6#1)", "templateType": "randrange", "name": "k", "group": "Ungrouped variables"}, "r2": {"description": "", "definition": "repeat(round(normalsample(mu2,sigm2)),sample_size)", "templateType": "anything", "name": "r2", "group": "Ungrouped variables"}, "mu1": {"description": "", "definition": "random(220..240#1)", "templateType": "randrange", "name": "mu1", "group": "Ungrouped variables"}, "sample_mean_2": {"description": "", "definition": "precround(mean(r2),2)", "templateType": "anything", "name": "sample_mean_2", "group": "Ungrouped variables"}, "scenario": {"description": "", "definition": "sum(map(abs(test_statistic)t

", "definition": "precround((sample_mean_1-sample_mean_2)/(pooled_s*sqrt(2/15)),2)", "templateType": "anything", "name": "test_statistic", "group": "Ungrouped variables"}, "pooled_s": {"description": "", "definition": "precround(sqrt((sample_stdev_1^2+sample_stdev_2^2)/2),2)", "templateType": "anything", "name": "pooled_s", "group": "Ungrouped variables"}, "sigm1": {"description": "", "definition": "random(5..10#1)", "templateType": "randrange", "name": "sigm1", "group": "Ungrouped variables"}, "sample_mean_1": {"description": "", "definition": "precround(mean(r1),2)", "templateType": "anything", "name": "sample_mean_1", "group": "Ungrouped variables"}, "t95": {"description": "", "definition": "1.701", "templateType": "number", "name": "t95", "group": "Ungrouped variables"}, "sample_stdev_1": {"description": "", "definition": "precround(sqrt(15*stdev(r1)^2/14),2)", "templateType": "anything", "name": "sample_stdev_1", "group": "Ungrouped variables"}, "sigm2": {"description": "", "definition": "random(4..8#1)", "templateType": "randrange", "name": "sigm2", "group": "Ungrouped variables"}, "t99": {"description": "", "definition": "2.467", "templateType": "number", "name": "t99", "group": "Ungrouped variables"}, "t90": {"description": "", "definition": "1.313", "templateType": "number", "name": "t90", "group": "Ungrouped variables"}, "r1": {"description": "", "definition": "repeat(round(normalsample(mu1,sigm1)),sample_size)", "templateType": "anything", "name": "r1", "group": "Ungrouped variables"}, "mu2": {"description": "", "definition": "mu1-k", "templateType": "anything", "name": "mu2", "group": "Ungrouped variables"}, "sample_size": {"description": "", "definition": "15", "templateType": "number", "name": "sample_size", "group": "Ungrouped variables"}}, "extensions": ["stats"], "type": "question", "preamble": {"js": "", "css": ""}, "advice": "

In this example we are comparing the means of two distict samples.

\n

\$$H_0:\$$ \$$\\mu_1=\\mu_2\$$    i.e. The mean emission rate is the same for both sets of cars.

\n

\$$H_1:\$$ \$$\\mu_1>\\mu_2\$$    i.e.  The mean emission rate of the older set of cars is greater than the mean emission rate of the newer set of cars.

\n

For each sample we must evaluate the sample mean and the sample standard deviation.

\n

Recall when given a sample of size \$$n\$$ :

\n

the formula for the sample mean:    \$$\\overline{x}=\\frac{\\sum {x}}{n}\$$

\n

\$$\\overline{x_1}=\\var{sample_mean_1}\$$   and    \$$\\overline{x_2}=\\var{sample_mean_2}\$$

\n

the formula for the sample standard deviation:   \$$s=\\sqrt{\\frac{\\sum{(x-\\overline{x})^2}}{n-1}}\$$

\n

\$$s_1=\\var{sample_stdev_1}\$$     and     \$$s_2=\\var{sample_stdev_2}\$$

\n

We must evaluate the pooled sample standard deviation using the two sample standard deviartions \$$s_1\$$ and \$$s_2\$$ and the formula

\n

\$$s_p=\\sqrt{\\frac{(n_1-1)s_1^2+(n_2-1)s_2^2}{n_1+n_2-2}}=\\sqrt{\\frac{14(\\var{sample_stdev_1})^2+14(\\var{sample_stdev_2})^2}{15+15-2}}=\\var{pooled_s}\$$

\n

The formula for the t-statistic:

\n

\$$t=\\frac{\\overline{x_1}-\\overline{x_2}}{s_p\\sqrt{\\frac{1}{n_1}+\\frac{1}{n_2}}}=\\frac{\\var{sample_mean_1}-\\var{sample_mean_2}}{\\var{pooled_s}\\sqrt{\\frac{1}{14}+\\frac{1}{14}}}=\\var{test_statistic}\$$

\n

The t-table value will be for a one-tailed test and will have \$$n_1+n_2-2=28\$$ degrees of freedom. Because of the alternative hypothesis the t-value chosen will be positive.

\n

\$\\begin{array}{r|rrrr}&0.10&0.05&0.01\\\\\\hline28&\\var{t90}&\\var{t95}&\\var{t99}\\end{array}\$

\n

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

\n

", "statement": "

It is believed that the hydrocarbon emissions of cars have decreased in the first decade of the new millenium. A study was conducted to compare the hydrocarbon emissions at idling speed, in parts per million (ppm), of cars built in 2000 and cars built in 2010. Fifteen cars from each year were randomly selected on the year of their production and their hydrocarbon emission levels were recorded.

\n

The data gathered is tabled 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
 2000 Model {r1[0]} {r1[1]} {r1[2]} {r1[3]} {r1[4]} {r1[5]} {r1[6]} {r1[7]} {r1[8]} {r1[9]} {r1[10]} {r1[11]} {r1[12]} {r1[13]} {r1[14]} 2010 Model {r2[0]} {r2[1]} {r2[2]} {r2[3]} {r2[4]} {r2[5]} {r2[6]} {r2[7]} {r2[8]} {r2[9]} {r2[10]} {r2[11]} {r2[12]} {r2[13]} {r2[14]}
\n

", "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/"}]}