// Numbas version: finer_feedback_settings {"name": "Patrice's copy of Perform a two-way ANOVA", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variables": {"v1": {"description": "", "definition": "switch(pvalue<=0.001,[1,0,0,0,0],pvalue<=0.01,[0,1,0,0,0],pvalue<=0.05,[0,0,1,0,0],pvalue<=0.1,[0,0,0,1,0],[0,0,0,0,1])", "templateType": "anything", "group": "Ungrouped variables", "name": "v1"}, "t": {"description": "", "definition": "map(sum(r[x]),x,0..n-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "t"}, "bbss": {"description": "", "definition": "precround(sum(map(x^2,x,t))/m-tot^2/20,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "bbss"}, "rs": {"description": "", "definition": "precround(rss/dfr,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "rs"}, "btss": {"description": "", "definition": "precround(sum(map(x^2,x,cols))/n-tot^2/(m*n),2)", "templateType": "anything", "group": "Ungrouped variables", "name": "btss"}, "vrbb": {"description": "", "definition": "precround(msbb/rs,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "vrbb"}, "ssq": {"description": "", "definition": "sum(map(sum(map(x^2,x,r[y])),y,0..n-1))", "templateType": "anything", "group": "Ungrouped variables", "name": "ssq"}, "t90": {"description": "", "definition": "13.36", "templateType": "anything", "group": "Ungrouped variables", "name": "t90"}, "t95": {"description": "", "definition": "15.51", "templateType": "anything", "group": "Ungrouped variables", "name": "t95"}, "dfbb": {"description": "", "definition": "n-1", "templateType": "anything", "group": "Ungrouped variables", "name": "dfbb"}, "stderror": {"description": "", "definition": "precround(sqrt(rs/n),2)", "templateType": "anything", "group": "Ungrouped variables", "name": "stderror"}, "r": {"description": "", "definition": "list(transpose(matrix(r1)))", "templateType": "anything", "group": "Ungrouped variables", "name": "r"}, "tot": {"description": "", "definition": "sum(cols)", "templateType": "anything", "group": "Ungrouped variables", "name": "tot"}, "dfbt": {"description": "", "definition": "m-1", "templateType": "anything", "group": "Ungrouped variables", "name": "dfbt"}, "dfr": {"description": "", "definition": "m*n-m-n+1", "templateType": "anything", "group": "Ungrouped variables", "name": "dfr"}, "v": {"description": "", "definition": "switch(vr>=10.8,[1,0,0,0,0],vr>=5.95,[0,1,0,0,0],vr>=3.49,[0,0,1,0,0],vr>=2.61,[0,0,0,1,0],[0,0,0,0,1])", "templateType": "anything", "group": "Ungrouped variables", "name": "v"}, "n": {"description": "", "definition": "5", "templateType": "anything", "group": "Ungrouped variables", "name": "n"}, "r1": {"description": "", "definition": "map(repeat(round(normalsample(mu[x],sig)),5),x,0..m-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "r1"}, "tss": {"description": "", "definition": "precround(ssq-tot^2/(m*n),2)", "templateType": "anything", "group": "Ungrouped variables", "name": "tss"}, "tol": {"description": "", "definition": "0.01", "templateType": "anything", "group": "Ungrouped variables", "name": "tol"}, "msbt": {"description": "", "definition": "precround(btss/(m-1),2)", "templateType": "anything", "group": "Ungrouped variables", "name": "msbt"}, "rss": {"description": "", "definition": "tss-btss-bbss", "templateType": "anything", "group": "Ungrouped variables", "name": "rss"}, "rt": {"description": "", "definition": "list(transpose(matrix(r)))", "templateType": "anything", "group": "Ungrouped variables", "name": "rt"}, "mu": {"description": "", "definition": "[random(30..40),random(35..40),random(25..35),random(40..45),random(20..40)]", "templateType": "anything", "group": "Ungrouped variables", "name": "mu"}, "pvalue": {"description": "", "definition": "precround(ftest(VR,3,12),3)", "templateType": "anything", "group": "Ungrouped variables", "name": "pvalue"}, "sig": {"description": "", "definition": "random(3..7#0.2)", "templateType": "anything", "group": "Ungrouped variables", "name": "sig"}, "vr": {"description": "", "definition": "precround(msbt/rs,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "vr"}, "cols": {"description": "", "definition": "map(sum(rt[x]),x,0..m-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "cols"}, "t99": {"description": "", "definition": "20.09", "templateType": "anything", "group": "Ungrouped variables", "name": "t99"}, "msbb": {"description": "", "definition": "precround(bbss/(n-1),2)", "templateType": "anything", "group": "Ungrouped variables", "name": "msbb"}, "m": {"description": "", "definition": "4", "templateType": "anything", "group": "Ungrouped variables", "name": "m"}}, "functions": {}, "statement": "
To test the effectiveness of sun-tan creams, five volunteers A, B, C, D, E each tried four creams W, X, Y, Z on various parts of their legs. They were then subjected to ultra-violet radiation and an estimate of the degree of burning was made (higher figures indicate greater burning). The results are given below with some totals:
\n\n | W | \nX | \nY | \nZ | \nTotals | \n
A | \n{r[0][0]} | \n{r[0][1]} | \n{r[0][2]} | \n{r[0][3]} | \n{t[0]} | \n
B | \n{r[1][0]} | \n{r[1][1]} | \n{r[1][2]} | \n{r[1][3]} | \n{t[1]} | \n
C | \n{r[2][0]} | \n{r[2][1]} | \n{r[2][2]} | \n{r[2][3]} | \n{t[2]} | \n
D | \n{r[3][0]} | \n{r[3][1]} | \n{r[3][2]} | \n{r[3][3]} | \n{t[3]} | \n
E | \n{r[4][0]} | \n{r[4][1]} | \n{r[4][2]} | \n{r[4][3]} | \n{t[4]} | \n
Totals | \n{cols[0]} | \n{cols[1]} | \n{cols[2]} | \n{cols[3]} | \n{tot} | \n
You are given that $\\sum \\sum x^2=\\var{ssq}$ is the uncorrected sum of squares of the observations and you are asked to:
\n\n
", "question_groups": [{"pickingStrategy": "all-ordered", "name": "", "pickQuestions": 0, "questions": []}], "parts": [{"scripts": {}, "gaps": [{"scripts": {}, "showPrecisionHint": false, "minValue": "tss-tol", "marks": 1, "maxValue": "tss+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "btss-tol", "marks": 1, "maxValue": "btss+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "bbss-tol", "marks": 1, "maxValue": "bbss+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "rss-tol", "marks": 1, "maxValue": "rss+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}], "marks": 0, "type": "gapfill", "showCorrectAnswer": true, "prompt": "
Treatment totals are:
\n$T_1=\\var{cols[0]},\\;T_2=\\var{cols[1]},\\;T_3=\\var{cols[2]},\\;T_4=\\var{cols[3]}$
\nSubject totals are:
\n$B_1=\\var{t[0]},\\;B_2=\\var{t[1]},\\;B_3=\\var{t[2]},\\;B_4=\\var{t[3]},\\;B_5=\\var{t[4]}$
\n$\\sum \\sum x^2 = \\var{ssq}$ and $G= \\var{tot}$
\nNow using the above find the following, all to 2 decimal places:
\n$\\displaystyle TSS\\;=\\;$[[0]], $\\displaystyle BTSS\\;=\\;$[[1]]
\n$\\displaystyle BBSS \\;=\\;$[[2]], $\\displaystyle RSS\\;=\\;$[[3]]
\n(Find $RSS$ using the values to 2 decimal places for $TSS,\\;BTSS,\\;BBSS$.)
"}, {"scripts": {}, "gaps": [{"scripts": {}, "showPrecisionHint": false, "minValue": "m-1", "marks": 0.5, "maxValue": "m-1", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "btss-tol", "marks": 0.5, "maxValue": "btss+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "msbt-tol", "marks": 1, "maxValue": "msbt+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "vr-0.01", "marks": 1, "maxValue": "vr+0.01", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "n-1", "marks": 0.5, "maxValue": "n-1", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "bbss-tol", "marks": 0.5, "maxValue": "bbss+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "msbb-0.01", "marks": 1, "maxValue": "msbb+0.01", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "vrbb-0.01", "marks": 1, "maxValue": "vrbb+0.01", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "dfr", "marks": 0.5, "maxValue": "dfr", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "rss-tol", "marks": 0.5, "maxValue": "rss+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "rs-0.01", "marks": 1, "maxValue": "rs+0.01", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "m*n-1", "marks": 0.5, "maxValue": "m*n-1", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "tss-tol", "marks": 0.5, "maxValue": "tss+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}], "marks": 0, "type": "gapfill", "showCorrectAnswer": true, "prompt": "Now complete the ANOVA table using the values obtained to 2 decimal places above:
\n\n
Source | df | SS | MS | VR |
---|---|---|---|---|
Between Treatments | \n[[0]] | \n[[1]] | \n[[2]] | \n[[3]] | \n
Between Blocks | \n[[4]] | \n[[5]] | \n[[6]] | \n[[7]] | \n
Residual | \n[[8]] | \n[[9]] | \n[[10]] | \n- | \n
Total | \n[[11]] | \n[[12]] | \n- | \n- | \n
Input all numbers to 2 decimal places.
\nNote that VR is found by taking the ratio of two of the values in this table.
"}, {"scripts": {}, "matrix": "v", "displayColumns": 1, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "shuffleChoices": false, "prompt": "Give the value of $VR$ you have found, choose the range for the $p$ value by looking up the critical values of $F_{3,12}$ (one-sided).
\n$10\\%$ | \n$5\\%$ | \n$1\\%$ | \n$0.1\\%$ | \n
$2.61$ | \n$3.49$ | \n$5.95$ | \n$10.8$ | \n
$p$ less than $0.1\\%$
", "$p$ lies between $0.1\\%$ and $1\\%$
", "$p$ lies between $1 \\%$ and $5\\%$
", "$p$ lies between $5 \\%$ and $10\\%$
", "$p$ is greater than $10\\%$
"], "minMarks": 0}, {"scripts": {}, "matrix": "v", "displayColumns": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "shuffleChoices": false, "prompt": "Given the $p$-value and the range you have found, what is the strength of evidence against the null hypothesis that there is no difference in the treatments offered by the sun-creams?
", "distractors": ["", "", "", "", ""], "marks": 0, "displayType": "radiogroup", "choices": ["Very Strong Evidence
", "Strong Evidence
", "Evidence
", "Weak Evidence
", "No Evidence
"], "minMarks": 0}, {"scripts": {}, "matrix": "v", "displayColumns": 1, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "shuffleChoices": false, "prompt": "Hence what is your decision based on the above ANOVA analysis?
", "distractors": ["", "", "", "", ""], "marks": 0, "displayType": "radiogroup", "choices": ["We reject the null hypothesis at the $0.1\\%$ level", "We reject the null hypothesis at the $1\\%$ level.", "We reject the null hypothesis at the $5\\%$ level.", "We do not reject the null hypothesis but more investigation is needed.", "We do not reject the null hypothesis."], "minMarks": 0}, {"scripts": {}, "gaps": [{"scripts": {}, "showPrecisionHint": false, "minValue": "mean(r1[0])-tol", "marks": 0.5, "maxValue": "mean(r1[0])+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "mean(r1[1])-tol", "marks": 0.5, "maxValue": "mean(r1[1])+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "mean(r1[2])-tol", "marks": 0.5, "maxValue": "mean(r1[2])+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "mean(r1[3])-tol", "marks": 0.5, "maxValue": "mean(r1[3])+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}, {"scripts": {}, "showPrecisionHint": false, "minValue": "stderror-tol", "marks": 1, "maxValue": "stderror+tol", "type": "numberentry", "allowFractions": false, "showCorrectAnswer": true, "correctAnswerFraction": false}], "marks": 0, "type": "gapfill", "showCorrectAnswer": true, "prompt": "Enter the sample means for the sun-creams:
\nW: [[0]], X:[[1]], Y:[[2]], Z:[[3]]
\nAlso enter an estimate of the standard error of the mean: [[4]]
\n(Use the value to 2 decimal places you obtained above for $RMS$ to calculate the standard error of the mean).
"}], "metadata": {"description": "Two-way ANOVA example, 5 subjects, 4 treatments.
", "licence": "Creative Commons Attribution 4.0 International", "notes": ""}, "contributors": [{"name": "Patrice Behan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1791/"}]}]}], "contributors": [{"name": "Patrice Behan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1791/"}]}