// Numbas version: finer_feedback_settings {"name": "Two sided single sample hypothesis test", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

For a sample of size n from a normal distribution, given mean of the sample mean and the standard deviation , find the t-statistic corresponding to a null hypothesis $\\mu=m$ and a given confidence level. Check if the result is significant at this level.

"}, "parts": [{"type": "gapfill", "unitTests": [], "showCorrectAnswer": true, "prompt": "

Calculate the t-statistic you will need to test the null hypothesis:

\n

Test statistic $t=\\;$?[[0]] (to 3 decimal places).

\n

 

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

What is the critical value with which to compare $|t|$

\n

Critical value $=\\;$[[0]] (to 3 decimal places, the answer should be positive)

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

Is the test significant?

\n

[[0]]

", "variableReplacements": [], "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "gaps": [{"choices": ["

Yes

", "

No

"], "showCellAnswerState": true, "type": "1_n_2", "unitTests": [], "showCorrectAnswer": true, "displayColumns": 0, "variableReplacements": [], "customMarkingAlgorithm": "", "shuffleChoices": false, "extendBaseMarkingAlgorithm": true, "minMarks": 0, "marks": 0, "variableReplacementStrategy": "originalfirst", "maxMarks": 0, "matrix": "mm", "displayType": "radiogroup", "scripts": {}, "showFeedbackIcon": true}], "marks": 0, "variableReplacementStrategy": "originalfirst", "sortAnswers": false, "scripts": {}, "showFeedbackIcon": true}], "preamble": {"css": "", "js": ""}, "rulesets": {}, "tags": [], "extensions": ["stats"], "ungrouped_variables": ["le", "that", "mm", "r11", "tr", "n", "mu", "isthis", "tol", "pert", "test", "st", "sd"], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"isthis": {"group": "Ungrouped variables", "definition": "if(mm[0]=0,'is less than ',' is greater than ')", "name": "isthis", "templateType": "anything", "description": ""}, "le": {"group": "Ungrouped variables", "definition": "random(10,5,1,0.1)", "name": "le", "templateType": "anything", "description": ""}, "tr": {"group": "Ungrouped variables", "definition": "round(r11-st*sd/sqrt(n))+pert", "name": "tr", "templateType": "anything", "description": ""}, "r11": {"group": "Ungrouped variables", "definition": "precround(mean(repeat(normalsample(mu,sd),n)),1)", "name": "r11", "templateType": "anything", "description": ""}, "test": {"group": "Ungrouped variables", "definition": "precround((r11-tr)*sqrt(n)/sd,3)", "name": "test", "templateType": "anything", "description": ""}, "mm": {"group": "Ungrouped variables", "definition": "switch(abs(test)<=st,[0,1],[1,0])", "name": "mm", "templateType": "anything", "description": ""}, "that": {"group": "Ungrouped variables", "definition": "if(mm[0]=0,' not significant and cannot reject the null hypothesis at the $\\\\var{le}$% level.', \n 'significant and can reject the null hypothesis at the $\\\\var{le}$% level.')\n ", "name": "that", "templateType": "anything", "description": ""}, "mu": {"group": "Ungrouped variables", "definition": "random(50..80)", "name": "mu", "templateType": "anything", "description": ""}, "pert": {"group": "Ungrouped variables", "definition": "random(round(-2*st*sd/sqrt(n))..round(2*st*sd/sqrt(n)))", "name": "pert", "templateType": "anything", "description": ""}, "st": {"group": "Ungrouped variables", "definition": "precround(studenttinv(1-le/200,n-1),3)", "name": "st", "templateType": "anything", "description": ""}, "sd": {"group": "Ungrouped variables", "definition": "random(5..12#0.2)", "name": "sd", "templateType": "anything", "description": ""}, "n": {"group": "Ungrouped variables", "definition": "random(10..40#2)", "name": "n", "templateType": "anything", "description": ""}, "tol": {"group": "Ungrouped variables", "definition": "0.001", "name": "tol", "templateType": "anything", "description": ""}}, "variable_groups": [], "advice": "

The test statistic is given by:

\n

\\[t = \\frac{\\bar{x}-\\mu}{\\frac{s}{\\sqrt{n}}}\\]

\n

and in this case we have:

\n

\\[t = \\frac{\\var{r11}-\\var{tr}}{\\frac{\\var{sd}}{\\sqrt{\\var{n}}}}=\\var{test}\\] to 3 decimal places.

\n

Now look up in the tables the critical value at $\\var{le}$% for $\\var{n}-1=\\var{n-1}$ degrees of freedom and a two-sided test.

\n

Note that as we are using one-sided tables we have to look at the $1-\\var{le}/200=\\var{1-le/200}$ critical value and find the corresponding value.

\n

In this case it is $\\var{st}$ to 3 decimal places.

\n

Since $\\var{abs(test)}$ {isthis} $\\var{st}$ we see that the result is {that}.

\n

 

", "name": "Two sided single sample hypothesis test", "functions": {}, "statement": "

$X_1,\\;X_2,\\;\\dots, X_n$ is a random sample from $\\operatorname{N}(\\mu,\\sigma^2)$.

\n

The sample size is $n=\\var{n}$, with sample mean $\\bar{x}=\\var{r11}$ and $s=\\var{sd}$, the sample standard deviation.

\n

Suppose we wish to test at the $\\var{le}$% level the null hypothesis $H_0: \\mu=\\var{tr}$  versus a two sided alternative hypothesis. 

\n

 

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