// Numbas version: exam_results_page_options {"name": "Two factor ANOVA - SES", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "ungrouped_variables": ["w1", "w2", "w0", "f1l2", "f1l1", "f1ssq", "tol", "btss", "tss", "f1t", "w", "f2ssq", "f2t", "ssq", "vvr", "f1ss", "interactionss", "tsqovern", "mu4", "g", "mu2", "ss", "f1tsqovern", "f1rss", "f2l1", "f2l2", "stovern", "t", "f1stovern", "f2ss", "f2stovern"], "tags": [], "functions": {"dec": {"type": "string", "parameters": [["vr", "number"]], "definition": "switch(\n vr>=12.88, \n'Very strongly reject the null hypothesis ($p\\\\le 0.001$)',\n vr>=7.41,\n'Strongly reject the null hypothesis ($0.001 \\\\lt p \\\\le 0.01$)',\n vr>=4.12, \n'Reject the null hypothesis ($0.01 \\\\lt p \\\\le 0.05$)',\n vr>=2.86,\n'Accept the null hypothesis ($0.05 \\\\lt p \\\\le 0.1$)',\n 'Accept the null hypothesis ($p\\\\gt 0.1$)'\n) ", "language": "jme"}, "pstdev": {"type": "number", "parameters": [["l", "list"]], "definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "language": "jme"}}, "advice": "

We have two factors: {factor1_name} and {factor2_name}.

\n

{capitalise(factor1_name)} has two levels: {factor1_levels[0]} and {factor1_levels[1]}.

\n

{capitalise(factor2_name)} has two levels: {factor2_levels[0]} and {factor2_levels[1]}.

\n

First Step

\n

First regard the different treatment combinations as a set of independent samples and analyse as for a one-way analysis with unrelated measurements. From this analysis, we obtain the Total Sum of Squares, the Between Treatments Sum of Squares ($\\mathit{BTSS}$) and Residual Sum of Squares ($\\mathit{RSS}$). Note that the degrees of freedom for this step are $\\var{n-4} = \\var{n}-4$ as there are $4$ treatments.

\n

You should obtain

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 $\\overline{x_i}$$T_i$$\\sum x^2$$n_i$
{capitalise(factor1_levels[0])}, {factor2_levels[0]}$\\var{mean1}$$\\var{t[0]}$$\\var{ssq[0]}$$\\var{num_samples}$
{capitalise(factor1_levels[0])}, {factor2_levels[1]}$\\var{mean2}$$\\var{t[1]}$$\\var{ssq[1]}$$\\var{num_samples}$
{capitalise(factor1_levels[1])}, {factor2_levels[0]}$\\var{mean3}$$\\var{t[2]}$$\\var{ssq[2]}$$\\var{num_samples}$
{capitalise(factor1_levels[1])}, {factor2_levels[1]}$\\var{mean4}$$\\var{t[3]}$$\\var{ssq[3]}$$\\var{num_samples}$
  $G = \\var{g}$Sum of Squares = $\\var{ss}$$N=\\var{n}$
\n

From this we obtain:

\n

\\[ \\mathit{BTSS} = \\sum \\frac{T_i^2}{\\var{num_samples}} - \\frac{G^2}{\\var{n}} = \\frac{\\var{t[0]}^2}{\\var{num_samples}}+\\frac{\\var{t[1]}^2}{\\var{num_samples}}+\\frac{\\var{t[2]}^2}{\\var{num_samples}}+\\frac{\\var{t[3]}^2}{\\var{num_samples}}-\\frac{\\var{g}^2}{\\var{n}}=\\var{btss}\\]

\n

\\[\\mathit{TSS} = \\sum \\sum x^2- \\frac{G^2}{\\var{n}}=\\var{ss}- \\frac{\\var{g}^2}{\\var{n}}=\\var{tss} \\]

\n

both to 2 decimal places.

\n

\\[\\mathit{RSS} = \\mathit{TSS} - \\mathit{BTSS} = \\var{tss} - \\var{btss} = \\var{rss} \\]

