// Numbas version: exam_results_page_options {"name": "Two factor ANOVA", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {"dec": {"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) ", "type": "string", "parameters": [["vr", "number"]], "language": "jme"}, "pstdev": {"definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "type": "number", "parameters": [["l", "list"]], "language": "jme"}}, "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"], "name": "Two factor ANOVA", "tags": ["ANOVA", "average", "chain rule", "degrees of freedom", "F-test", "factors", "Factors", "levels", "mean", "p values", "statistics", "template", "two factor ANOVA", "variance"], "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)}$-- 
", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "

Now complete the following two factor ANOVA table from this data. Input the $\\mathit{SS}$, $\\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
SourcedfSSMSVR
{capitalise(factor1_name)}[[0]][[1]][[2]][[3]]
{capitalise(factor2_name)}[[4]][[5]][[6]][[7]]
Interaction[[8]][[9]][[10]][[11]]
Residual[[12]][[13]][[14]]-
Total[[15]][[16]]--
\n

The Calculations

\n
    \n
  1. Residual Calculations. When you are calculating $\\mathit{TSS}$ and $\\mathit{BTSS}$, round them both to 2 decimal places, then calculate $\\mathit{RSS}$ by taking away these rounded values. The $\\mathit{RMS}$ value is then obtained by dividing this $\\mathit{RSS}$ value by the residual degrees of freedom.
  2. \n
  3. 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.
  4. \n
  5. 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.
  6. \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
 $\\overline{x_i}$
{capitalise(factor1_levels[0])}, {factor2_levels[0]}[[17]]
{capitalise(factor1_levels[0])}, {factor2_levels[1]}[[18]]
{capitalise(factor1_levels[1])}, {factor2_levels[0]}[[19]]
{capitalise(factor1_levels[1])}, {factor2_levels[1]}[[20]]
", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"allowFractions": false, "variableReplacements": [], "maxValue": "1", "minValue": "1", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.25, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "f1btss+tol", "minValue": "f1btss-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "f1btss+tol", "minValue": "f1btss-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "f1vr+tol", "minValue": "f1vr-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "1", "minValue": "1", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.25, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "f2btss+tol", "minValue": "f2btss-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "f2btss+tol", "minValue": "f2btss-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "f2vr+tol", "minValue": "f2vr-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "1", "minValue": "1", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.25, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "interactionss+tol", "minValue": "interactionss-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "interactionss+tol", "minValue": "interactionss-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "ivr+tol", "minValue": "ivr-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "n-4", "minValue": "n-4", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.25, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "rss+tol", "minValue": "rss-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "mrs+tol", "minValue": "mrs-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "n-1", "minValue": "n-1", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "precround(f1btss+f2btss+interactionss+rss,2)+tol", "minValue": "precround(f1btss+f2btss+interactionss+rss,2)-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "mean1", "minValue": "mean1", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "mean2", "minValue": "mean2", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "mean3", "minValue": "mean3", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "mean4", "minValue": "mean4", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"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]]

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"maxAnswers": 0, "shuffleChoices": false, "matrix": "w", "shuffleAnswers": false, "minAnswers": 0, "variableReplacements": [], "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$."], "choices": ["{measurement_name}: no dependence upon {factor1_name}.", "{measurement_name}: no dependence upon {factor2_name}.", "No interaction between the factors."], "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "maxMarks": 0, "scripts": {}, "marks": 0, "showCorrectAnswer": true, "type": "m_n_x", "minMarks": 0, "layout": {"expression": ""}}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "statement": "

Individuals who are identified as having an antisocial personality disorder may also have reduced physiological responses to anxiety-producing stimuli.

\n

One way of measuring this response is with ”galvanic skin response” (GSR), a measurable reduction in the electrical resistance on the skin. (This is the basis of how a lie detector works.)

\n

The following data represent the results of an experiment to compare the responses of normal and antisocial individuals in regular (baseline) and stress-provoking situations (low score reflects a more anxious individual). 

\n

{capitalise(factor1_name)}{capitalise(factor2_name)}

\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_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
", "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"}], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "td, th {\n empty-cells:hide;\n}", "js": ""}, "variables": {"mean4": {"definition": "precround(mean(r4),2)", "templateType": "anything", "group": "Statistics", "name": "mean4", "description": "

Sample mean of sample 4

"}, "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])", "templateType": "anything", "group": "Ungrouped variables", "name": "w1", "description": ""}, "mean2": {"definition": "precround(mean(r2),2)", "templateType": "anything", "group": "Statistics", "name": "mean2", "description": "

