// Numbas version: finer_feedback_settings {"name": "Perform t-test 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": [{"variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "dmm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval2<0.05,[0,1],[1,0])", "description": "", "name": "dmm"}, "thisamount": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(70..90)", "description": "", "name": "thisamount"}, "confl": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(90,95,99)", "description": "", "name": "confl"}, "pval": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(pval2>0.1,0,pval2>0.05,1,pval2>0.01,2,3)", "description": "", "name": "pval"}, "correctc": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval2<0.05,\"There is sufficient evidence against the claim of the flight company.\",\"There is insufficient evidence against the claim of the flight company.\")", "description": "", "name": "correctc"}, "tval1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(meandata-thisamount)*sqrt(n)/stdata", "description": "", "name": "tval1"}, "this": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"An online flight company makes the following claim:\"", "description": "", "name": "this"}, "data": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(m,stand)),n)", "description": "", "name": "data"}, "stdata": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(data,true),2)", "description": "", "name": "stdata"}, "dothis": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(pval2 <=0.05, 'reject','retain')", "description": "", "name": "dothis"}, "tval": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tval1,3)", "description": "", "name": "tval"}, "meandata": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(mean(data),2)", "description": "", "name": "meandata"}, "mm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(pval2>0.1,[1,0,0,0],pval2>0.05,[0,1,0,0],pval2>0.01,[0,0,1,0],[0,0,0,1])", "description": "", "name": "mm"}, "here": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"Barcelona\",\"Madrid\",\"Athens\",\"Berlin\",\"Palma\",\"Rome\",\"Paris\",\"Lisbon\")", "description": "", "name": "here"}, "things": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"customers is taken.\"", "description": "", "name": "things"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "thisamount+random(-15..15 except [-5..5])", "description": "", "name": "m"}, "claim": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"The average cost of a flight with us to \"+ here + \" is just \u00a3\" + {thisamount} + \" (including all taxes and charges!)\"", "description": "", "name": "claim"}, "evi1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"no\",\"slight\",\"moderate\",\"strong\"]", "description": "", "name": "evi1"}, "test": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"A rival flight company decides to test their claim.\"", "description": "", "name": "test"}, "fac": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval2>0.05,\"There is sufficient evidence against the claim of the flight company\",\"There is insufficient evidence against the claim of the flight company.\")", "description": "", "name": "fac"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(10..30)", "description": "", "name": "n"}, "evi": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"None\",\"Slight\",\"Moderate\",\"Strong\"]", "description": "", "name": "evi"}, "stand": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(15..25)", "description": "", "name": "stand"}, "resultis": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"The mean cost of a flight to \"+ here + \" from this sample is \"", "description": "", "name": "resultis"}, "pval2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(2*studenttcdf(-abs(tval),n-1),3)", "description": "", "name": "pval2"}}, "ungrouped_variables": ["claim", "pval", "evi1", "meandata", "tval1", "things", "tol", "test", "tval", "correctc", "pval2", "resultis", "here", "stdata", "fac", "data", "confl", "evi", "this", "dothis", "m", "dmm", "n", "mm", "thisamount", "stand"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "name": "Perform t-test given sample mean and standard deviation", "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "thisamount", "minValue": "thisamount", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "thisamount", "minValue": "thisamount", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}], "type": "gapfill", "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 ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "meandata+tol", "minValue": "meandata-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "stdata+tol", "minValue": "stdata-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Calculate the mean and standard deviation of the sample data, both to 2 decimal places:

\n

\n

Sample mean=[[0]]  (2 decimal places)

\n

\n

Sample standard deviation = [[1]]  (2 decimal places)

", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "tval+tol", "minValue": "tval-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Step 3: Test statistic

\n

Using your calculated values for the mean and standard deviation, calculate the test statistic = ? [[0]] (to 3 decimal places)

", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "pval2+0.001", "minValue": "pval2-0.001", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Step 4: p-value

\n

Use R to compute your $p$-value using the value, to 3 decimal places, of the test statistic you have found.

\n

$p$-value= [[0]] (to 3 decimal places)

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

Step 5: Conclusion

\n

 

\n

Given the $p$ - value, what is the strength of evidence against the null hypothesis?

\n

[[0]]

\n

Your Decision:

\n

[[1]]

\n

 

\n

Conclusion:

\n

[[2]]

", "showCorrectAnswer": true, "marks": 0}], "statement": "

{this} 

\n

{claim}

\n

{test}

\n

A sample of {n} {things} and the following prices charged in £ were found:

\n

{data}

\n

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

", "tags": ["accept null hypothesis", "alternative hypothesis", "checked2015", "critical value", "decision", "degree of freedom", "diagram", "evidence", "hypothesis testing", "MAS8380", "null hypothesis", "p value", "population variance", "probability", "Probability", "random sample", "reject null hypothesis", "sample mean", "sample standard deviation", "sampling", "sc", "statistics", "t tables", "t test", "test statistic", "two-tailed test"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"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", "licence": "Creative Commons Attribution 4.0 International", "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.

"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

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 find the sample mean is $\\var{meandata}$ to 2 decimal places.

\n

The sample standard deviation is $\\var{stdata}$ to 2 decimal places.

\n

c)

\n

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

\n

The test statistic:

\n

\\[t =\\frac{ \\var{meandata} -\\var{thisamount}} {\\frac{\\var{stdata} }{\\sqrt{\\var{n}}}} = \\var{tval}\\]

\n

to 3 decimal places.

\n

d)

\n

Using the R function $\\operatorname{pt}$ with df set to $\\var{n-1}$ we find the  $p$ value =$\\var{pval2}$ to 3 decimal places.

\n


e)

\n

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

\n

{Correctc}

", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}