// Numbas version: finer_feedback_settings {"navigation": {"onleave": {"message": "", "action": "none"}, "allowregen": true, "showfrontpage": true, "preventleave": true, "reverse": true, "showresultspage": "oncompletion", "browse": true}, "feedback": {"showactualmark": true, "advicethreshold": 0, "showtotalmark": true, "intro": "", "allowrevealanswer": true, "showanswerstate": true, "feedbackmessages": [], "enterreviewmodeimmediately": true, "showexpectedanswerswhen": "inreview", "showpartfeedbackmessageswhen": "always", "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showadvicewhen": "never"}, "metadata": {"description": "", "licence": "None specified"}, "name": "Practising confidence intervals and hypothesis testing", "question_groups": [{"pickingStrategy": "all-ordered", "name": "Group", "pickQuestions": 1, "questions": [{"name": "Stephanie's copy of Independent two sample t-test.", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Stephanie Greaves", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/340/"}], "functions": {"pstdev": {"definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "type": "number", "language": "jme", "parameters": [["l", "list"]]}}, "tags": ["average", "data analysis", "differences", "elementary statistics", "hypothesis testing", "mean", "standard deviation", "statistics", "stats", "t-test", "two sample t-test", "variance"], "type": "question", "advice": "

The $p$ value {pmsg[t]}.

\n

There is {cmsg1[t]} evidence of an improvement between the observations.

\n

 

", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"maxAnswers": 0, "displayColumns": 0, "prompt": "

The results were $\\var{mean1}$% agreement between the first two observations and $\\var{mean2}$% between the second and third and on calculation the $p$-value was found to be:

\n

$p=\\var{pval}$.

\n

Does this $p$-value indicate any improvement in observations? Choose one of the following.

\n

", "matrix": "v", "shuffleChoices": false, "marks": 0, "minAnswers": 0, "displayType": "radiogroup", "showCorrectAnswer": true, "scripts": {}, "maxMarks": 0, "choices": ["

Indicates a highly significant improvement.

", "

Indicates a significant improvement.

", "

Indicates a trend to improvement, $p < 0.1$

", "

No evidence of significant improvement.

"], "type": "1_n_2", "distractors": ["", "", "", ""], "minMarks": 0}], "statement": "

A class conducted an experiment to assess inter-observer reliability.  They observed stabled horses performing stereotypies (repetitive behaviours indicative of poor welfare: weaving, wind sucking and crib biting).  

\n

They watched the footage 3 times.  They assessed whether their observation and accurate recoding skills had improved each time they watched.  They performed intra-observation agreement calculations between watching the first and second time, then between the second and third times. These were their group results 

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
From first to second$\\var{r1[0]}$$\\var{r1[1]}$$\\var{r1[2]}$$\\var{r1[3]}$$\\var{r1[4]}$$\\var{r1[5]}$$\\var{r1[6]}$
From second to third$\\var{r2[0]}$$\\var{r2[1]}$$\\var{r2[2]}$$\\var{r2[3]}$$\\var{r2[4]}$$\\var{r2[5]}$$\\var{r2[6]}$
\n