Sample mean of sample 2

"}, "mean3": {"definition": "precround(mean(r3),2)", "templateType": "anything", "group": "Statistics", "name": "mean3", "description": "

Sample mean of sample 3

"}, "f1vr": {"definition": "precround(f1btss/mrs,2)", "templateType": "anything", "group": "Statistics", "name": "f1vr", "description": "

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

"}, "mu4_diff": {"definition": "random(1..2#0.1)", "templateType": "randrange", "group": "Editable variables", "name": "mu4_diff", "description": "

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

"}, "f2vr": {"definition": "precround(f2btss/mrs,2)", "templateType": "anything", "group": "Statistics", "name": "f2vr", "description": "

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

"}, "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])", "templateType": "anything", "group": "Ungrouped variables", "name": "w2", "description": ""}, "ivr": {"definition": "precround(interactionss/mrs,2)", "templateType": "anything", "group": "Statistics", "name": "ivr", "description": ""}, "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])", "templateType": "anything", "group": "Ungrouped variables", "name": "w0", "description": ""}, "f1l2": {"definition": "r3+r4", "templateType": "anything", "group": "Ungrouped variables", "name": "f1l2", "description": ""}, "f1l1": {"definition": "r1+r2", "templateType": "anything", "group": "Ungrouped variables", "name": "f1l1", "description": ""}, "n": {"definition": "4*num_samples", "templateType": "anything", "group": "Statistics", "name": "n", "description": "

The total number of measurements across all the samples

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

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

"}, "mean1": {"definition": "precround(mean(r1),2)", "templateType": "anything", "group": "Statistics", "name": "mean1", "description": "

Sample mean of sample 1