\n

Second Step

\n

Now ignore the {factor2_name} factor and calculate totals $T_i$ for each level of {factor1_name}. From these totals calculate a variance estimate for {factor1_name} using the same method as before. The degrees of freedom will be one fewer than the number of levels of {factor2_name} and is therefore $1$.

\n

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
{capitalise(factor1_levels[0])} ({factor2_levels[0]} and {factor2_levels[1]})$\\var{r1[0]}$$\\var{r1[1]}$$\\var{r1[2]}$$\\var{r1[3]}$$\\var{r1[4]}$$\\var{r1[5]}$$\\var{r1[6]}$$\\var{r1[7]}$$\\var{r1[8]}$$\\var{r1[9]}$$\\var{r2[0]}$$\\var{r2[1]}$$\\var{r2[2]}$$\\var{r2[3]}$$\\var{r2[4]}$$\\var{r2[5]}$$\\var{r2[6]}$$\\var{r2[7]}$$\\var{r2[8]}$$\\var{r2[9]}$
{capitalise(factor1_levels[1])} ({factor2_levels[0]} and {factor2_levels[1]})$\\var{r3[0]}$$\\var{r3[1]}$$\\var{r3[2]}$$\\var{r3[3]}$$\\var{r3[4]}$$\\var{r3[5]}$$\\var{r3[6]}$$\\var{r3[7]}$$\\var{r3[8]}$$\\var{r3[9]}$$\\var{r3[0]}$$\\var{r4[1]}$$\\var{r4[2]}$$\\var{r4[3]}$$\\var{r4[4]}$$\\var{r4[5]}$$\\var{r4[6]}$$\\var{r4[7]}$$\\var{r4[8]}$$\\var{r4[9]}$
\n

You should produce the following data from this table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 $T_i$$\\sum x^2$$n_i$ (number of observations)
{capitalise(factor1_levels[0])} ({factor2_levels[0]} and {factor2_levels[1]})$\\var{f1t[0]}$$\\var{f1ssq[0]}$$\\var{2*num_samples}$
{capitalise(factor1_levels[1])} ({factor2_levels[0]} and {factor2_levels[1]})$\\var{f1t[1]}$$\\var{f1ssq[1]}$$\\var{2*num_samples}$
 $G = \\var{g}$Sum of Squares = $\\var{f1ss}$$N = \\var{n}$
\n

So we can calculate:

\n

\\[\\text{Variance estimate for }\\var{factor1_name} = \\sum \\frac{T_i^2}{\\var{2*num_samples}}- \\frac{G^2}{\\var{n}}=\\frac{\\var{f1t[0]}^2}{\\var{2*num_samples}}+\\frac{\\var{f1t[1]}^2}{\\var{2*num_samples}}-\\frac{\\var{g}^2}{\\var{n}}=\\var{f1btss}\\]

\n

Third Step

\n

Repeat step 2 with the factors switched, i.e. use the totals $T_i$ for the {factor2_name} factor levels, ignoring {factor1_name}. This gives a Between Treatments Sum of Squares. Again, the degrees of freedom will be one fewer than the number of levels of {factor1_name}, i.e. $2 - 1 = 1$.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
{capitalise(factor2_levels[0])} ({factor1_levels[0]} and {factor1_levels[1]})$\\var{r1[0]}$$\\var{r1[1]}$$\\var{r1[2]}$$\\var{r1[3]}$$\\var{r1[4]}$$\\var{r1[5]}$$\\var{r1[6]}$$\\var{r1[7]}$$\\var{r1[8]}$$\\var{r1[9]}$$\\var{r2[0]}$$\\var{r3[1]}$$\\var{r3[2]}$$\\var{r3[3]}$$\\var{r3[4]}$$\\var{r3[5]}$$\\var{r3[6]}$$\\var{r3[7]}$$\\var{r3[8]}$$\\var{r3[9]}$
{capitalise(factor2_levels[1])} ({factor1_levels[0]} and {factor1_levels[1]})$\\var{r2[0]}$$\\var{r2[1]}$$\\var{r2[2]}$$\\var{r2[3]}$$\\var{r2[4]}$$\\var{r2[5]}$$\\var{r2[6]}$$\\var{r2[7]}$$\\var{r2[8]}$$\\var{r2[9]}$$\\var{r4[0]}$$\\var{r4[1]}$$\\var{r4[2]}$$\\var{r4[3]}$$\\var{r4[4]}$$\\var{r4[5]}$$\\var{r4[6]}$$\\var{r4[7]}$$\\var{r4[8]}$$\\var{r4[9]}$
\n

