<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>43.2.1.1 Pearson r</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p class="HELM_exercise">Exercise</p>
<p>Hooke's law relates the extension of a spring under load to its extended length.</p><p>The following results were obtained experimentally.</p>
<p>&nbsp;</p>
<table style="height: 45px;" border="1" width="440">
<tbody>
<tr>
<td style="width: 66px; text-align: center;"><b>Load</b> (<strong>N</strong>)</td>
<td style="width: 66px; text-align: center;">\({@L1@}\)</td>
<td style="width: 67px; text-align: center;">\({@L2@}\)</td>
<td style="width: 67px; text-align: center;">\({@L3@}\)</td>
<td style="width: 67px; text-align: center;">\({@L4@}\)</td>
<td style="width: 67px; text-align: center;">\({@L5@}\)</td>
</tr>
<tr>
<td style="width: 66px; text-align: center;"><b>Extension</b> (<strong>mm</strong>)</td>
<td style="width: 66px; text-align: center;">\({@E1@}\)</td>
<td style="width: 67px; text-align: center;">\({@E2@}\)</td>
<td style="width: 67px; text-align: center;">\({@E3@}\)</td>
<td style="width: 67px; text-align: center;">\({@E4@}\)</td>
<td style="width: 67px; text-align: center;">\({@E5@}\)</td>
</tr>
</tbody>
</table>

<p></p>Calculate Pearson's \(r\) and the test statistic giving your answer to 3 decimal places. Test its significance at the \(5\%\) level. What conclusion can you draw?<p></p>
<ol class="HELM_parts">
<li><p>\(r\) = [[input:ans1]] [[validation:ans1]][[feedback:prt1]]</p></li>

<li><p>\(r_{test}\) =[[input:ans2]][[validation:ans2]][[feedback:prt2]]</p></li>

