// Numbas version: finer_feedback_settings {"name": "LSD and Tukey yardsticks, and two-way ANOVA", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "variables": {"btss": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sum(map(x^2,x,cols))/n-tot^2/(m*n),2)", "name": "btss", "description": ""}, "sig": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(3..7#0.2)", "name": "sig", "description": ""}, "r1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(repeat(round(normalsample(mu[x],sig)),5),x,0..m-1)", "name": "r1", "description": ""}, "v": {"templateType": "anything", "group": "Ungrouped variables", "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])", "name": "v", "description": ""}, "v1": {"templateType": "anything", "group": "Ungrouped variables", "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])", "name": "v1", "description": ""}, "ssq": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sum(map(sum(map(x^2,x,r[y])),y,0..n-1))", "name": "ssq", "description": ""}, "vrbb": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(msbb/rs,2)", "name": "vrbb", "description": ""}, "t90": {"templateType": "anything", "group": "Ungrouped variables", "definition": "13.36", "name": "t90", "description": ""}, "tss": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(ssq-tot^2/(m*n),2)", "name": "tss", "description": ""}, "mu": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[random(30..40),random(35..40),random(25..35),random(40..45),random(20..40)]", "name": "mu", "description": ""}, "rs": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(rss/dfr,2)", "name": "rs", "description": ""}, "w6": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(abs(me[2]-me[3])>=tukey,[1,0,0],abs(me[2]-me[3])>=lsd,[0,1,0],[0,0,1])", "name": "w6", "description": ""}, "dfbt": {"templateType": "anything", "group": "Ungrouped variables", "definition": "m-1", "name": "dfbt", "description": ""}, "msbt": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(btss/(m-1),2)", "name": "msbt", "description": ""}, "w4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(abs(me[1]-me[2])>=tukey,[1,0,0],abs(me[1]-me[2])>=lsd,[0,1,0],[0,0,1])", "name": "w4", "description": ""}, "bbss": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sum(map(x^2,x,t))/m-tot^2/20,2)", "name": "bbss", "description": ""}, "lsd": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(2.179*sqrms*sqrt(2/5),2)", "name": "lsd", "description": ""}, "w5": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(abs(me[1]-me[3])>=tukey,[1,0,0],abs(me[1]-me[3])>=lsd,[0,1,0],[0,0,1])", "name": "w5", "description": ""}, "vr": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(msbt/rs,2)", "name": "vr", "description": ""}, "cols": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(sum(rt[x]),x,0..m-1)", "name": "cols", "description": ""}, "w1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(abs(me[0]-me[1])>=tukey,[1,0,0],abs(me[0]-me[1])>=lsd,[0,1,0],[0,0,1])", "name": "w1", "description": ""}, "pvalue": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(ftest(VR,3,12),3)", "name": "pvalue", "description": ""}, "tot": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sum(cols)", "name": "tot", "description": ""}, "dfr": {"templateType": "anything", "group": "Ungrouped variables", "definition": "m*n-m-n+1", "name": "dfr", "description": ""}, "tukey": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(4.2*sqrms*sqrt(1/5),2)", "name": "tukey", "description": ""}, "w": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[w1,w2,w3,w4,w5,w6]", "name": "w", "description": ""}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "4", "name": "m", "description": ""}, "msbb": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(bbss/(n-1),2)", "name": "msbb", "description": ""}, "dfbb": {"templateType": "anything", "group": "Ungrouped variables", "definition": "n-1", "name": "dfbb", "description": ""}, "w3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(abs(me[0]-me[3])>=tukey,[1,0,0],abs(me[0]-me[3])>=lsd,[0,1,0],[0,0,1])", "name": "w3", "description": ""}, "sqrms": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sqrt(rs),2)", "name": "sqrms", "description": ""}, "t99": {"templateType": "anything", "group": "Ungrouped variables", "definition": "20.09", "name": "t99", "description": ""}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.01", "name": "tol", "description": ""}, "t95": {"templateType": "anything", "group": "Ungrouped variables", "definition": "15.51", "name": "t95", "description": ""}, "w2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(abs(me[0]-me[2])>=tukey,[1,0,0],abs(me[0]-me[2])>=lsd,[0,1,0],[0,0,1])", "name": "w2", "description": ""}, "yn": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(map(yeaornay(x),x,w[z]),z,0..5)", "name": "yn", "description": ""}, "r": {"templateType": "anything", "group": "Ungrouped variables", "definition": "list(transpose(matrix(r1)))", "name": "r", "description": ""}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "5", "name": "n", "description": ""}, "me": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(mean(r1[x]),x,0..3)", "name": "me", "description": ""}, "stderror": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sqrt(rs/n),2)", "name": "stderror", "description": ""}, "rt": {"templateType": "anything", "group": "Ungrouped variables", "definition": "list(transpose(matrix(r)))", "name": "rt", "description": ""}, "rss": {"templateType": "anything", "group": "Ungrouped variables", "definition": "tss-btss-bbss", "name": "rss", "description": ""}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(sum(r[x]),x,0..n-1)", "name": "t", "description": ""}}, "ungrouped_variables": ["lsd", "tukey", "stderror", "bbss", "cols", "vrbb", "w6", "vr", "w4", "w3", "w2", "w1", "dfr", "rt", "rs", "t90", "tot", "sqrms", "sig", "tol", "btss", "tss", "dfbt", "yn", "msbt", "ssq", "v1", "dfbb", "t99", "t95", "msbb", "rss", "me", "r1", "m", "w5", "n", "mu", "r", "t", "w", "v", "pvalue"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "name": "LSD and Tukey yardsticks, and two-way ANOVA", "functions": {"yeaornay": {"type": "string", "language": "jme", "definition": "if(n=1, \"Yes\", \"No\")", "parameters": [["n", "number"]]}}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "sqrms-tol", "maxValue": "sqrms+tol", "marks": 1}], "type": "gapfill", "prompt": "
Here is the ANOVA table corresponding to this data:
\n\n
Source | df | SS | MS | VR |
---|---|---|---|---|
Between Treatments | \n$\\var{m-1}$ | \n$\\var{btss}$ | \n$\\var{msbt}$ | \n$\\var{vr}$ | \n
Between Blocks | \n$\\var{n-1}$ | \n$\\var{bbss}$ | \n$\\var{msbb}$ | \n$\\var{vrbb}$ | \n
Residual | \n$\\var{dfr}$ | \n$\\var{rss}$ | \n$\\var{rs}$ | \n- | \n
Total | \n$\\var{m*n-1}$ | \n$\\var{tss}$ | \n- | \n- | \n
Input $\\sqrt{RMS}$ here: [[0]] to 2 decimal places.
\nThis will be used later to calculate the yardsticks.
", "showCorrectAnswer": true, "marks": 0}, {"displayType": "radiogroup", "choices": ["$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\\%$
"], "displayColumns": 1, "prompt": "Given the value of $VR$ in the table above, find 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
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": ["", "", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "v", "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."], "displayColumns": 1, "prompt": "Hence what is your decision based on the above ANOVA analysis?
", "distractors": ["", "", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "v", "marks": 0}, {"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "me[0]-tol", "maxValue": "me[0]+tol", "marks": 0.5}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "me[1]-tol", "maxValue": "me[1]+tol", "marks": 0.5}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "me[2]-tol", "maxValue": "me[2]+tol", "marks": 0.5}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "me[3]-tol", "maxValue": "me[3]+tol", "marks": 0.5}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "lsd-tol", "maxValue": "lsd+tol", "marks": 1}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "tukey-tol", "maxValue": "tukey+tol", "marks": 1}], "type": "gapfill", "prompt": "Using the yardsticks
\nEnter the sample means for the sun-creams:
\nW: [[0]], X:[[1]], Y:[[2]], Z:[[3]] (to 2 decimal places).
\nCalclate the LSD and Tukey yardsticks using the value for $\\sqrt{RMS}$ to 2 decimal places obtained above.
\n\n
LSD yardstick value = [[4]] (to 2 decimal places).
\n\n
Tukey yardstick value = [[5]] (to 2 decimal places).
\n", "showCorrectAnswer": true, "marks": 0}, {"layout": {"expression": ""}, "choices": ["$W$ and $X$", "$W$ and $Y$", "$W$ and $Z$", "$X$ and $Y$", "$X$ and $Z$", "$Y$ and $Z$"], "matrix": "w", "prompt": "
Using these yardsticks fill in the following table indicating if there is a possible or definite significant difference between the sample means of pairs of sun-creams.
\n", "type": "m_n_x", "maxAnswers": 0, "shuffleChoices": false, "marks": 0, "scripts": {}, "maxMarks": 0, "minAnswers": 0, "minMarks": 0, "shuffleAnswers": false, "showCorrectAnswer": true, "answers": ["Definite Significant Difference", "Possible Significant Difference", "No Significant Difference"]}], "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
\n
\n
LSD and Tukey yardsticks on five treatments. Also two-way Anova test on same set of data.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "The mean values for each sun-cream are:
\n\n
\n | $\\overline{x}_i$ | \n
W | \n$\\var{me[0]}$ | \n
---|---|
X | \n$\\var{me[1]}$ | \n
Y | \n$\\var{me[2]}$ | \n
Z | \n$\\var{me[3]}$ | \n
The differences between the mean values for the sun-creams are:
\nBetween $W$ and $X=\\;|\\var{me[0]}-\\var{me[1]}|=\\var{abs(me[0]-me[1])}$
\nBetween $W$ and $Y=\\;|\\var{me[0]}-\\var{me[2]}|=\\var{abs(me[0]-me[2])}$
\nBetween $W$ and $Z=\\;|\\var{me[0]}-\\var{me[3]}|=\\var{abs(me[0]-me[3])}$
\nBetween $X$ and $Y=\\;|\\var{me[1]}-\\var{me[2]}|=\\var{abs(me[1]-me[2])}$
\nBetween $X$ and $Z=\\;|\\var{me[1]}-\\var{me[3]}|=\\var{abs(me[1]-me[3])}$
\nBetween $Y$ and $Z=\\;|\\var{me[2]}-\\var{me[3]}|=\\var{abs(me[2]-me[3])}$
\nWe compare these differences with the LSD and Tukey yardsticks:
\nLSD yardstick = $2.179\\times\\var{sqrms}\\times\\sqrt{2/\\var{n}}=\\var{lsd}$ to 2 decimal places, where $\\var{sqrms}$ is the value of $\\sqrt{RMS}$ found above.
\nTukey yardstick = $4.2\\times\\var{sqrms}\\times\\sqrt{1/\\var{n}}=\\var{tukey}$ to 2 decimal places.
\nIf the difference of the means:
\n\n
\n
\n
Hence we have the following for the sun-creams:
\nPairs of Sun-creams | Definite Significant Difference | Possible Significant Difference | No Significant Difference |
---|---|---|---|
Means of W and X | \n{yn[0][0]} | \n{yn[0][1]} | \n{yn[0][2]} | \n
Means of W and Y | \n{yn[1][0]} | \n{yn[1][1]} | \n{yn[1][2]} | \n
Means of W and Z | \n{yn[2][0]} | \n{yn[2][1]} | \n{yn[2][2]} | \n
Means of X and Y | \n{yn[3][0]} | \n{yn[3][1]} | \n{yn[3][2]} | \n
Means of X and Z | \n{yn[4][0]} | \n{yn[4][1]} | \n{yn[4][2]} | \n
Means of Y and Z | \n{yn[5][0]} | \n{yn[5][1]} | \n{yn[5][2]} | \n