", "variable_groups": [], "progress": "ready", "preamble": {"css": "", "js": ""}, "variables": {"sd1": {"definition": "precround(pstdev(r1),3)", "templateType": "anything", "group": "Ungrouped variables", "name": "sd1", "description": ""}, "sd2": {"definition": "precround(pstdev(r2),3)", "templateType": "anything", "group": "Ungrouped variables", "name": "sd2", "description": ""}, "pval": {"definition": "precround(1-studenttcdf(atvalue,12),4)", "templateType": "anything", "group": "Ungrouped variables", "name": "pval", "description": ""}, "mean1": {"definition": "round(mean(r1))", "templateType": "anything", "group": "Ungrouped variables", "name": "mean1", "description": ""}, "mean2": {"definition": "round(mean(r2))", "templateType": "anything", "group": "Ungrouped variables", "name": "mean2", "description": ""}, "m1": {"definition": "mean(r1)", "templateType": "anything", "group": "Ungrouped variables", "name": "m1", "description": ""}, "tol": {"definition": 0.001, "templateType": "anything", "group": "Ungrouped variables", "name": "tol", "description": ""}, "m2": {"definition": "mean(r2)", "templateType": "anything", "group": "Ungrouped variables", "name": "m2", "description": ""}, "msg": {"definition": "['is greater than $\\\\var{t999}$','lies between $\\\\var{t99}$ and $\\\\var{t999}$','lies between $\\\\var{t95}$ and $\\\\var{t99}$','lies between $\\\\var{t90}$ and $\\\\var{t95}$','is less than $\\\\var{t90}$']", "templateType": "anything", "group": "Ungrouped variables", "name": "msg", "description": ""}, "cmsg1": {"definition": "['very significant','significant','slight','no']", "templateType": "anything", "group": "Ungrouped variables", "name": "cmsg1", "description": ""}, "t999": {"definition": 3.922, "templateType": "anything", "group": "Ungrouped variables", "name": "t999", "description": ""}, "atvalue": {"definition": "abs(tvalue)", "templateType": "anything", "group": "Ungrouped variables", "name": "atvalue", "description": ""}, "sig1": {"definition": "random(8..10#0.2)", "templateType": "anything", "group": "Ungrouped variables", "name": "sig1", "description": ""}, "tvalue": {"definition": "precround((m1-m2)*sqrt(n1*n2)/(s*sqrt(n1+n2)),3)", "templateType": "anything", "group": "Ungrouped variables", "name": "tvalue", "description": ""}, "sig2": {"definition": "random(8..10#0.2)", "templateType": "anything", "group": "Ungrouped variables", "name": "sig2", "description": ""}, "t99": {"definition": 2.878, "templateType": "anything", "group": "Ungrouped variables", "name": "t99", "description": ""}, "t95": {"definition": 2.101, "templateType": "anything", "group": "Ungrouped variables", "name": "t95", "description": ""}, "t90": {"definition": 1.734, "templateType": "anything", "group": "Ungrouped variables", "name": "t90", "description": ""}, "cmsg": {"definition": "['do reject','do reject','do not reject','do not reject','do not reject']", "templateType": "anything", "group": "Ungrouped variables", "name": "cmsg", "description": ""}, "mu1": {"definition": "random(45..55)", "templateType": "anything", "group": "Ungrouped variables", "name": "mu1", "description": ""}, "r1": {"definition": "repeat(round(normalsample(mu1,sig1)),10)", "templateType": "anything", "group": "Ungrouped variables", "name": "r1", "description": ""}, "r2": {"definition": "repeat(round(normalsample(mu2,sig2)),10)", "templateType": "anything", "group": "Ungrouped variables", "name": "r2", "description": ""}, "mu2": {"definition": "random(60..65)", "templateType": "anything", "group": "Ungrouped variables", "name": "mu2", "description": "

sss

"}, "pmsg": {"definition": "[' is less than $0.001$',' lies between $0.001$ and $0.05$',' lies between $0.5$ and $0.1$',' is greater than $0.10$']", "templateType": "anything", "group": "Ungrouped variables", "name": "pmsg", "description": ""}, "s": {"definition": "precround(sqrt(((n1-1)*sd1^2+(n2-1)*sd2^2)/(n1+n2-2)),3)", "templateType": "anything", "group": "Ungrouped variables", "name": "s", "description": ""}, "t": {"definition": "switch(v[0]=1,0,v[1]=1,1,v[2]=1,2,3)", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "v": {"definition": "if(pval<0.001,[1,0,0,0],if(pval<0.05,[0,1,0,0],if(pval<0.1,[0,0,1,0],[0,0,0,1])))", "templateType": "anything", "group": "Ungrouped variables", "name": "v", "description": ""}, "n1": {"definition": "7", "templateType": "anything", "group": "Ungrouped variables", "name": "n1", "description": ""}, "n2": {"definition": "7", "templateType": "anything", "group": "Ungrouped variables", "name": "n2", "description": ""}, "pvalue": {"definition": "ttest(atvalue,19,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "pvalue", "description": ""}}, "metadata": {"notes": "", "description": ""}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Stephanie's edited copy of BS4.1", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Stephanie Greaves", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/340/"}], "functions": {}, "tags": ["confidence interval for the mean", "confidence intervals", "mean", "sample", "sampling", "sc", "standard deviation", "statistics", "student t test", "t tables", "t test"], "type": "question", "advice": "