You should obtain the following data from this table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 $T_i$$\\sum x^2$$n_i$ (number of observations)
{capitalise(factor2_levels[0])} ({factor1_levels[0]} and {factor1_levels[1]})$\\var{f2t[0]}$$\\var{f2ssq[0]}$$\\var{2*num_samples}$
{capitalise(factor2_levels[1])} ({factor1_levels[0]} and {factor1_levels[1]})$\\var{f2t[1]}$$\\var{f2ssq[1]}$$\\var{2*num_samples}$
 $G = \\var{g}$Sum of Squares = $\\var{f2ss}$$N = \\var{n}$
\n

So we can calculate:

\n

\\[ \\text{Variance estimate for }\\var{factor2_name} = \\sum \\frac{T_i^2}{\\var{2*num_samples}}- \\frac{G^2}{\\var{n}}=\\frac{\\var{f2t[0]}^2}{\\var{2*num_samples}}+\\frac{\\var{f2t[1]}^2}{\\var{2*num_samples}}-\\frac{\\var{g}^2}{\\var{n}}=\\var{f2btss}\\]

\n

Fourth Step

\n

Now determine a Sum of Squares for Interaction by subtracting the sums of squares obtained for {factor1_name} (Step 2) and {factor2_name} (step 3) from the overall Between Treatments Sum of squares obtained in Step 1. The degrees of freedom is also obtained by subtraction and is 1.

\n

This gives: 

\n

\\[\\text{Variance estimate for the interaction}= \\var{btss}-\\var{f1btss}-\\var{f2btss} = \\var{interactionss}\\]

\n

The ANOVA Table

\n

We now have all the terms required to construct the ANOVA table and hence test the null hypothesis relating to each factor and to the interaction. Note that the $\\mathit{VR}$ values are obtained by dividing the $\\mathit{RMS}$ value into the $\\mathit{MS}$ values for the factors and the interaction.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
SourcedfSSMSVRDecision
{capitalise(factor1_name)}$1$$\\var{f1btss}$$\\var{f1btss}$$\\var{f1vr}${dec(f1vr)} that {measurement_name} is independent of {factor1_name}.
{capitalise(factor2_name)}$1$$\\var{f2btss}$$\\var{f2btss}$$\\var{f2vr}${dec(f2vr)} that {measurement_name} is independent of {factor2_name}.
Interaction$1$$\\var{interactionss}$$\\var{interactionss}$$\\var{ivr}${dec(ivr)} that {factor1_name} and {factor2_name} are independent in terms of {measurement_name}.
Residual$\\var{n-4}$$\\var{rss}$$\\var{mrs}$- 
Total$\\var{n-1}$$\\var{precround(f1btss+f2btss+interactionss+rss,2)}$-- 
", "parts": [{"prompt": "

Now complete the following two factor ANOVA table from this data. Input the $\\mathit{MS}$ and $\\mathit{VR}$ data to 2 decimal places.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
SourcedfSSMSVR
{capitalise(factor1_name)}[[0]]{f1btss}[[1]][[2]]
{capitalise(factor2_name)}[[3]]{f2btss}[[4]][[5]]
Interaction[[6]]{interactionss}[[7]][[8]]
Residual[[9]]{rss}[[10]]-
Total[[11]]{precround(f1btss+f2btss+interactionss+rss,2)}--
\n

The Calculations

