// Numbas version: exam_results_page_options {"name": "Charlie's copy of STAT7008 Hypothesis test, single sample, two sided t-test on sample mean", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variables": {"sample_mean_2": {"definition": "precround(mean(r1),2)", "name": "sample_mean_2", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "r1": {"definition": "repeat(round(normalsample(mu1,sigm1)),sample_size)", "name": "r1", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "mu1": {"definition": "random(72..75#0.5)", "name": "mu1", "description": "", "group": "Ungrouped variables", "templateType": "randrange"}, "sample_stdev_2": {"definition": "precround(sqrt(15*stdev(r1)^2/14),2)\n", "name": "sample_stdev_2", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "tcrit": {"definition": "precround(studenttinv(0.975,14),3)", "name": "tcrit", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "sigm1": {"definition": "random(5..8#0.5)", "name": "sigm1", "description": "", "group": "Ungrouped variables", "templateType": "randrange"}, "critical": {"definition": "if(sample_mean_2-mu0>0,tcrit,-tcrit)", "name": "critical", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "Falsec": {"definition": "if(test_statistic<1.96,\"There is sufficient evidence against the quoted percentage\",\n \"There is insufficient evidence against the quoted percentage.\")", "name": "Falsec", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "mu0": {"definition": "mu1+k", "name": "mu0", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "Correctc": {"definition": "if(test_statistic>1.96,\"There is sufficient evidence against the quoted percentage.\",\n \"There is insufficient evidence against the quoted percentage.\")", "name": "Correctc", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "mm": {"definition": "if(test_statistic<1.96,[0,1],[1,0])", "name": "mm", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "k": {"definition": "random(1..2.5#0.25)", "name": "k", "description": "", "group": "Ungrouped variables", "templateType": "randrange"}, "sample_size": {"definition": "15", "name": "sample_size", "description": "", "group": "Ungrouped variables", "templateType": "number"}, "test_statistic": {"definition": "precround((sample_mean_2-mu0)/(sample_stdev_2/sqrt(sample_size)),2)", "name": "test_statistic", "description": "", "group": "Ungrouped variables", "templateType": "anything"}}, "variable_groups": [], "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

In this example we have a single sample of 15 data values. T

\n

\\(H_0:\\) The mean \\(=\\var{mu0}\\).

\n

\\(H_1:\\) The mean \\(\\ne \\var{mu0}\\).

\n

Given a sample of size \\(n\\) recall:

\n

the formula for the sample mean:    \\(\\overline{x}=\\frac{\\sum {x}}{n}=\\var{sample_mean_2}\\)

\n

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

\n

the formula for the t-statistic:   \\(t=\\frac{\\overline{x}-\\mu}{\\frac{s}{\\sqrt{n}}}=\\frac{\\var{sample_mean_2}-\\var{mu0}}{\\frac{\\var{sample_stdev_2}}{\\sqrt{\\var{sample_size}}}}=\\var{test_statistic}\\)

\n

For a significance level of 5%:

\n

$t_{{\\frac{\\alpha}{2}},14}=\\var{critical}$

\n


d)

\n

{Correctc}

", "tags": [], "parts": [{"unitTests": [], "sortAnswers": false, "variableReplacements": [], "showCorrectAnswer": true, "prompt": "

Null Hypothesis

\n

$\\operatorname{H}_0\\;: \\; \\mu=\\;$[[0]]

\n

Alternative Hypothesis

\n

$\\operatorname{H}_1\\;: \\; \\mu \\neq\\;$[[1]]

", "scripts": {}, "type": "gapfill", "variableReplacementStrategy": "originalfirst", "marks": 0, "extendBaseMarkingAlgorithm": true, "gaps": [{"maxValue": "mu0", "unitTests": [], "variableReplacements": [], "correctAnswerFraction": false, "showCorrectAnswer": true, "correctAnswerStyle": "plain", "scripts": {}, "type": "numberentry", "allowFractions": false, "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "minValue": "mu0", "marks": 1, "extendBaseMarkingAlgorithm": true, "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "showFeedbackIcon": true, "customMarkingAlgorithm": ""}, {"maxValue": "mu0", "unitTests": [], "variableReplacements": [], "correctAnswerFraction": false, "showCorrectAnswer": true, "correctAnswerStyle": "plain", "scripts": {}, "type": "numberentry", "allowFractions": false, "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "minValue": "mu0", "marks": 1, "extendBaseMarkingAlgorithm": true, "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "showFeedbackIcon": true, "customMarkingAlgorithm": ""}], "showFeedbackIcon": true, "customMarkingAlgorithm": ""}, {"unitTests": [], "sortAnswers": false, "variableReplacements": [], "showCorrectAnswer": true, "prompt": "

Give all your answers correct to two decimal places.

\n

Input the sample mean:   \\(\\bar{x}=\\) [[0]]

\n

Input the sample standard deviation:   \\(s=\\) [[1]]

\n

Should we use the z or t test statistic? [[2]] enter z or t

\n

Enter the value for the test statistic:    [[3]]

\n

