// Numbas version: exam_results_page_options {"name": "Perform z-test for hypothesis given sample mean and population variance", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"description": "

Provided with information on a sample with sample mean and known population variance, use the z test to either accept or reject a given null hypothesis.

", "notes": "\n \t\t

2/01/2012:

\n \t\t

Added tag sc as has string variables in order to generate other scenarios.

\n \t\t

Added tag diagram as the i-assess question advice has a nice graphic of the p-value and the appropriate decision.

\n \t\t", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "variables": {"things": {"definition": "\"cups is taken\"", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "things"}, "resultis": {"definition": "\"giving a mean of \"", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "resultis"}, "claim": {"definition": "\"The vending machine company claims each cup should be filled with \"", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "claim"}, "pval": {"definition": "switch(zval1,\"There is sufficient evidence against the claim of the vending company.\",\n \"There is insufficient evidence against the claim of the vending company.\")", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "correctc"}, "tol": {"definition": "0.001", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "tol"}, "var": {"definition": "\"the variance of the filling process is known to be \"", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "var"}, "n": {"definition": "random(50..100)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "n"}, "dothis": {"definition": "switch(pval <2, 'retain','reject')", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "dothis"}, "stand": {"definition": "random(15..25)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "stand"}, "confl": {"definition": "random(90,95,99)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "confl"}, "thismuch": {"definition": "random(140..160)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "thismuch"}, "fac": {"definition": "if(pval<2,\"There is sufficient evidence against the claim of the vending company\",\n \"There is insufficient evidence against the claim of the vending company.\")", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "fac"}, "pm": {"definition": "[\"is greater than 10%\",\"lies between 5% and 10%\",\"lies between 1% and 5%\",\"is less than 1%\"]", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "pm"}, "evi": {"definition": "[\"None\",\"Slight\",\"Moderate\",\"Strong\"]", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "evi"}, "test": {"definition": "\"Customers of the vending machine suspect the machine is under-filling.\"", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "test"}, "this": {"definition": "\"A vending machine fills cups with \"", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "this"}, "crit": {"definition": "[1.282,1.645,2.326]", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "crit"}, "dmm": {"definition": "if(pval<2,[1,0],[0,1])", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "dmm"}, "m": {"definition": "thismuch-random(3..15)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "m"}, "mm": {"definition": "switch(pval=0,[1,0,0,0],pval=1,[0,1,0,0],pval=2,[0,0,1,0],[0,0,0,1])", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "mm"}}, "advice": "\n

a)

\n

Step 1: Null Hypothesis

\n

$\\operatorname{H}_0\\;: \\; \\mu=\\;\\var{thismuch}$

\n

Step 2: Alternative Hypothesis

\n

$\\operatorname{H}_1\\;: \\; \\mu \\lt\\;\\var{thismuch}$

\n

b)

\n

We should use the z statistic as the population variance is known.

\n

The test statistic:

\n

\\[z =\\frac{ |\\var{m} -\\var{thismuch}|} {\\sqrt{\\frac{\\var{thisvar}}{\\var{n}}}} = \\var{zval}\\]

\n

to 3 decimal places.

\n

c)

\n

{table([['Critical Value',crit[0],crit[1],crit[2]]],['p value','10%','5%','1%'])}

\n

We see that the $p$ value {pm[pval]}.

\n


d)

\n

Hence there is {evi1[pval]} evidence against $\\operatorname{H}_0$ and so we {dothis} $\\operatorname{H}_0$.

\n

{Correctc}

\n ", "question_groups": [{"pickingStrategy": "all-ordered", "pickQuestions": 0, "name": "", "questions": []}], "ungrouped_variables": ["claim", "var", "pval", "evi1", "crit", "zval1", "things", "tol", "units", "thismuch", "pm", "correctc", "resultis", "thisvar", "test", "zval", "fac", "confl", "evi", "mm", "dothis", "m", "dmm", "n", "this", "stand"], "name": "Perform z-test for hypothesis given sample mean and population variance", "rulesets": {}, "preamble": {"css": "", "js": ""}, "tags": ["checked2015", "MAS1403"], "variable_groups": [], "statement": "\n