\n
    \n
  1. For {factor1_name}, {factor2_name} and Interaction, calculate the estimations of their variances to 2 decimal places as well. These values go in the $\\mathit{MS}$ column.
  2. \n
  3. The $\\mathit{VR}$ values are obtained by dividing the first three values in the $\\mathit{MS}$ column by the $\\mathit{RMS}$ value. Enter the $\\mathit{VR}$ values to 2 decimal places in the last column.
  4. \n
\n

Also input the mean values of the factors at their various levels:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 $\\overline{x_i}$
{capitalise(factor1_levels[0])}, {factor2_levels[0]}[[12]]
{capitalise(factor1_levels[0])}, {factor2_levels[1]}[[13]]
{capitalise(factor1_levels[1])}, {factor2_levels[0]}[[14]]
{capitalise(factor1_levels[1])}, {factor2_levels[1]}[[15]]
", "sortAnswers": false, "showFeedbackIcon": true, "scripts": {}, "marks": 0, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "type": "gapfill", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "gaps": [{"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.25, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "1", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "1", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.5, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "f1btss-tol", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "f1btss+tol", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.5, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "f1vr-tol", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "f1vr+tol", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.25, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "1", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "1", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.5, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "f2btss-tol", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "f2btss+tol", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.5, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "f2vr-tol", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "f2vr+tol", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.25, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "1", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "1", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.5, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "interactionss-tol", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "interactionss+tol", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.5, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "ivr-tol", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "ivr+tol", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.25, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "n-4", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "n-4", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.5, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "mrs-tol", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "mrs+tol", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.5, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "n-1", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "n-1", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.5, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "mean1", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "mean1", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.5, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "mean2", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "mean2", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.5, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "mean3", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "mean3", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}, {"showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "marks": 0.5, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "minValue": "mean4", "customMarkingAlgorithm": "", "type": "numberentry", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "mustBeReducedPC": 0, "maxValue": "mean4", "unitTests": [], "allowFractions": false, "variableReplacements": [], "correctAnswerFraction": false}], "unitTests": [], "variableReplacements": []}, {"prompt": "

Using the following $p$-values for the $F_{1,36}$ statistic find the appropriate significance levels for the factors as given by their $\\mathit{VR}$ value and then comment on the null hypotheses for each factor and the interaction. 

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$10\\%$$5\\%$$1\\%$$0.1\\%$
$2.86$$4.12$$7.41$$12.88$
\n

[[0]]

", "sortAnswers": false, "showFeedbackIcon": true, "scripts": {}, "marks": 0, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "type": "gapfill", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "gaps": [{"displayType": "radiogroup", "showFeedbackIcon": true, "marks": 0, "variableReplacementStrategy": "originalfirst", "matrix": "w", "answers": ["Very strong rejection, $p \\le 0.001$.", "Strong rejection, $0.001\\lt p \\le 0.01$.", "Rejection, $0.01\\lt p \\le 0.05$.", "Accept, but investigate, $0.05\\lt p \\le 0.1$.", "Accept, $p \\gt 0.1$."], "showCellAnswerState": true, "minAnswers": 0, "choices": ["{measurement_name}: no dependence upon {factor1_name}.", "{measurement_name}: no dependence upon {factor2_name}.", "No interaction between the factors."], "scripts": {}, "maxMarks": 0, "warningType": "none", "customMarkingAlgorithm": "", "type": "m_n_x", "layout": {"type": "all", "expression": ""}, "maxAnswers": 0, "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacements": [], "minMarks": 0, "unitTests": [], "shuffleChoices": false, "shuffleAnswers": false}], "unitTests": [], "variableReplacements": []}], "metadata": {"description": "

Template question. The student is asked to perform a two factor ANOVA to test the null hypotheses that the measurement does not depend on each of the factors, and that there is no interaction between the factors.

", "licence": "Creative Commons Attribution 4.0 International"}, "variables": {"r2": {"definition": "repeat(round(normalsample(mu2,sig2)),num_samples)", "description": "", "group": "Sample data", "templateType": "anything", "name": "r2"}, "tsqovern": {"definition": "map(x^2/num_samples,x,t)", "description": "

$t^2/n$

", "group": "Ungrouped variables", "templateType": "anything", "name": "tsqovern"}, "t": {"definition": "[sum(r1),sum(r2),sum(r3),sum(r4)]", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "t"}, "ssq": {"definition": "[sum(map(x^2,x,r1)),sum(map(x^2,x,r2)),sum(map(x^2,x,r3)),sum(map(x^2,x,r4))]", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "ssq"}, "f1stovern": {"definition": "sum(f1tsqovern)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f1stovern"}, "n": {"definition": "4*num_samples", "description": "

The total number of measurements across all the samples

", "group": "Statistics", "templateType": "anything", "name": "n"}, "ivr": {"definition": "precround(interactionss/mrs,2)", "description": "", "group": "Statistics", "templateType": "anything", "name": "ivr"}, "f2l1": {"definition": "r1+r3", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f2l1"}, "f1btss": {"definition": "precround(f1stovern-g^2/40,2)", "description": "

Between treatments sum of square ($\\mathit{BTSS}$) of Factor 1

", "group": "Statistics", "templateType": "anything", "name": "f1btss"}, "r4": {"definition": "repeat(round(normalsample(mu4,sig1)),num_samples)", "description": "", "group": "Sample data", "templateType": "anything", "name": "r4"}, "g": {"definition": "sum(t)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "g"}, "mu3": {"definition": "random(22..26#0.5)", "description": "

The population mean of sample 3

", "group": "Editable variables", "templateType": "randrange", "name": "mu3"}, "r1": {"definition": "repeat(round(normalsample(mu1,sig1)),num_samples)", "description": "", "group": "Sample data", "templateType": "anything", "name": "r1"}, "f1vr": {"definition": "precround(f1btss/mrs,2)", "description": "

Variance ratio ($\\mathit{VR}$) of Factor 1

", "group": "Statistics", "templateType": "anything", "name": "f1vr"}, "rss": {"definition": "precround(ss-stovern,2)", "description": "", "group": "Statistics", "templateType": "anything", "name": "rss"}, "tol": {"definition": "0.001", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "tol"}, "factor2_name": {"definition": "\"stimulus\"", "description": "

The name of Factor 2

", "group": "Editable variables", "templateType": "string", "name": "factor2_name"}, "f2t": {"definition": "[sum(f2L1),sum(f2L2)]", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f2t"}, "sig1": {"definition": "random(2..3#0.2)", "description": "

Standard deviation in samples 1, 3 and 4.

", "group": "Editable variables", "templateType": "randrange", "name": "sig1"}, "f1t": {"definition": "[sum(f1L1),sum(f1L2)]", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f1t"}, "mrs": {"definition": "precround(RSS/36,2)", "description": "", "group": "Statistics", "templateType": "anything", "name": "mrs"}, "vvr": {"definition": "[f1vr,f2vr,ivr]", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "vvr"}, "mean2": {"definition": "precround(mean(r2),2)", "description": "

Sample mean of sample 2

", "group": "Statistics", "templateType": "anything", "name": "mean2"}, "mu1": {"definition": "random(13..17#0.5)", "description": "

The population mean of sample 1

", "group": "Editable variables", "templateType": "randrange", "name": "mu1"}, "mu2": {"definition": "mu1-mu2_diff", "description": "

The population mean of sample 2

", "group": "Ungrouped variables", "templateType": "anything", "name": "mu2"}, "f2ss": {"definition": "sum(f2ssq)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f2ss"}, "mean4": {"definition": "precround(mean(r4),2)", "description": "

Sample mean of sample 4

", "group": "Statistics", "templateType": "anything", "name": "mean4"}, "mu4_diff": {"definition": "random(5..7#0.2)", "description": "

Difference between the population means of samples 3 and 4 (mu3 and mu4)

", "group": "Editable variables", "templateType": "randrange", "name": "mu4_diff"}, "f2l2": {"definition": "r2+r4", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f2l2"}, "f2stovern": {"definition": "sum([f2t[0]^2/20,f2t[1]^2/20])", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f2stovern"}, "f1ss": {"definition": "sum(f1ssq)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f1ss"}, "num_samples": {"definition": "10", "description": "

The number of measurements in each sample.

", "group": "Editable variables", "templateType": "number", "name": "num_samples"}, "mu4": {"definition": "mu3-mu4_diff", "description": "

Population mean of sample 4

", "group": "Ungrouped variables", "templateType": "anything", "name": "mu4"}, "interactionss": {"definition": "btss-f1btss-f2btss", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "interactionss"}, "factor1_name": {"definition": "\"personality\"", "description": "

The name of Factor 1

", "group": "Editable variables", "templateType": "string", "name": "factor1_name"}, "w": {"definition": "[w0,w1,w2]", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "w"}, "mean1": {"definition": "precround(mean(r1),2)", "description": "

Sample mean of sample 1

", "group": "Statistics", "templateType": "anything", "name": "mean1"}, "tss": {"definition": "precround(ss-G^2/N,2)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "tss"}, "factor2_levels": {"definition": "[ \"placebo\", \"anti-perspirant\" ]", "description": "

The names of the levels of Factor 2

", "group": "Editable variables", "templateType": "list of strings", "name": "factor2_levels"}, "f2vr": {"definition": "precround(f2btss/mrs,2)", "description": "

Variance ratio ($\\mathit{VR}$) of Factor 1

", "group": "Statistics", "templateType": "anything", "name": "f2vr"}, "f1l2": {"definition": "r3+r4", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f1l2"}, "w1": {"definition": "switch(vvr[1]>=12.88,[1,0,0,0,0],vvr[1]>=7.41,[0,1,0,0,0],vvr[1]>=4.12,[0,0,1,0,0],vvr[1]>=2.86,[0,0,0,1,0],[0,0,0,0,1])", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "w1"}, "w2": {"definition": "switch(vvr[2]>=12.88,[1,0,0,0,0],vvr[2]>=7.41,[0,1,0,0,0],vvr[2]>=4.12,[0,0,1,0,0],vvr[2]>=2.86,[0,0,0,1,0],[0,0,0,0,1])", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "w2"}, "f2ssq": {"definition": "[sum(map(x^2,x,f2L1)),sum(map(x^2,x,f2L2))]", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f2ssq"}, "w0": {"definition": "switch(vvr[0]>=12.88,[1,0,0,0,0],vvr[0]>=7.41,[0,1,0,0,0],vvr[0]>=4.12,[0,0,1,0,0],vvr[0]>=2.86,[0,0,0,1,0],[0,0,0,0,1])", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "w0"}, "btss": {"definition": "precround(stovern-G^2/N,2)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "btss"}, "f1l1": {"definition": "r1+r2", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f1l1"}, "f1tsqovern": {"definition": "[f1t[0]^2/20,f1t[1]^2/20]", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f1tsqovern"}, "f2btss": {"definition": "precround(f2stovern-g^2/40,2)", "description": "

Between treatments sum of squares ($\\mathit{BTSS}$) of Factor 1

", "group": "Statistics", "templateType": "anything", "name": "f2btss"}, "f1rss": {"definition": "precround(f1ss-f1stovern,2)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f1rss"}, "sig2": {"definition": "random(2..3#0.2)", "description": "

Standard deviation in sample 2.

", "group": "Editable variables", "templateType": "randrange", "name": "sig2"}, "ss": {"definition": "sum(ssq)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "ss"}, "r3": {"definition": "repeat(round(normalsample(mu3,sig1)),num_samples)", "description": "", "group": "Sample data", "templateType": "anything", "name": "r3"}, "f1ssq": {"definition": "[sum(map(x^2,x,f1L1)),sum(map(x^2,x,f1L2))]", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "f1ssq"}, "stovern": {"definition": "sum(tsqovern)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "stovern"}, "factor1_levels": {"definition": "[ \"non-sufferer\", \"sufferer\" ]", "description": "

Names of the levels of Factor 1

", "group": "Editable variables", "templateType": "list of strings", "name": "factor1_levels"}, "mean3": {"definition": "precround(mean(r3),2)", "description": "

Sample mean of sample 3

", "group": "Statistics", "templateType": "anything", "name": "mean3"}, "measurement_name": {"definition": "\"GM\"", "description": "

The name of the value being measured.

", "group": "Editable variables", "templateType": "string", "name": "measurement_name"}, "mu2_diff": {"definition": "random(2..3#0.2)", "description": "

Difference between the population means of samples 1 and 2 (mu1 and mu2)

", "group": "Editable variables", "templateType": "randrange", "name": "mu2_diff"}}, "variable_groups": [{"variables": ["measurement_name", "factor1_name", "factor1_levels", "factor2_name", "factor2_levels", "mu1", "mu2_diff", "mu3", "mu4_diff", "sig1", "sig2", "num_samples"], "name": "Editable variables"}, {"variables": ["r1", "r2", "r3", "r4"], "name": "Sample data"}, {"variables": ["n", "f1btss", "f1vr", "f2btss", "f2vr", "ivr", "rss", "mrs", "mean1", "mean2", "mean3", "mean4"], "name": "Statistics"}], "name": "Two factor ANOVA - SES", "extensions": ["stats"], "statement": "

Individuals who are identified as having hyperhidrosis suffer from excess sweating. This can be a problem for sport climbers who rely on dry hands for gripping climbing holds. One way to alleviate the problem may be a hand anti-perspirant.

\n

Sweating can be quantified using a \"gravimetric measurement\" (GM), which measures the rate of sweat production in mg/min, by measuring the change in weight of an absorbant paper placed in the palm of an individual's hand.

\n

The following data represent the results of an experiment to compare the responses of individuals considered to be sufferers or non-sufferers, who have been given a hand anti-perspirant or placebo.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
{capitalise(factor1_name)}{capitalise(factor2_name)}Gravimetric Measurement (GM), in mg/min
{capitalise(factor1_levels[0])}{capitalise(factor2_levels[0])}$\\var{r1[0]}$$\\var{r1[1]}$$\\var{r1[2]}$$\\var{r1[3]}$$\\var{r1[4]}$$\\var{r1[5]}$$\\var{r1[6]}$$\\var{r1[7]}$$\\var{r1[8]}$$\\var{r1[9]}$
{capitalise(factor2_levels[1])}$\\var{r2[0]}$$\\var{r2[1]}$$\\var{r2[2]}$$\\var{r2[3]}$$\\var{r2[4]}$$\\var{r2[5]}$$\\var{r2[6]}$$\\var{r2[7]}$$\\var{r2[8]}$$\\var{r2[9]}$
{capitalise(factor1_levels[1])}{capitalise(factor2_levels[0])}$\\var{r3[0]}$$\\var{r3[1]}$$\\var{r3[2]}$$\\var{r3[3]}$$\\var{r3[4]}$$\\var{r3[5]}$$\\var{r3[6]}$$\\var{r3[7]}$$\\var{r3[8]}$$\\var{r3[9]}$
{capitalise(factor2_levels[1])}$\\var{r4[0]}$$\\var{r4[1]}$$\\var{r4[2]}$$\\var{r4[3]}$$\\var{r4[4]}$$\\var{r4[5]}$$\\var{r4[6]}$$\\var{r4[7]}$$\\var{r4[8]}$$\\var{r4[9]}$
\n

Carry out a two factor ANOVA on the data to test the following null hypotheses:

\n
    \n
  1. {capitalise(measurement_name)} does not depend upon {factor1_name}.
  2. \n
  3. {capitalise(measurement_name)} does not depend upon {factor2_name}.
  4. \n
  5. There is no interaction between {factor1_name} and {factor2_name} in determining {measurement_name}.
  6. \n
", "variablesTest": {"condition": "", "maxRuns": 100}, "preamble": {"css": "td, th {\n empty-cells:hide;\n}", "js": ""}, "type": "question", "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}]}]}], "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}]}