1.

\n

The population variance is unknown. So we have to use the t tables to find the confidence interval.

\n

2.

\n

We now calculate the $\\var{confl}$% confidence interval:

\n

As we have $\\var{n}-1=\\var{n-1}$ degrees of freedom, the interval is given by:

\n

\\[ \\var{m[s]} \\pm t_{\\var{n-1}}\\sqrt{\\frac{\\var{sd[s]}^2}{\\var{n}}}\\]

\n

Looking up the t tables for  $\\var{confl}$% we see that $t_{\\var{n-1}}=\\var{invt}$ to 3 decimal places.

\n

Hence:

\n

Lower value of the confidence interval $=\\;\\displaystyle \\var{m[s]} -\\var{invt} \\sqrt{\\frac{\\var{sd[s]} ^ 2} {\\var{n}}} = \\var{p}\\var{lci}$g to 2 decimal places.

\n

Upper value of the confidence interval $=\\;\\displaystyle \\var{m[s]} +\\var{invt} \\sqrt{\\frac{\\var{sd[s]} ^ 2} {\\var{n}}} = \\var{p}\\var{uci}$g to 2 decimal places.

\n

 

", "rulesets": {}, "parts": [{"prompt": "

Is the population variance known or unknown? 

\n

[[0]]

\n

Calculate a  $\\var{confl}$% confidence interval $(a,b)$ for the population mean:

\n

$a=\\;${p}[[1]]{units}          $b=\\;${p}[[2]]{units}

\n

Enter both to 2 decimal places.

\n

 

", "marks": 0, "gaps": [{"maxAnswers": 0, "displayColumns": 0, "matrix": [0, 1], "shuffleChoices": true, "marks": 0, "minAnswers": 0, "displayType": "radiogroup", "showCorrectAnswer": true, "scripts": {}, "maxMarks": 0, "choices": ["Known", "Unknown"], "type": "1_n_2", "distractors": ["", ""], "minMarks": 0}, {"marks": 1, "maxValue": "lci+0.01", "minValue": "lci-0.01", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"marks": 1, "maxValue": "uci+0.01", "minValue": "uci-0.01", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "

The management of {sc[s]} wants to {dothis[s]}.

\n

A random sample of {spec} $\\var{n}$ {t[s]} gives a mean and standard deviation of  {p} $\\var{m[s]}$ g and {p} $\\var{sd[s]}$ g  respectively.

\n

 

\n

 