", "scripts": {}, "type": "gapfill", "variableReplacementStrategy": "originalfirst", "marks": 0, "extendBaseMarkingAlgorithm": true, "gaps": [{"precision": "2", "maxValue": "sample_mean_2", "precisionType": "dp", "unitTests": [], "precisionPartialCredit": 0, "variableReplacementStrategy": "originalfirst", "minValue": "sample_mean_2", "marks": 1, "extendBaseMarkingAlgorithm": true, "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "correctAnswerFraction": false, "variableReplacements": [], "showCorrectAnswer": true, "correctAnswerStyle": "plain", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "type": "numberentry", "allowFractions": false, "mustBeReducedPC": 0, "precisionMessage": "You have not given your answer to the correct precision.", "mustBeReduced": false, "customMarkingAlgorithm": ""}, {"precision": "2", "maxValue": "sample_stdev_2", "precisionType": "dp", "unitTests": [], "precisionPartialCredit": 0, "variableReplacementStrategy": "originalfirst", "minValue": "sample_stdev_2", "marks": 1, "extendBaseMarkingAlgorithm": true, "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "correctAnswerFraction": false, "variableReplacements": [], "showCorrectAnswer": true, "correctAnswerStyle": "plain", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "type": "numberentry", "allowFractions": false, "mustBeReducedPC": 0, "precisionMessage": "You have not given your answer to the correct precision.", "mustBeReduced": false, "customMarkingAlgorithm": ""}, {"unitTests": [], "variableReplacements": [], "answer": "t", "expectedVariableNames": [], "showCorrectAnswer": true, "failureRate": 1, "vsetRangePoints": 5, "showPreview": true, "scripts": {}, "type": "jme", "variableReplacementStrategy": "originalfirst", "checkVariableNames": false, "checkingAccuracy": 0.001, "marks": 1, "vsetRange": [0, 1], "extendBaseMarkingAlgorithm": true, "checkingType": "absdiff", "showFeedbackIcon": true, "customMarkingAlgorithm": ""}, {"precision": "2", "maxValue": "test_statistic", "precisionType": "dp", "unitTests": [], "precisionPartialCredit": 0, "variableReplacementStrategy": "originalfirst", "minValue": "test_statistic", "marks": "1", "extendBaseMarkingAlgorithm": true, "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "correctAnswerFraction": false, "variableReplacements": [{"variable": "sample_mean_2", "part": "p0g0", "must_go_first": true}, {"variable": "sample_stdev_2", "part": "p0g1", "must_go_first": true}], "showCorrectAnswer": true, "correctAnswerStyle": "plain", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "type": "numberentry", "allowFractions": false, "mustBeReducedPC": 0, "precisionMessage": "You have not given your answer to the correct precision.", "mustBeReduced": false, "customMarkingAlgorithm": ""}], "showFeedbackIcon": true, "customMarkingAlgorithm": ""}, {"unitTests": [], "sortAnswers": false, "variableReplacements": [], "showCorrectAnswer": true, "prompt": "

Use tables to find the critical value for a significance level of 5%. 

\n

\n

critical value = [[0]]

\n

", "scripts": {}, "type": "gapfill", "variableReplacementStrategy": "originalfirst", "marks": 0, "extendBaseMarkingAlgorithm": true, "gaps": [{"maxValue": "critical+0.01", "unitTests": [], "variableReplacements": [], "correctAnswerFraction": false, "showCorrectAnswer": true, "correctAnswerStyle": "plain", "scripts": {}, "type": "numberentry", "allowFractions": false, "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "minValue": "critical-0.01", "marks": 1, "extendBaseMarkingAlgorithm": true, "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "showFeedbackIcon": true, "customMarkingAlgorithm": ""}], "showFeedbackIcon": true, "customMarkingAlgorithm": ""}, {"unitTests": [], "sortAnswers": false, "variableReplacements": [], "showCorrectAnswer": true, "prompt": "

Your Decision: [[0]]

\n

\n

\n

 

\n

Conclusion: [[1]]

", "scripts": {}, "type": "gapfill", "variableReplacementStrategy": "originalfirst", "marks": 0, "extendBaseMarkingAlgorithm": true, "gaps": [{"unitTests": [], "variableReplacements": [], "minMarks": 0, "choices": ["Reject", "Fail to reject"], "showCorrectAnswer": true, "shuffleChoices": false, "marks": 0, "type": "1_n_2", "displayColumns": 0, "showFeedbackIcon": true, "displayType": "radiogroup", "matrix": "mm", "showCellAnswerState": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "maxMarks": 0, "customMarkingAlgorithm": ""}, {"unitTests": [], "variableReplacements": [], "minMarks": 0, "choices": ["{Correctc}", "{Falsec}"], "showCorrectAnswer": true, "distractors": ["", ""], "shuffleChoices": false, "marks": 0, "type": "1_n_2", "displayColumns": 0, "showFeedbackIcon": true, "displayType": "radiogroup", "matrix": ["1", 0], "showCellAnswerState": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "maxMarks": 0, "customMarkingAlgorithm": ""}], "showFeedbackIcon": true, "customMarkingAlgorithm": ""}], "rulesets": {}, "name": "Charlie's copy of STAT7008 Hypothesis test, single sample, two sided t-test on sample mean", "extensions": ["stats"], "ungrouped_variables": ["sample_size", "r1", "sample_mean_2", "sample_stdev_2", "mu1", "sigm1", "k", "test_statistic", "mu0", "mm", "tcrit", "Correctc", "Falsec", "critical"], "preamble": {"css": "", "js": ""}, "metadata": {"licence": "Creative Commons Attribution-NonCommercial 4.0 International", "description": ""}, "functions": {}, "statement": "

A sample of 15 deaths of men in Ireland during the past year was selected at random and the ages of each man at the time of death recorded.  The data collected is presented below.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
{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]}
\n

It is believed that the mean lifespan for Irish men is {mu0}  years.

\n

Does the data support this theory? 

\n

", "type": "question", "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}, {"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "Charlie Earle", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3054/"}]}]}], "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}, {"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "Charlie Earle", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3054/"}]}