// Numbas version: finer_feedback_settings {"name": "Patrice's copy of Perform t-test for hypothesis given sample mean and standard deviation", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variables": {"crit": {"description": "", "definition": "map(precround(x,3),x,[studenttinv((90+100)/200,n-1),studenttinv((95+100)/200,n-1),studenttinv((99+100)/200,n-1)])", "templateType": "anything", "group": "Ungrouped variables", "name": "crit"}, "thisamount": {"description": "", "definition": "random(70..90)", "templateType": "anything", "group": "Ungrouped variables", "name": "thisamount"}, "evi": {"description": "", "definition": "[\"None\",\"Slight\",\"Moderate\",\"Strong\"]", "templateType": "anything", "group": "Ungrouped variables", "name": "evi"}, "this": {"description": "", "definition": "\"An online flight company makes the following claim:\"", "templateType": "anything", "group": "Ungrouped variables", "name": "this"}, "correctc": {"description": "", "definition": "if(pval>1,\"There is sufficient evidence against the claim of the flight company.\",\"There is insufficient evidence against the claim of the flight company.\")", "templateType": "anything", "group": "Ungrouped variables", "name": "correctc"}, "tval": {"description": "", "definition": "precround(tval1,3)", "templateType": "anything", "group": "Ungrouped variables", "name": "tval"}, "m": {"description": "", "definition": "thisamount+random(1..15)", "templateType": "anything", "group": "Ungrouped variables", "name": "m"}, "here": {"description": "", "definition": "random(\"Barcelona\",\"Madrid\",\"Athens\",\"Berlin\",\"Palma\",\"Rome\",\"Paris\",\"Lisbon\")", "templateType": "anything", "group": "Ungrouped variables", "name": "here"}, "test": {"description": "", "definition": "\"A rival flight company decides to test their claim.\"", "templateType": "anything", "group": "Ungrouped variables", "name": "test"}, "mm": {"description": "", "definition": "switch(pval=0,[1,0,0,0],pval=1,[0,1,0,0],pval=2,[0,0,1,0],[0,0,0,1])", "templateType": "anything", "group": "Ungrouped variables", "name": "mm"}, "resultis": {"description": "", "definition": "\"The mean cost of a flight to \"+ here + \" from this sample is \"", "templateType": "anything", "group": "Ungrouped variables", "name": "resultis"}, "dothis": {"description": "", "definition": "switch(pval <2, 'retain','reject')", "templateType": "anything", "group": "Ungrouped variables", "name": "dothis"}, "stand": {"description": "", "definition": "random(15..25)", "templateType": "anything", "group": "Ungrouped variables", "name": "stand"}, "tol": {"description": "", "definition": "0.001", "templateType": "anything", "group": "Ungrouped variables", "name": "tol"}, "dmm": {"description": "", "definition": "if(pval<2,[1,0],[0,1])", "templateType": "anything", "group": "Ungrouped variables", "name": "dmm"}, "pm": {"description": "", "definition": "[\"is greater than 10%\",\"lies between 5% and 10%\",\"lies between 1% and 5%\",\"is less than 1%\"]", "templateType": "anything", "group": "Ungrouped variables", "name": "pm"}, "tval1": {"description": "", "definition": "abs(m-thisamount)*sqrt(n)/stand", "templateType": "anything", "group": "Ungrouped variables", "name": "tval1"}, "evi1": {"description": "", "definition": "[\"no\",\"slight\",\"moderate\",\"strong\"]", "templateType": "anything", "group": "Ungrouped variables", "name": "evi1"}, "claim": {"description": "", "definition": "\"The average cost of a flight with us to \"+ here + \" is just \u00a3\" + {thisamount} + \" (including all taxes and charges!)\"", "templateType": "anything", "group": "Ungrouped variables", "name": "claim"}, "pval": {"description": "", "definition": "switch(tval{this} 

\n

{claim}

\n

{test}

\n

A sample of {n} {things}

\n

{resultis} £{m} with a standard  deviation of £{stand}.

\n

Perform an appropriate hypothesis test to see if the claim made by the online flight company is substantiated (use a two-tailed test).

