// Numbas version: finer_feedback_settings {"name": "David's copy of Z-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": [{"name": "David's copy of Z-test on sample mean", "variablesTest": {"condition": "", "maxRuns": 100}, "parts": [{"scripts": {}, "variableReplacementStrategy": "originalfirst", "gaps": [{"extendBaseMarkingAlgorithm": true, "variableReplacements": [], "allowFractions": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "sample_mean_2", "correctAnswerFraction": false, "correctAnswerStyle": "plain", "customMarkingAlgorithm": "", "marks": 1, "precisionPartialCredit": 0, "unitTests": [], "scripts": {}, "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "mustBeReduced": false, "precisionMessage": "You have not given your answer to the correct precision.", "maxValue": "sample_mean_2", "precisionType": "dp", "type": "numberentry", "showPrecisionHint": false, "precision": "2", "strictPrecision": false, "showFeedbackIcon": true, "showCorrectAnswer": true}, {"extendBaseMarkingAlgorithm": true, "variableReplacements": [], "allowFractions": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "sample_stdev_2", "correctAnswerFraction": false, "correctAnswerStyle": "plain", "customMarkingAlgorithm": "", "marks": 1, "precisionPartialCredit": 0, "unitTests": [], "scripts": {}, "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "mustBeReduced": false, "precisionMessage": "You have not given your answer to the correct precision.", "maxValue": "sample_stdev_2", "precisionType": "dp", "type": "numberentry", "showPrecisionHint": false, "precision": "2", "strictPrecision": false, "showFeedbackIcon": true, "showCorrectAnswer": true}, {"extendBaseMarkingAlgorithm": true, "variableReplacements": [{"must_go_first": true, "variable": "sample_mean_2", "part": "p0g0"}, {"must_go_first": true, "variable": "sample_stdev_2", "part": "p0g1"}], "allowFractions": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "test_statistic", "correctAnswerFraction": false, "correctAnswerStyle": "plain", "customMarkingAlgorithm": "", "marks": "1", "precisionPartialCredit": 0, "unitTests": [], "scripts": {}, "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "mustBeReduced": false, "precisionMessage": "You have not given your answer to the correct precision.", "maxValue": "test_statistic", "precisionType": "dp", "type": "numberentry", "showPrecisionHint": false, "precision": "2", "strictPrecision": false, "showFeedbackIcon": true, "showCorrectAnswer": true}], "sortAnswers": false, "extendBaseMarkingAlgorithm": 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

Enter the value for the test statistic:   \\(Z=\\) [[2]]

\n

", "type": "gapfill", "variableReplacements": [], "customMarkingAlgorithm": "", "marks": 0, "unitTests": [], "showFeedbackIcon": true, "showCorrectAnswer": true}, {"scripts": {}, "variableReplacementStrategy": "originalfirst", "minMarks": "2", "displayType": "radiogroup", "displayColumns": "1", "maxMarks": "2", "extendBaseMarkingAlgorithm": true, "matrix": "decision_matrix", "prompt": "

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

", "type": "1_n_2", "variableReplacements": [{"must_go_first": false, "variable": "test_statistic", "part": "p0g2"}], "customMarkingAlgorithm": "", "marks": 0, "shuffleChoices": false, "choices": ["

Reject the Null Hypothesis and conclude that mean lifespan for an Irish man is not \\(\\simplify{{mu1}-{k}}\\).

", "

Reject the Null Hypothesis at the 5% significance level but accept the Null Hypothesis at the 1% significance level and conclude that mean lifespan for an Irish man is \\(\\simplify{{mu1}-{k}}\\).

", "

Reject the Null Hypothesis at the 10% significance level but accept the Null Hypothesis at the 5% significance level and conclude that mean lifespan for an Irish man is \\(\\simplify{{mu1}-{k}}\\).

", "

