// Numbas version: finer_feedback_settings {"name": "A comparison of the means of two groups (4).", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "feedback": {"showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showpartfeedbackmessageswhen": "always", "allowrevealanswer": true, "showexpectedanswerswhen": "inreview", "showadvicewhen": "inreview"}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {"pstdev": {"definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "type": "number", "parameters": [["l", "list"]], "language": "jme"}}, "ungrouped_variables": ["combvar", "group1", "group2", "mean1", "mean2", "mu1", "mu2", "object", "objects", "outcome", "sec", "sig1", "sig2", "t95", "thisn", "var1", "var2", "tcalc", "df", "slip"], "name": "A comparison of the means of two groups (4).", "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": "
Summary statistics
\nCalculate means and variances for both groups: variance ($s^2$) is just the standard deviation ($s$ or $sd$) squared.
\nMean 1 = {mean1}; Mean 2 = {mean2}
\nVariance 1 = {var1}; Variance 2 = {var2}
\nn1 = 6; n2 = 6
\nCombined standard error
\nFirst, calculate the combined variance:
\n
Combined variance = {combvar}
\nSecond, calculate the combined standard error:
\n
Combined SE = {sec}
\nt-calc and df
\n$t=\\frac{Mean_1 - Mean_2}{SE_c}$
\n$df = (n1+n2-2) $
\nt-calc = {tcalc}
\ndf = {df}
\nOutcome
\nCompare t-calc to the table value, t-table, which is 2.228, and reject the null if t-calc > t-table.
\nOutcome = {outcome} (Enter 0 if the null is accepted; 1 if it is rejected.)
", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "Summary statistics
\nCalculate means and variances for both groups: variance ($s^2$) is just the standard deviation ($s$ or $sd$) squared.
\nNote: All values, except df and outcome, should be given to 2 decimal places.
\nMean 1 = [[0]]; Mean 2 = [[1]]
\nVariance 1 = [[2]]; Variance 2 = [[3]]
\nn1 = 6; n2 = 6
\nCombined standard error
\nFirst, calculate the combined variance:
\n
Combined variance = [[4]]
\nSecond, calculate the combined standard error:
\n
Combined SE = [[5]]
\nt-calc and df
\n$t=\\frac{Mean_1 - Mean_2}{SE_c}$
\n$df = (n1+n2-2) $
\nt-calc = [[6]]
\ndf = [[7]]
\nOutcome
\nCompare t-calc to the table value, t-table, which is 2.228, and reject the null if t-calc > t-table.
\nOutcome = [[8]] (Enter 0 if the null is accepted; 1 if it is rejected.)
", "marks": 0, "gaps": [{"precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "scripts": {}, "precision": "2", "maxValue": "{mean1}+{slip}", "minValue": "{mean1}-{slip}", "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": "2", "maxValue": "{mean2}+{slip}", "minValue": "{mean2}-{slip}", "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": "2", "maxValue": "{var1}+{slip}", "minValue": "{var1}-{slip}", "strictPrecision": true, "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": "2", "maxValue": "{var2}+{slip}", "minValue": "{var2}-{slip}", "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": "2", "maxValue": "{combvar}+{slip}", "minValue": "{combvar}-{slip}", "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": "2", "maxValue": "{sec}+{slip}", "minValue": "{sec}-{slip}", "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": "2", "maxValue": "{tcalc}+{slip}", "minValue": "{tcalc}-{slip}", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": "50", "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"precisionType": "dp", "integerPartialCredit": "50", "integerAnswer": true, "allowFractions": false, "scripts": {}, "precision": 0, "precisionMessage": "You have not given your answer to the correct precision.", "maxValue": "{df}", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": "50", "marks": 1, "minValue": "{df}", "type": "numberentry", "showPrecisionHint": false}, {"precisionType": "dp", "integerPartialCredit": "50", "integerAnswer": true, "allowFractions": false, "scripts": {}, "precision": 0, "precisionMessage": "You have not given your answer to the correct precision.", "maxValue": "{outcome}", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": "50", "marks": 1, "minValue": "{outcome}", "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "A study is done looking at two drug treatments for use in heart transplants: (1) sodium salicylate; and (2) sodium salicylte and azathioprine. The trial is done using rats. The variable is survival time. The data is in the table below:
\n| {object} | \nA | \nB | \nC | \nD | \nE | \nF | \n
| SS alone | \n$\\var{group1[0]}$ | \n$\\var{group1[1]}$ | \n$\\var{group1[2]}$ | \n$\\var{group1[3]}$ | \n$\\var{group1[4]}$ | \n$\\var{group1[5]}$ | \n
| SS + AZ | \n$\\var{group2[0]}$ | \n$\\var{group2[1]}$ | \n$\\var{group2[2]}$ | \n$\\var{group2[3]}$ | \n$\\var{group2[4]}$ | \n$\\var{group2[5]}$ | \n
Is there a difference between average survival in the two groups?
\nIn other words, test the following null hypothesis:
\nH0: mean survival SS = mean survival SS+AZ.
\nNote: Based on an exercise in Milton, JS (1980) Statistical methods in the biological and health sciences. McGraw-Hill.", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variables": {"sec": {"definition": "sqrt((combvar*(thisn+thisn))/(thisn*thisn))", "templateType": "anything", "group": "Ungrouped variables", "name": "sec", "description": ""}, "object": {"definition": "'Rat'", "templateType": "anything", "group": "Ungrouped variables", "name": "object", "description": ""}, "mu1": {"definition": "random(50..75)", "templateType": "anything", "group": "Ungrouped variables", "name": "mu1", "description": ""}, "mean1": {"definition": "mean(group1)", "templateType": "anything", "group": "Ungrouped variables", "name": "mean1", "description": ""}, "sig2": {"definition": "random(5..10)", "templateType": "anything", "group": "Ungrouped variables", "name": "sig2", "description": ""}, "mu2": {"definition": "random(50..70)", "templateType": "anything", "group": "Ungrouped variables", "name": "mu2", "description": ""}, "df": {"definition": "10", "templateType": "anything", "group": "Ungrouped variables", "name": "df", "description": ""}, "t95": {"definition": "2.228", "templateType": "anything", "group": "Ungrouped variables", "name": "t95", "description": ""}, "var2": {"definition": "pstdev(group2)^2", "templateType": "anything", "group": "Ungrouped variables", "name": "var2", "description": ""}, "tcalc": {"definition": "(mean1-mean2)/sec", "templateType": "anything", "group": "Ungrouped variables", "name": "tcalc", "description": ""}, "thisn": {"definition": "6", "templateType": "anything", "group": "Ungrouped variables", "name": "thisn", "description": ""}, "sig1": {"definition": "random(5..10)", "templateType": "anything", "group": "Ungrouped variables", "name": "sig1", "description": ""}, "objects": {"definition": "'rats'", "templateType": "anything", "group": "Ungrouped variables", "name": "objects", "description": ""}, "group1": {"definition": "repeat(precround(normalsample(mu1,sig1),0),6)", "templateType": "anything", "group": "Ungrouped variables", "name": "group1", "description": ""}, "combvar": {"definition": "(var1*(thisn-1)+var2*(thisn-1))/(2*thisn-2)", "templateType": "anything", "group": "Ungrouped variables", "name": "combvar", "description": ""}, "slip": {"definition": "0.025", "templateType": "anything", "group": "Ungrouped variables", "name": "slip", "description": ""}, "group2": {"definition": "repeat(precround(normalsample(mu2,sig2),0),6)", "templateType": "anything", "group": "Ungrouped variables", "name": "group2", "description": ""}, "var1": {"definition": "pstdev(group1)^2", "templateType": "anything", "group": "Ungrouped variables", "name": "var1", "description": ""}, "mean2": {"definition": "mean(group2)", "templateType": "anything", "group": "Ungrouped variables", "name": "mean2", "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/"}]}