", "variable_groups": [], "progress": "testing", "preamble": {"css": "", "js": ""}, "variables": {"m": {"definition": "\n [random(30..100#0.10),\n random(100..500#50),\n random(34..48#0.5),\n random(100..300#0.5),\n random(10..20#0.5),\n random(3.5..6#0.5)]\n \n ", "templateType": "anything", "group": "Ungrouped variables", "name": "m", "description": ""}, "uci": {"definition": "precround(tuci,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "uci", "description": ""}, "invt": {"definition": "precround(tinvt,3)", "templateType": "anything", "group": "Ungrouped variables", "name": "invt", "description": ""}, "units": {"definition": "switch(s=2,\"hours\",s=4,\"g\",s=5,\"g per 100g\",\" \")", "templateType": "anything", "group": "Ungrouped variables", "name": "units", "description": ""}, "lci": {"definition": "precround(tlci,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "lci", "description": ""}, "spec": {"definition": "if(s=2,\"the timecards of \", \" \")", "templateType": "anything", "group": "Ungrouped variables", "name": "spec", "description": ""}, "sc2ch": {"definition": "random(\"local\",\"national\")", "templateType": "anything", "group": "Ungrouped variables", "name": "sc2ch", "description": ""}, "sc1ch": {"definition": "random(\"pet stores\",\"kennels\", \"pet hotels\")", "templateType": "anything", "group": "Ungrouped variables", "name": "sc1ch", "description": ""}, "tinvt": {"definition": "studenttinv((confl+100)/200,n-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "tinvt", "description": ""}, "confl": {"definition": "random(90,95,99)", "templateType": "anything", "group": "Ungrouped variables", "name": "confl", "description": ""}, "tuci": {"definition": "m[s]+invt*sqrt(sd[s]^2/n)", "templateType": "anything", "group": "Ungrouped variables", "name": "tuci", "description": ""}, "dothis": {"definition": "\n [ \"estimate the mean weight of \"+sc5ch+\" inside tins of its most popular product\",\n \"estimate the mean amount of saturated fat in its \"+ sc6ch]\n \n \n \n ", "templateType": "anything", "group": "Ungrouped variables", "name": "dothis", "description": ""}, "sc4ch": {"definition": "random(\"the Caribbean\",\"the Mediterranean\",\"North East England\",\"South West England\",\"California\")", "templateType": "anything", "group": "Ungrouped variables", "name": "sc4ch", "description": ""}, "sc6ch": {"definition": "random(\"tins of cat food\",\"cat treats\")", "templateType": "anything", "group": "Ungrouped variables", "name": "sc6ch", "description": ""}, "n": {"definition": "random(10..30)", "templateType": "anything", "group": "Ungrouped variables", "name": "n", "description": ""}, "p": {"definition": "switch(s=0 or s=1 or s=3,'',' ')", "templateType": "anything", "group": "Ungrouped variables", "name": "p", "description": ""}, "s": {"definition": "random(0..abs(sc)-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "s", "description": ""}, "tlci": {"definition": "m[s]-invt*sqrt(sd[s]^2/n)", "templateType": "anything", "group": "Ungrouped variables", "name": "tlci", "description": ""}, "t": {"definition": "\n [\"tins of cat food \",\n sc6ch+\" \"]\n \n ", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "sc": {"definition": "\n [\" a regional animal food testing company in \"+sc4ch,\n \"Cat tastic!, a company producing a variety of cat food \"]\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "sc", "description": ""}, "sc5ch": {"definition": "random(\"chicken\",\"lamb\",\"turkey\")", "templateType": "anything", "group": "Ungrouped variables", "name": "sc5ch", "description": ""}, "sd": {"definition": "\n [random(3..10#0.10),\n random(100..200#0.5),\n random(2..5#0.5),\n random(10..40#0.5),\n random(1..3#0.5),\n random(0.5..1#0.1)]\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "sd", "description": ""}}, "metadata": {"notes": "

1/01/2013:

\n

Uses the statistical extension which includes the necessary t statistic functions. There are string variables giving various scenarios and these can be added to by the author - except has to add values to arrays m and sd etc as well. Added tag sc.

\n

6/01/2013:

\n

Improved display of units.

", "description": "\n \t\t

Finding the confidence interval at either 90%, 95% or 99% for the mean given the mean and standard deviation of a sample. The population variance is not given and so the t test has to be used. Various scenarios are included.

\n \t\t

 

\n \t\t"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Stephanie's edited copy of BS4.3", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Stephanie Greaves", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/340/"}], "functions": {}, "tags": ["Probability", "accept null hypothesis", "alternative hypothesis", "critical value", "decision", "degree of freedom", "diagram", "evidence", "hypothesis testing", "null hypothesis", "p value", "population variance", "probability", "random sample", "reject null hypothesis", "sample mean", "sample standard deviation", "sampling", "sc", "statistics", "t tables", "t test", "test statistic", "two-tailed test"], "type": "question", "advice": "

a)

\n

Step 1: Null Hypothesis

\n

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

\n

Step 2:  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}

", "rulesets": {}, "parts": [{"prompt": "

Step 1: Null Hypothesis

\n

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

\n

Step 2:  Hypothesis

\n

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

", "marks": 0, "gaps": [{"marks": 0.5, "maxValue": "thisamount", "minValue": "thisamount", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"marks": 0.5, "maxValue": "thisamount", "minValue": "thisamount", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "\n

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)

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