Accept the Null Hypothesis at the 10% significance level and conclude that meanlifespan for an Irish man is \\(\\simplify{{mu1}-{k}}\\).

"], "unitTests": [], "showFeedbackIcon": true, "showCorrectAnswer": true}], "preamble": {"js": "", "css": ""}, "variable_groups": [], "rulesets": {}, "advice": "

In this example we have a single sample of 30 data values. The sample is just large enough to apply a Z-test

\n

\\(H_0:\\) The mean \\(=\\simplify{{mu1}-{k}}\\).

\n

\\(H_1:\\) The mean \\(\\ne \\simplify{{mu1}-{k}}\\).

\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 Z-statistic:   \\(Z=\\frac{\\overline{x}-\\mu}{\\frac{s}{\\sqrt{n}}}=\\frac{\\var{sample_mean_2}-\\simplify{{mu1}-{k}}}{\\frac{\\var{sample_stdev_2}}{\\sqrt{\\var{sample_size}}}}=\\var{test_statistic}\\)

\n

The Z-table values will be for a two-tailed test are given below. 

\n

significance              10%                    5%                   1%

\n

      limits                \\(\\pm1.65\\)             \\(\\pm1.96\\)             \\(\\pm2.58\\)

\n

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

", "tags": [], "extensions": ["stats"], "variables": {"r1": {"description": "", "name": "r1", "templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu1,sigm1)),sample_size)"}, "t99": {"description": "", "name": "t99", "templateType": "number", "group": "Ungrouped variables", "definition": "2.58"}, "sigm1": {"description": "", "name": "sigm1", "templateType": "randrange", "group": "Ungrouped variables", "definition": "random(5..8#0.5)"}, "sample_stdev_2": {"description": "", "name": "sample_stdev_2", "templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sqrt(30*stdev(r1)^2/29),2)"}, "t90": {"description": "", "name": "t90", "templateType": "number", "group": "Ungrouped variables", "definition": "1.65"}, "sample_mean_2": {"description": "", "name": "sample_mean_2", "templateType": "anything", "group": "Ungrouped variables", "definition": "precround(mean(r1),2)"}, "decision_matrix": {"description": "", "name": "decision_matrix", "templateType": "anything", "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]"}, "test_statistic": {"description": "", "name": "test_statistic", "templateType": "anything", "group": "Ungrouped variables", "definition": "precround((sample_mean_2-mu1+k)/(sample_stdev_2/sqrt(sample_size)),2)"}, "mu1": {"description": "", "name": "mu1", "templateType": "randrange", "group": "Ungrouped variables", "definition": "random(72..75#0.5)"}, "k": {"description": "", "name": "k", "templateType": "randrange", "group": "Ungrouped variables", "definition": "random(1..2.5#0.25)"}, "sample_size": {"description": "", "name": "sample_size", "templateType": "number", "group": "Ungrouped variables", "definition": "30"}, "t95": {"description": "", "name": "t95", "templateType": "number", "group": "Ungrouped variables", "definition": "1.96"}, "scenario": {"description": "", "name": "scenario", "templateType": "anything", "group": "Ungrouped variables", "definition": "sum(map(abs(test_statistic)A sample of 30 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\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]}
{r1[15]}{r1[16]}{r1[17]}{r1[18]}{r1[19]}{r1[20]}{r1[21]}{r1[22]}{r1[23]}{r1[24]}{r1[25]}{r1[26]}{r1[27]}{r1[28]}{r1[29]}
\n

It is believed that the mean lifespan for Irish men is \\(\\simplify{{mu1}-{k}}\\) years.

\n

Does the data support this theory? 

\n

", "ungrouped_variables": ["sample_size", "r1", "decision_matrix", "sample_mean_2", "sample_stdev_2", "mu1", "scenario", "sigm1", "t95", "t99", "k", "t90", "test_statistic"], "type": "question", "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "David Goulding", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2365/"}]}]}], "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "David Goulding", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2365/"}]}