{this} {stuff}

\n

{claim}$\\var{thismuch}${units} and {var} {thisvar}.

\n

{test}

\n

To investigate a sample of $\\var{n}$ {things} {resultis} $\\var{m}${units}. 

\n

Perform an appropriate hypothesis test to see if the claim made by the customers is substantiated.

\n ", "showQuestionGroupNames": false, "variablesTest": {"condition": "", "maxRuns": 100}, "parts": [{"type": "gapfill", "marks": 0, "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "showCorrectAnswer": true, "type": "numberentry", "maxValue": "thismuch", "marks": 0.5, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "minValue": "thismuch"}, {"correctAnswerFraction": false, "showCorrectAnswer": true, "type": "numberentry", "maxValue": "thismuch", "marks": 0.5, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "minValue": "thismuch"}], "prompt": "\n

Step 1: Null Hypothesis

\n

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

\n

Step 2: Alternative Hypothesis

\n

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

\n ", "scripts": {}}, {"type": "gapfill", "marks": 0, "showCorrectAnswer": true, "gaps": [{"type": "jme", "showCorrectAnswer": true, "checkingaccuracy": 0.001, "checkvariablenames": false, "vsetrange": [0, 1], "showpreview": true, "expectedvariablenames": [], "marks": 1, "vsetrangepoints": 5, "checkingtype": "absdiff", "scripts": {}, "answer": "z"}, {"correctAnswerFraction": false, "showCorrectAnswer": true, "type": "numberentry", "maxValue": "zval+tol", "marks": 1, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "minValue": "zval-tol"}], "prompt": "

Step 3: Test statistic

\n

Should we use the z or t test statistic? [[0]] (enter z or t).

\n

Now calculate the test statistic = ? [[1]] (to 3 decimal places)

", "scripts": {}}, {"type": "gapfill", "marks": 0, "showCorrectAnswer": true, "gaps": [{"type": "1_n_2", "marks": 0, "shuffleChoices": false, "showCorrectAnswer": true, "displayType": "radiogroup", "maxMarks": 0, "matrix": "mm", "choices": ["{pm[0]}", "{pm[1]}", "{pm[2]}", "{pm[3]}"], "minMarks": 0, "displayColumns": 0, "scripts": {}, "distractors": ["", "", "", ""]}], "prompt": "\n

Step 4: p-value

\n

Use tables to find a range for your $p$-value. 

\n

Choose the correct range here for $p$ : [[0]]

\n \n ", "scripts": {}}, {"type": "gapfill", "marks": 0, "showCorrectAnswer": true, "gaps": [{"type": "1_n_2", "marks": 0, "shuffleChoices": false, "showCorrectAnswer": true, "displayType": "radiogroup", "maxMarks": 0, "matrix": "mm", "choices": ["{evi[0]}", "{evi[1]}", "{evi[2]}", "{evi[3]}"], "minMarks": 0, "displayColumns": 0, "scripts": {}, "distractors": ["", "", "", ""]}, {"type": "1_n_2", "marks": 0, "shuffleChoices": false, "showCorrectAnswer": true, "displayType": "radiogroup", "maxMarks": 0, "matrix": "dmm", "choices": ["Retain", "Reject"], "minMarks": 0, "displayColumns": 0, "scripts": {}, "distractors": ["", ""]}, {"type": "1_n_2", "marks": 0, "shuffleChoices": true, "showCorrectAnswer": true, "displayType": "radiogroup", "maxMarks": 0, "matrix": [1, 0], "choices": ["{Correctc}", "{Fac}"], "minMarks": 0, "displayColumns": 0, "scripts": {}, "distractors": ["", ""]}], "prompt": "\n

Step 5: Conclusion

\n

 

\n

Given the $p$ - value and the range you have found, what is the strength of evidence against the null hypothesis?

\n

[[0]]

\n

Your Decision:

\n

[[1]]

\n

 

\n

Conclusion:

\n

[[2]]

\n \n ", "scripts": {}}], "functions": {}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}