{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 meat processing company is substantiated (use a two-tailed test).

", "variable_groups": [], "progress": "testing", "preamble": {"css": "#questionDisplay .adviceDisplay td {\n\ttext-align: center;", "js": ""}, "variables": {"claim": {"definition": "\"The average cost of a packaging meat with us is just \u00a3\" + {thisamount} + \" (including all taxes!)\"", "templateType": "anything", "group": "Ungrouped variables", "name": "claim", "description": ""}, "pval": {"definition": "switch(tval1,\"There is sufficient evidence against the claim of the meat processing company.\",\"There is insufficient evidence against the claim of the meat processing company.\")", "templateType": "anything", "group": "Ungrouped variables", "name": "correctc", "description": ""}, "resultis": {"definition": "\"The mean cost of packaging meat from this sample is \"", "templateType": "anything", "group": "Ungrouped variables", "name": "resultis", "description": ""}, "here": {"definition": "random(\"Barcelona\",\"Madrid\",\"Athens\",\"Berlin\",\"Palma\",\"Rome\",\"Paris\",\"Lisbon\")", "templateType": "anything", "group": "Ungrouped variables", "name": "here", "description": ""}, "fac": {"definition": "if(pval<2,\"There is sufficient evidence against the claim of the meat processing company\",\"There is insufficient evidence against the claim of the meat processing company.\")", "templateType": "anything", "group": "Ungrouped variables", "name": "fac", "description": ""}, "confl": {"definition": "random(90,95,99)", "templateType": "anything", "group": "Ungrouped variables", "name": "confl", "description": ""}, "evi": {"definition": "[\"None\",\"Slight\",\"Moderate\",\"Strong\"]", "templateType": "anything", "group": "Ungrouped variables", "name": "evi", "description": ""}, "this": {"definition": "\"A meat processing factory makes the following claim:\"", "templateType": "anything", "group": "Ungrouped variables", "name": "this", "description": ""}, "dothis": {"definition": "switch(pval <2, 'retain','reject')", "templateType": "anything", "group": "Ungrouped variables", "name": "dothis", "description": ""}, "m": {"definition": "thisamount+random(1..15)", "templateType": "anything", "group": "Ungrouped variables", "name": "m", "description": ""}, "dmm": {"definition": "if(pval<2,[1,0],[0,1])", "templateType": "anything", "group": "Ungrouped variables", "name": "dmm", "description": ""}, "n": {"definition": "random(10..30)", "templateType": "anything", "group": "Ungrouped variables", "name": "n", "description": ""}, "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])", "templateType": "anything", "group": "Ungrouped variables", "name": "mm", "description": ""}, "thisamount": {"definition": "random(70..90)", "templateType": "anything", "group": "Ungrouped variables", "name": "thisamount", "description": ""}, "stand": {"definition": "random(5..20)", "templateType": "anything", "group": "Ungrouped variables", "name": "stand", "description": ""}}, "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", "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.

"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Stephanie's edited copy of BS4.5", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Stephanie Greaves", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/340/"}], "functions": {}, "tags": ["accept null hypothesis", "alternative hypothesis", "comparing means", "degree of freedom", "diagram", "hypothesis testing", "null hypothesis", "p values", "pooled standard deviation", "population variance", "random sample", "reject null hypothesis", "sample mean", "sampling", "sc", "statistics", "t tables", "t test", "test statistic", "two-tailed test"], "type": "question", "advice": "


b)

\n

Step 3 : Test statistic

\n

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

\n

The pooled standard deviation  is given by :

\n

\\[s = \\sqrt{\\frac{\\var{n1 -1} \\times \\var{sd} ^ 2 + \\var{n2 -1} \\times \\var{sd1} ^ 2 }{\\var{n1} + \\var{n2} -2}} = \\var{tpsd} = \\var{psd}\\] to 3 decimal places.

\n

The test statistic is given by \\[t = \\frac{|\\var{m} -\\var{m1}|}{s \\sqrt{\\frac{1}{ \\var{n1} }+\\frac{1}{ \\var{n2}}}} = \\var{tval}\\] to 3 decimal places.

\n

(Using $s=\\var{tpsd}$ in this formula. )

\n

c)

\n

Step 4: p value range.

\n

As  the degree of freedom is $\\var{n1}+\\var{n2}-2=\\var{n-1}$ 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

Step 5: Conclusion

\n

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

\n

