// Numbas version: finer_feedback_settings {"name": "A comparison of the means of two groups (2).", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {"pstdev": {"definition": "stdev(l)*sqrt(abs(l)/(abs(l)-1))", "type": "number", "parameters": [["l", "list"]], "language": "jme"}}, "ungrouped_variables": ["attempt", "d", "meandiff", "mu1", "mu2", "object", "objects", "r1", "r2", "sig1", "sig2", "stdiff", "t95", "thismany", "tcalc", "tupper", "tlower", "mdupper", "mdlower", "stdupper", "stdlower", "outcome", "sed", "test"], "name": "A comparison of the means of two groups (2).", "tags": ["average", "data analysis", "differences", "elementary statistics", "hypothesis testing", "mean", "mean of differences", "paired t-test", "standard deviation", "standard deviation of differences", "statistics", "stats", "t-test", "variance"], "advice": "
First, recognise that this is a paired t-test: paired because twins are genetically identical.
\nSo calculate the differences (placebo $-$ drug) between those two observations:
\n{d}
\nNote: If you have a graphical calculator, you can enter the two sets of observations into two lists (say L1 and L2), then in the heading (title/label) row for L3 type \"=L1 $-$ L2\" to get the calculator to work out the differences.
\nThen calculate the mean difference:
\n{meandiff}
\nThen the standard deviation (sd) of the differences:
\n{stdiff}
\nNote: You should use your calculator to get both the mean and standard deviation.
\nThe standard error (se) is calculated as:
\n\\[ se = \\frac{ sd }{ \\sqrt{ n }} \\]
\nIt is:
\n{sed}
\nFinally, calculate the test statisitic, t-calc, as the mean difference divided by the standard error:
\n\\[ t-calc = \\frac{ mean difference }{ se} \\]
\nt-calc = {tcalc}
\nThere are 6 subjects, so 5 degrees of freedom, and the test is two-tailed, so the t-table = 2.571.
\nIf t-calc is greater than 2.571, the null is rejected. As this is a two-tailed test, the sign of t-calc (positive or negative) is ignored.
", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "Find the mean and standard deviations of the difference between the placebo and drug responses
\nCalculate differences between placebo and drug responses.
\nMean of difference = [[0]] (input to 3 decimal places )
\nStandard deviation of difference = [[1]] (input to 3 decimal places)
\nNow find the paired t-test statistic using the values you have just calculated =[[2]] (input 3 decimal places)
\nIs the null hypothesis rejected? [[3]] Enter 0 for \"No\" and 1 for \"Yes\".
", "marks": 0, "gaps": [{"precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "scripts": {}, "precision": "3", "maxValue": "{mdupper}", "minValue": "{mdlower}", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": "50", "marks": "1", "type": "numberentry", "showPrecisionHint": false}, {"precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "scripts": {}, "precision": "3", "maxValue": "{stdupper}", "minValue": "{stdlower}", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": "50", "marks": "1", "type": "numberentry", "showPrecisionHint": false}, {"precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "scripts": {}, "precision": "3", "maxValue": "{tupper}", "minValue": "{tlower}", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": 0, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"integerPartialCredit": 0, "integerAnswer": true, "allowFractions": false, "scripts": {}, "maxValue": "{outcome}", "minValue": "{outcome}", "correctAnswerFraction": false, "showCorrectAnswer": true, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "A medical researcher is concerned that a new drug may be affecting a patient’s ability to concentrate. She finds six (6) sets of identical twins, randomly gives one a placebo pill (a medically inert and inactive substance) and the other the drug, then measures their reaction times. The data is in the table below:
\n| {object} | \nA | \nB | \nC | \nD | \nE | \nF | \n
| Placebo | \n$\\var{r1[0]}$ | \n$\\var{r1[1]}$ | \n$\\var{r1[2]}$ | \n$\\var{r1[3]}$ | \n$\\var{r1[4]}$ | \n$\\var{r1[5]}$ | \n
| Drug | \n$\\var{r2[0]}$ | \n$\\var{r2[1]}$ | \n$\\var{r2[2]}$ | \n$\\var{r2[3]}$ | \n$\\var{r2[4]}$ | \n$\\var{r2[5]}$ | \n
Is there a difference in response time between the placebo and the drug?
\nIn other words, test the following null hypothesis:
\nH0: mean time placebo = mean time drug.
", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variables": {"tlower": {"definition": "tcalc-0.025", "templateType": "anything", "group": "Ungrouped variables", "name": "tlower", "description": ""}, "sed": {"definition": "precround(stdiff/sqrt(thismany),3)", "templateType": "anything", "group": "Ungrouped variables", "name": "sed", "description": ""}, "t95": {"definition": "2.571", "templateType": "anything", "group": "Ungrouped variables", "name": "t95", "description": ""}, "mdupper": {"definition": "meandiff+0.025", "templateType": "anything", "group": "Ungrouped variables", "name": "mdupper", "description": ""}, "stdupper": {"definition": "stdiff+0.025", "templateType": "anything", "group": "Ungrouped variables", "name": "stdupper", "description": ""}, "test": {"definition": "stdev(d)*sqrt(thismany/(thismany-1))", "templateType": "anything", "group": "Ungrouped variables", "name": "test", "description": ""}, "meandiff": {"definition": "precround(mean(d),6)", "templateType": "anything", "group": "Ungrouped variables", "name": "meandiff", "description": ""}, "object": {"definition": "'Twin set'", "templateType": "anything", "group": "Ungrouped variables", "name": "object", "description": ""}, "tcalc": {"definition": "precround(meandiff/(stdiff/sqrt(thismany)),6)", "templateType": "anything", "group": "Ungrouped variables", "name": "tcalc", "description": ""}, "sig1": {"definition": "random(0.025..0.05)", "templateType": "anything", "group": "Ungrouped variables", "name": "sig1", "description": ""}, "thismany": {"definition": "6", "templateType": "anything", "group": "Ungrouped variables", "name": "thismany", "description": ""}, "stdiff": {"definition": "precround(pstdev(d),6)", "templateType": "anything", "group": "Ungrouped variables", "name": "stdiff", "description": ""}, "sig2": {"definition": "random(0.025..0.5)", "templateType": "anything", "group": "Ungrouped variables", "name": "sig2", "description": ""}, "mdlower": {"definition": "meandiff-0.025", "templateType": "anything", "group": "Ungrouped variables", "name": "mdlower", "description": ""}, "attempt": {"definition": "'hand'", "templateType": "anything", "group": "Ungrouped variables", "name": "attempt", "description": ""}, "stdlower": {"definition": "stdiff-0.025", "templateType": "anything", "group": "Ungrouped variables", "name": "stdlower", "description": ""}, "d": {"definition": "list(vector(r1)-vector(r2))", "templateType": "anything", "group": "Ungrouped variables", "name": "d", "description": ""}, "mu1": {"definition": "random(0.2..0.3)", "templateType": "anything", "group": "Ungrouped variables", "name": "mu1", "description": ""}, "r1": {"definition": "repeat(min(precround(normalsample(mu1,sig1),2),25),6)", "templateType": "anything", "group": "Ungrouped variables", "name": "r1", "description": ""}, "r2": {"definition": "repeat(min(precround(normalsample(mu2,sig2),2),25),6)", "templateType": "anything", "group": "Ungrouped variables", "name": "r2", "description": ""}, "mu2": {"definition": "mu1+random(0.05..0.10)", "templateType": "anything", "group": "Ungrouped variables", "name": "mu2", "description": ""}, "objects": {"definition": "'twins'", "templateType": "anything", "group": "Ungrouped variables", "name": "objects", "description": ""}, "tupper": {"definition": "tcalc+0.025", "templateType": "anything", "group": "Ungrouped variables", "name": "tupper", "description": ""}, "outcome": {"definition": "if((abs(tcalc)>t95),1,0)", "templateType": "anything", "group": "Ungrouped variables", "name": "outcome", "description": ""}}, "metadata": {"notes": "", "description": "A comparison of the mean of two groups.
", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "Keith McGuinness", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/523/"}], "resources": []}]}], "contributors": [{"name": "Keith McGuinness", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/523/"}]}