\n ", "name": "Patrice's copy of Perform t-test for hypothesis given sample mean and standard deviation", "tags": ["checked2015", "MAS1403"], "type": "question", "variable_groups": [], "preamble": {"js": "", "css": ""}, "ungrouped_variables": ["claim", "pval", "evi1", "crit", "tval1", "things", "stand", "tol", "test", "pm", "correctc", "resultis", "here", "fac", "confl", "evi", "this", "dothis", "m", "dmm", "n", "mm", "thisamount", "tval"], "showQuestionGroupNames": false, "rulesets": {}, "variablesTest": {"maxRuns": 100, "condition": ""}, "advice": "\n

a)

\n

Step 1: Null Hypothesis

\n

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

\n

Step 2: Alternative Hypothesis

\n

$\\operatorname{H}_1\\;: \\; \\mu \\neq\\;\\var{thisamount}$

\n

b)

\n

We should use the t statistic as the population variance is unknown.

\n

The test statistic:

\n

\\[t =\\frac{ |\\var{m} -\\var{thisamount}|} {\\sqrt{\\frac{\\var{stand} ^ 2 }{\\var{n}}}} = \\var{tval}\\]

\n

to 3 decimal places.

\n

c)

\n

As  $n=\\var{n}$ we use the $t_{\\var{n-1}}$ tables.  We have the following data from the tables:

\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", "name": "", "pickQuestions": 0, "questions": []}], "parts": [{"scripts": {}, "gaps": [{"scripts": {}, "showPrecisionHint": false, "minValue": "thisamount", "marks": 0.5, "maxValue": "thisamount", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "thisamount", "marks": 0.5, "maxValue": "thisamount", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}], "marks": 0, "type": "gapfill", "showCorrectAnswer": true, "prompt": "\n

Step 1: Null Hypothesis

\n

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

\n

Step 2: Alternative Hypothesis

\n

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

\n "}, {"scripts": {}, "gaps": [{"checkingtype": "absdiff", "scripts": {}, "marks": 1, "expectedvariablenames": [], "showCorrectAnswer": true, "vsetrange": [0, 1], "checkvariablenames": false, "type": "jme", "showpreview": true, "answer": "t", "vsetrangepoints": 5, "checkingaccuracy": 0.001}, {"scripts": {}, "showPrecisionHint": false, "minValue": "tval-tol", "marks": 1, "maxValue": "tval+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}], "marks": 0, "type": "gapfill", "showCorrectAnswer": true, "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": {}, "gaps": [{"scripts": {}, "matrix": "mm", "displayColumns": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "shuffleChoices": false, "distractors": ["", "", "", ""], "marks": 0, "displayType": "radiogroup", "choices": ["{pm[0]}", "{pm[1]}", "{pm[2]}", "{pm[3]}"], "minMarks": 0}], "marks": 0, "type": "gapfill", "showCorrectAnswer": true, "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 "}, {"scripts": {}, "gaps": [{"scripts": {}, "matrix": "mm", "displayColumns": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "shuffleChoices": false, "distractors": ["", "", "", ""], "marks": 0, "displayType": "radiogroup", "choices": ["{evi[0]}", "{evi[1]}", "{evi[2]}", "{evi[3]}"], "minMarks": 0}, {"scripts": {}, "matrix": "dmm", "displayColumns": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "shuffleChoices": false, "distractors": ["", ""], "marks": 0, "displayType": "radiogroup", "choices": ["Retain", "Reject"], "minMarks": 0}, {"scripts": {}, "matrix": [1, 0], "displayColumns": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "shuffleChoices": true, "distractors": ["", ""], "marks": 0, "displayType": "radiogroup", "choices": ["{Correctc}", "{Fac}"], "minMarks": 0}], "marks": 0, "type": "gapfill", "showCorrectAnswer": true, "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 "}], "metadata": {"description": "

Provided with information on a sample with sample mean and standard deviation, but no information on the population variance, use the t test to either accept or reject a given null hypothesis.

", "licence": "Creative Commons Attribution 4.0 International", "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

The jstat function studenttinv(critvalue,n-1) gives the critical p values correctly.

\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"}, "contributors": [{"name": "Patrice Behan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1791/"}]}]}], "contributors": [{"name": "Patrice Behan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1791/"}]}