{Correctc}.

", "rulesets": {}, "parts": [{"showCorrectAnswer": true, "prompt": "

Step 1: Null hypothesis

\n

If $\\mu_M$ is the mean for time spent by {things} and  $\\mu_F$ is the mean for time spent by {things1} then you are given that:

\n

$\\operatorname{H}_0\\;:\\;\\mu_M=\\mu_F$. 

\n

Step 2:  Hypothesis

\n

$\\operatorname{H}_1\\;:\\;\\mu_M \\neq \\mu_F$. 

\n

 

", "scripts": {}, "type": "information", "marks": 0}, {"prompt": "\n

Step 3: Test statistic

\n

Should we use the z or t test statistic? 

\n

[[0]]

\n

Now calculate the pooled standard deviation: [[1]] (to 3 decimal places)

\n

 

\n

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

\n

 

\n

(Note that in this calculation you should use a value for the pooled standard deviation which is accurate to at least 5 decimal places and not the value you found to 3 decimal places above).

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

Step 4:  p-value range

\n

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

\n

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

\n

 

\n ", "marks": 0, "gaps": [{"maxAnswers": 0, "displayColumns": 0, "matrix": "mm", "shuffleChoices": false, "marks": 0, "minAnswers": 0, "displayType": "radiogroup", "showCorrectAnswer": true, "scripts": {}, "maxMarks": 0, "choices": ["{pm[0]}", "{pm[1]}", "{pm[2]}", "{pm[3]}"], "type": "1_n_2", "distractors": ["", "", "", ""], "minMarks": 0}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "\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 ", "marks": 0, "gaps": [{"maxAnswers": 0, "displayColumns": 0, "matrix": "mm", "shuffleChoices": false, "marks": 0, "minAnswers": 0, "displayType": "radiogroup", "showCorrectAnswer": true, "scripts": {}, "maxMarks": 0, "choices": ["{evi[0]}", "{evi[1]}", "{evi[2]}", "{evi[3]}"], "type": "1_n_2", "distractors": ["", "", "", ""], "minMarks": 0}, {"maxAnswers": 0, "displayColumns": 0, "matrix": "dmm", "shuffleChoices": false, "marks": 0, "minAnswers": 0, "displayType": "radiogroup", "showCorrectAnswer": true, "scripts": {}, "maxMarks": 0, "choices": ["Retain", "Reject"], "type": "1_n_2", "distractors": ["", ""], "minMarks": 0}, {"maxAnswers": 0, "displayColumns": 0, "matrix": [1, 0], "shuffleChoices": true, "marks": 0, "minAnswers": 0, "displayType": "radiogroup", "showCorrectAnswer": true, "scripts": {}, "maxMarks": 0, "choices": ["{Correctc}", "{Fac}"], "type": "1_n_2", "distractors": ["", ""], "minMarks": 0}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "

{this}

\n

