// Numbas version: exam_results_page_options {"name": "Brad's copy of 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": [{"variable_groups": [], "tags": [], "parts": [{"unitTests": [], "marks": 0, "prompt": "

Test to see if there has been a change in sales on average at the 5% level of significance. 

\n

What is the sample mean?: [[0]]

\n

What is the population mean?: [[1]]

\n

What is the sample standard deviation?: [[3]]

\n

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

\n

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

", "type": "1_n_2", "scripts": {}, "variableReplacements": [{"variable": "r1", "part": "p0g2", "must_go_first": false}], "shuffleChoices": false, "showCorrectAnswer": true, "customMarkingAlgorithm": "", "useCustomName": false, "customName": "", "minMarks": "3", "displayType": "radiogroup", "choices": ["

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.

"], "extendBaseMarkingAlgorithm": true, "matrix": "decision_matrix", "maxMarks": "3", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "showCellAnswerState": true}], "name": "Brad's copy of Two sample t-test: comparison of means", "rulesets": {}, "statement": "

A company has been testing a new marketing plan. Previous data gave a mean of £[0] a week per store. A sample of 12 stores had a mean of £[1] and a standard deviation of £[2].

\n

                   

", "preamble": {"css": "", "js": ""}, "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"sigm1": {"description": "", "definition": "random(5 .. 10#1)", "group": "Ungrouped variables", "name": "sigm1", "templateType": "randrange"}, "sigm2": {"description": "", "definition": "random(4 .. 8#1)", "group": "Ungrouped variables", "name": "sigm2", "templateType": "randrange"}, "t95": {"description": "", "definition": "1.701", "group": "Ungrouped variables", "name": "t95", "templateType": "number"}, "r2": {"description": "", "definition": "repeat(round(normalsample(mu2,sigm2)),sample_size)", "group": "Ungrouped variables", "name": "r2", "templateType": "anything"}, "sample_stdev_2": {"description": "", "definition": "precround(sqrt(15*stdev(r2)^2/14),2)", "group": "Ungrouped variables", "name": "sample_stdev_2", "templateType": "anything"}, "mu2": {"description": "", "definition": "mu1-k", "group": "Ungrouped variables", "name": "mu2", "templateType": "anything"}, "t90": {"description": "", "definition": "1.313", "group": "Ungrouped variables", "name": "t90", "templateType": "number"}, "sample_mean_1": {"description": "", "definition": "precround(mean(r1),0\n", "group": "Ungrouped variables", "name": "sample_mean_1", "templateType": "anything"}, "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]", "group": "Ungrouped variables", "name": "decision_matrix", "templateType": "anything"}, "k": {"description": "", "definition": "random(3 .. 6#1)", "group": "Ungrouped variables", "name": "k", "templateType": "randrange"}, "pooled_s": {"description": "", "definition": "precround(sqrt((sample_stdev_1^2+sample_stdev_2^2)/2),2)", "group": "Ungrouped variables", "name": "pooled_s", "templateType": "anything"}, "test_statistic": {"description": "

t

", "definition": "precround((sample_mean_1-sample_mean_2)/(pooled_s*sqrt(2/15)),2)", "group": "Ungrouped variables", "name": "test_statistic", "templateType": "anything"}, "t99": {"description": "", "definition": "2.467", "group": "Ungrouped variables", "name": "t99", "templateType": "number"}, "mu1": {"description": "", "definition": "random(30000 .. 50000#50)", "group": "Ungrouped variables", "name": "mu1", "templateType": "randrange"}, "sample_mean_2": {"description": "", "definition": "precround(mean(r2),2)", "group": "Ungrouped variables", "name": "sample_mean_2", "templateType": "anything"}, "scenario": {"description": "", "definition": "sum(map(abs(test_statistic)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

", "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "functions": {}, "ungrouped_variables": ["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"], "extensions": ["stats"], "type": "question", "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/"}]}