<li><p>The critical value for a two-sided \(t\)-test at the \(5\%\) level read off from tables is [[input:ans3]]. Therefore&nbsp; we [[input:ans4]] reject the null hypothesis at the \(5\%\).<br></p><p></p><p>[[validation:ans3]][[feedback:prt3]]<br></p><p>[[validation:ans4]][[feedback:prt4]]<br></p><p><br></p><p></p></li></ol>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text><![CDATA[<p>Setting up a spreadsheet to do the calculations gives:</p><table border="1" width="534"><tbody><tr><td><b>Load</b> (\(x\))</td><td><b>Exten.</b> (\(y\))</td><td>\(xy\)</td><td>\(x^2\)</td><td>\(y^2\)</td></tr><tr><td>\({@L1@}\)</td><td>\({@E1@}\)</td><td>\({@L1*E1@}\)</td><td>\({@L1^2@}\)</td><td>\({@E1^2@}\)</td></tr><tr><td>\({@L2@}\)</td><td>\({@E2@}\)</td><td>\({@L2*E2@}\)</td><td>\({@L2^2@}\)</td><td>\({@E2^2@}\)</td></tr><tr><td>\({@L3@}\)</td><td>\({@E3@}\)</td><td>\({@L3*E3@}\)</td><td>\({@L3^2@}\)</td><td>\({@E3^2@}\)</td></tr><tr><td>\({@L4@}\)</td><td>\({@E4@}\)</td><td>\({@L4*E4@}\)</td><td>\({@L4^2@}\)</td><td>\({@E4^2@}\)</td></tr><tr><td>\({@L5@}\)</td><td>\({@E5@}\)</td><td>\({@L5*E5@}\)</td><td>\({@L5^2@}\)</td><td>\({@E5^2@}\)</td></tr><tr><td>\( \sum x = {@Sumx@} \)</td><td>\( \sum y = {@Sumy@} \)</td><td>\( \sum xy = {@Sumxy@} \)</td><td>\( \sum x^2 = {@Sumx2@} \)</td><td>\( \sum y^2 = {@Sumy2@} \)</td></tr></tbody></table>Substituting in the formula we developed for \(r\) gives the result&nbsp;<p>&nbsp;\[ r = \dfrac{n \sum xy - \sum x \sum y }{\sqrt{\left( n \sum x^2 - \left( \sum x \right) ^2 \right)} \left( n \sum y^2 - \left( \sum y \right)^2 \right) } \]</p><p>&nbsp;\[ = \dfrac{ {@n@} \times {@Sumxy@} - {@Sumx@} \times {@Sumy@} }{ \sqrt{ \left( {@n@} \times {@Sumx2@} - \left( {@Sumx@} \right) ^2 \right) \left( {@n@} \times {@Sumy2@} - \left( {@Sumy@} \right)^2 \right) }} = {@ta1@} \]</p><p>and then</p><p>\[r_{test} = \dfrac{r\sqrt{n-2}}{\sqrt{1 - r^2}} = {@ta2@}\]</p>Hence, since the critical value for a two-sided \(t\)-test at the \(5\%\) level read off from tables is \(3.182\) we see that since \( {@ta2@} &gt; 3.182 \) we <b>can</b> <span><span style="">reject</span> </span>the null hypothesis at the \(5\%\) level and conclude that the correlation coefficient is significantly different from zero.<br><p></p>]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2024072400</text>
    </stackversion>
    <questionvariables>
      <text><![CDATA[n:5;
L1:2;
L2:5
L3:8;
L4:11;
L5:15;

E1:rand([2,3,4,5]);
E2:rand([21,22,23,24,25]);
E3:rand([60,61,62,63,64]);
E4:rand([117,118,119, 120,121]);
E5:rand([221,222,223,224,225]);

Sumx:L1+L2+L3+L4+L5;
Sumy:E1+E2+E3+E4+E5;
Sumxy:L1*E1 + L2*E2 + L3*E3 + L4*E4 + L5*E5;
Sumx2:L1^2+L2^2+L3^2+L4^2+L5^2;
Sumy2:E1^2+E2^2+E3^2+E4^2+E5^2;

r:decimalplaces(( n*Sumxy - Sumx*Sumy)/( sqrt( (n*Sumx2 - (Sumx) ^2)*(n*Sumy2 - ( Sumy)^2 ))),6);
rtest:decimalplaces((r*sqrt(n-2))/(sqrt(1-r^2)),6);
ta1:decimalplaces(r,3);
ta2:decimalplaces(rtest,3);
Ta2:decimalplaces( ta1*sqrt(n-2)/sqrt(1-ta1^2),3);
ta3:[[2.353,false],[2.776, false],[3.182,true]];
ta4:[["can",true],["cannot", false]];]]></text>
    </questionvariables>
    <specificfeedback format="html">
      <text/>
    </specificfeedback>
    <questionnote format="moodle_auto_format">
      <text>{@ta1@}, {@ta2@}, {@Ta2@}</text>
    </questionnote>
    <questiondescription format="moodle_auto_format">
      <text/>
    </questiondescription>
    <questionsimplify>1</questionsimplify>
    <assumepositive>0</assumepositive>
    <assumereal>0</assumereal>
    <prtcorrect format="html">
      <text><![CDATA[<span style="font-size: 1.5em; color:green;"><i class="fa fa-check"></i></span> Correct answer, well done.]]></text>
    </prtcorrect>
    <prtpartiallycorrect format="html">
      <text><![CDATA[<span style="font-size: 1.5em; color:orange;"><i class="fa fa-adjust"></i></span> Your answer is partially correct.]]></text>
    </prtpartiallycorrect>
    <prtincorrect format="html">
      <text><![CDATA[<span style="font-size: 1.5em; color:red;"><i class="fa fa-times"></i></span> Incorrect answer.]]></text>
    </prtincorrect>
    <decimals>.</decimals>
    <scientificnotation>*10</scientificnotation>
    <multiplicationsign>dot</multiplicationsign>
    <sqrtsign>1</sqrtsign>
    <complexno>i</complexno>
    <inversetrig>cos-1</inversetrig>
    <logicsymbol>lang</logicsymbol>
    <matrixparens>[</matrixparens>
    <isbroken>0</isbroken>
    <variantsselectionseed/>
    <input>
      <name>ans1</name>
      <type>numerical</type>
      <tans>ta1</tans>
      <boxsize>4</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>0</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options>mindp:3, maxdp:3</options>
    </input>
    <input>
      <name>ans2</name>
      <type>numerical</type>
      <tans>ta2</tans>
      <boxsize>4</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>0</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options>mindp:3, maxdp:3</options>
    </input>
    <input>
      <name>ans3</name>
      <type>dropdown</type>
      <tans>ta3</tans>
      <boxsize>15</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>1</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans4</name>
      <type>dropdown</type>
      <tans>ta4</tans>
      <boxsize>15</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>1</showvalidation>
      <options/>
    </input>
    <prt>
      <name>prt1</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans1</sans>
        <tans>ta1</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt1-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt1-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <prt>
      <name>prt2</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans2</sans>
        <tans>ta2</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt2-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>1</falsenextnode>
        <falseanswernote>prt2-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>1</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans2</sans>
        <tans>Ta2</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt2-2-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt2-2-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <prt>
      <name>prt3</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>[ans3]</sans>
        <tans>mcq_correct(ta3)</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt3-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt3-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <prt>
      <name>prt4</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>String</answertest>
        <sans>ans4</sans>
        <tans>first(mcq_correct(ta4))</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt4-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt4-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>1704048355</deployedseed>
    <deployedseed>1157023282</deployedseed>
    <deployedseed>443985908</deployedseed>
    <deployedseed>694046885</deployedseed>
    <deployedseed>978343736</deployedseed>
    <deployedseed>1027036256</deployedseed>
    <deployedseed>1580066887</deployedseed>
    <deployedseed>1350745828</deployedseed>
    <deployedseed>1865471450</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ta1</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>ta2</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>3.182</value>
      </testinput>
      <testinput>
        <name>ans4</name>
        <value><![CDATA["can"]]></value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt1-1-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt2</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt2-1-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt3</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt3-1-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt4</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt4-1-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>2</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ta1+1</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>ta2+1</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>2.776</value>
      </testinput>
      <testinput>
        <name>ans4</name>
        <value><![CDATA["cannot"]]></value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt1-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>prt2</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt2-2-F</expectedanswernote>
      </expected>
      <expected>
        <name>prt3</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt3-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>prt4</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt4-1-F</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>3</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ta2</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>ta1</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>2.353</value>
      </testinput>
      <testinput>
        <name>ans4</name>
        <value><![CDATA["cannot"]]></value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt1-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>prt2</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt2-2-F</expectedanswernote>
      </expected>
      <expected>
        <name>prt3</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt3-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>prt4</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt4-1-F</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>4</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ta1</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>Ta2</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>3.182</value>
      </testinput>
      <testinput>
        <name>ans4</name>
        <value><![CDATA["can"]]></value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt1-1-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt2</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt2-2-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt3</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt3-1-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt4</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt4-1-T</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