A random  sample of $\\var{n1}$  {things} and $\\var{n2}$  {things1} gave the following results (in {units}.

\n

{table([['Lifespan in the wild',{m},{sd}],['Lifespan in captivity',{m1},{sd1}]],[' ','Mean','Standard deviation'])}

\n

Perform an appropriate hypothesis test to see if there is any difference between {that} of those {things} and those {things1} (the hypotheses and null hypotheses have been set out for you).

", "variable_groups": [], "progress": "testing", "preamble": {"css": "#questionDisplay .adviceDisplay td {\n\ttext-align: center;\n}", "js": ""}, "variables": {"sd1": {"definition": "random(2..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "sd1", "description": ""}, "pval": {"definition": "switch(tval1,\"There is evidence to suggest that the average lifespan of a tiger is different if it lives in the wild compared to in captivity\",\"There is insufficent evidence to suggest that the average lifespan of a tiger differs in the wild compared to in captivity \")", "templateType": "anything", "group": "Ungrouped variables", "name": "correctc", "description": ""}, "tval1": {"definition": "abs(m-m1)*sqrt(n1*n2)/(tpsd*sqrt(n1+n2))", "templateType": "anything", "group": "Ungrouped variables", "name": "tval1", "description": ""}, "things": {"definition": "\"tigers living in the wild\"", "templateType": "anything", "group": "Ungrouped variables", "name": "things", "description": ""}, "m1": {"definition": "random(8..20#1)", "templateType": "anything", "group": "Ungrouped variables", "name": "m1", "description": ""}, "tol": {"definition": 0.001, "templateType": "anything", "group": "Ungrouped variables", "name": "tol", "description": ""}, "units": {"definition": "\"years)\"", "templateType": "anything", "group": "Ungrouped variables", "name": "units", "description": ""}, "pm": {"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", "description": ""}, "tpsd": {"definition": "sqrt(((n1-1)*sd^2+(n2-1)*sd1^2)/(n-1))", "templateType": "anything", "group": "Ungrouped variables", "name": "tpsd", "description": ""}, "that": {"definition": "\"the lifespan \"", "templateType": "anything", "group": "Ungrouped variables", "name": "that", "description": ""}, "psd": {"definition": "precround(tpsd,3)", "templateType": "anything", "group": "Ungrouped variables", "name": "psd", "description": ""}, "fac": {"definition": "if(pval<2,\"There is evidence to suggest that average lifespan of a tiger differs to whether it lives in the wild or in captivity.\",\"There is insufficent evidence to suggest that average lifespan of a tiger differ depending on whether it lives in the wild or in captivity.\")", "templateType": "anything", "group": "Ungrouped variables", "name": "fac", "description": ""}, "confl": {"definition": "[90,95,99]", "templateType": "anything", "group": "Ungrouped variables", "name": "confl", "description": ""}, "evi": {"definition": "[\"None\",\"Slight\",\"Moderate\",\"Strong\"]", "templateType": "anything", "group": "Ungrouped variables", "name": "evi", "description": ""}, "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])", "templateType": "anything", "group": "Ungrouped variables", "name": "mm", "description": ""}, "dothis": {"definition": "switch(pval <2, 'retain','reject')", "templateType": "anything", "group": "Ungrouped variables", "name": "dothis", "description": ""}, "m": {"definition": "random(10..20#10)", "templateType": "anything", "group": "Ungrouped variables", "name": "m", "description": ""}, "dmm": {"definition": "if(pval<2,[1,0],[0,1])", "templateType": "anything", "group": "Ungrouped variables", "name": "dmm", "description": ""}, "n": {"definition": "n1+n2-1", "templateType": "anything", "group": "Ungrouped variables", "name": "n", "description": ""}, "this": {"definition": "\"An animal science class want to know if there is any difference between the lifespan of tigers in the wild compared to tigers kept in captivity.\"", "templateType": "anything", "group": "Ungrouped variables", "name": "this", "description": ""}, "tval": {"definition": "precround(tval1,3)", "templateType": "anything", "group": "Ungrouped variables", "name": "tval", "description": ""}, "n1": {"definition": "random(5..15)", "templateType": "anything", "group": "Ungrouped variables", "name": "n1", "description": ""}, "n2": {"definition": "random(20..30)-n1", "templateType": "anything", "group": "Ungrouped variables", "name": "n2", "description": ""}, "things1": {"definition": "\"living in captivity\"", "templateType": "anything", "group": "Ungrouped variables", "name": "things1", "description": ""}, "sd": {"definition": "random(2..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "sd", "description": ""}}, "metadata": {"notes": "\n \t\t

3/01/2012:

\n \t\t

Added tag sc as can be changed to other applications. Perhaps the tables used should be improved.

\n \t\t

Missing a diagram from the original iassess question, hence tag diagram added.

\n \t\t", "description": "

Given two sets of data, sample mean and sample standard deviation, on performance on the same task, make a decision as to whether or not the mean times differ. Population variance not given, so the t test has to be used in conjunction with the pooled sample standard deviation.

"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}]}], "percentPass": 0, "showstudentname": true, "showQuestionGroupNames": false, "duration": 0, "timing": {"timedwarning": {"message": "", "action": "none"}, "allowPause": true, "timeout": {"message": "", "action": "none"}}, "type": "exam", "contributors": [{"name": "Stephanie Greaves", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/340/"}], "extensions": ["stats"], "custom_part_types": [], "resources": []}