"}, "mu3": {"definition": "random(22..26#0.5)", "templateType": "randrange", "group": "Editable variables", "name": "mu3", "description": "

The population mean of sample 3

"}, "f1ssq": {"definition": "[sum(map(x^2,x,f1L1)),sum(map(x^2,x,f1L2))]", "templateType": "anything", "group": "Ungrouped variables", "name": "f1ssq", "description": ""}, "factor1_levels": {"definition": "[ \"normal\", \"antisocial\" ]", "templateType": "list of strings", "group": "Editable variables", "name": "factor1_levels", "description": "

Names of the levels of Factor 1

"}, "f1btss": {"definition": "precround(f1stovern-g^2/40,2)", "templateType": "anything", "group": "Statistics", "name": "f1btss", "description": "

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

"}, "tol": {"definition": "0.001", "templateType": "anything", "group": "Ungrouped variables", "name": "tol", "description": ""}, "btss": {"definition": "precround(stovern-G^2/N,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "btss", "description": ""}, "f2btss": {"definition": "precround(f2stovern-g^2/40,2)", "templateType": "anything", "group": "Statistics", "name": "f2btss", "description": "

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

"}, "rss": {"definition": "precround(ss-stovern,2)", "templateType": "anything", "group": "Statistics", "name": "rss", "description": ""}, "tss": {"definition": "precround(ss-G^2/N,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "tss", "description": ""}, "f1t": {"definition": "[sum(f1L1),sum(f1L2)]", "templateType": "anything", "group": "Ungrouped variables", "name": "f1t", "description": ""}, "r1": {"definition": "repeat(round(normalsample(mu1,sig1)),num_samples)", "templateType": "anything", "group": "Sample data", "name": "r1", "description": ""}, "r4": {"definition": "repeat(round(normalsample(mu4,sig1)),num_samples)", "templateType": "anything", "group": "Sample data", "name": "r4", "description": ""}, "factor2_name": {"definition": "\"stimulus\"", "templateType": "string", "group": "Editable variables", "name": "factor2_name", "description": "

The name of Factor 2

"}, "f2ssq": {"definition": "[sum(map(x^2,x,f2L1)),sum(map(x^2,x,f2L2))]", "templateType": "anything", "group": "Ungrouped variables", "name": "f2ssq", "description": ""}, "f2t": {"definition": "[sum(f2L1),sum(f2L2)]", "templateType": "anything", "group": "Ungrouped variables", "name": "f2t", "description": ""}, "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))]", "templateType": "anything", "group": "Ungrouped variables", "name": "ssq", "description": ""}, "vvr": {"definition": "[f1vr,f2vr,ivr]", "templateType": "anything", "group": "Ungrouped variables", "name": "vvr", "description": ""}, "sig1": {"definition": "random(2..3#0.2)", "templateType": "randrange", "group": "Editable variables", "name": "sig1", "description": "

Standard deviation in samples 1, 3 and 4.

"}, "sig2": {"definition": "random(1..3#0.2)", "templateType": "randrange", "group": "Editable variables", "name": "sig2", "description": "

Standard deviation in sample 2.

"}, "factor2_levels": {"definition": "[ \"baseline\", \"stress\" ]", "templateType": "list of strings", "group": "Editable variables", "name": "factor2_levels", "description": "

The names of the levels of Factor 2

"}, "f1ss": {"definition": "sum(f1ssq)", "templateType": "anything", "group": "Ungrouped variables", "name": "f1ss", "description": ""}, "factor1_name": {"definition": "\"personality\"", "templateType": "string", "group": "Editable variables", "name": "factor1_name", "description": "

The name of Factor 1

"}, "interactionss": {"definition": "btss-f1btss-f2btss", "templateType": "anything", "group": "Ungrouped variables", "name": "interactionss", "description": ""}, "tsqovern": {"definition": "map(x^2/num_samples,x,t)", "templateType": "anything", "group": "Ungrouped variables", "name": "tsqovern", "description": "

$t^2/n$

"}, "mu4": {"definition": "mu3-mu4_diff", "templateType": "anything", "group": "Ungrouped variables", "name": "mu4", "description": "

Population mean of sample 4

"}, "mu1": {"definition": "random(20..25#0.5)", "templateType": "randrange", "group": "Editable variables", "name": "mu1", "description": "

The population mean of sample 1

"}, "g": {"definition": "sum(t)", "templateType": "anything", "group": "Ungrouped variables", "name": "g", "description": ""}, "r2": {"definition": "repeat(round(normalsample(mu2,sig2)),num_samples)", "templateType": "anything", "group": "Sample data", "name": "r2", "description": ""}, "mu2": {"definition": "mu1-mu2_diff", "templateType": "anything", "group": "Ungrouped variables", "name": "mu2", "description": "

The population mean of sample 2

"}, "ss": {"definition": "sum(ssq)", "templateType": "anything", "group": "Ungrouped variables", "name": "ss", "description": ""}, "f1tsqovern": {"definition": "[f1t[0]^2/20,f1t[1]^2/20]", "templateType": "anything", "group": "Ungrouped variables", "name": "f1tsqovern", "description": ""}, "r3": {"definition": "repeat(round(normalsample(mu3,sig1)),num_samples)", "templateType": "anything", "group": "Sample data", "name": "r3", "description": ""}, "measurement_name": {"definition": "\"GSR\"", "templateType": "string", "group": "Editable variables", "name": "measurement_name", "description": "

The name of the value being measured.

"}, "mrs": {"definition": "precround(RSS/36,2)", "templateType": "anything", "group": "Statistics", "name": "mrs", "description": ""}, "f1rss": {"definition": "precround(f1ss-f1stovern,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "f1rss", "description": ""}, "f2l1": {"definition": "r1+r3", "templateType": "anything", "group": "Ungrouped variables", "name": "f2l1", "description": ""}, "f2l2": {"definition": "r2+r4", "templateType": "anything", "group": "Ungrouped variables", "name": "f2l2", "description": ""}, "f1stovern": {"definition": "sum(f1tsqovern)", "templateType": "anything", "group": "Ungrouped variables", "name": "f1stovern", "description": ""}, "stovern": {"definition": "sum(tsqovern)", "templateType": "anything", "group": "Ungrouped variables", "name": "stovern", "description": ""}, "t": {"definition": "[sum(r1),sum(r2),sum(r3),sum(r4)]", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "w": {"definition": "[w0,w1,w2]", "templateType": "anything", "group": "Ungrouped variables", "name": "w", "description": ""}, "num_samples": {"definition": "10", "templateType": "number", "group": "Editable variables", "name": "num_samples", "description": "

The number of measurements in each sample.

"}, "f2ss": {"definition": "sum(f2ssq)", "templateType": "anything", "group": "Ungrouped variables", "name": "f2ss", "description": ""}, "f2stovern": {"definition": "sum([f2t[0]^2/20,f2t[1]^2/20])", "templateType": "anything", "group": "Ungrouped variables", "name": "f2stovern", "description": ""}}, "metadata": {"notes": "

Change the distributions of the samples, and the names of the factors and measurement variable, by changing things in the \"editable variables\" group.

\n

You should also change the text in the statement and part prompts to suit your application.

\n

If you want to change the number of samples, you must add or remove columns from the tables listing the data.

\n

", "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"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "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/"}]}]}], "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/"}]}