<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>36.1.5.13 Calculate mean, variance, sd</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p class="HELM_exercise">Exercise</p>
<p>Consider the following data set of student heights. Calculate the mean, variance and standard deviation of the data.&nbsp;</p><p>Report each answer to 3 decimal places. If the answer has less than 3 decimal places, then enter zero(s) at the end.</p>
<table style="width:95%">
<tbody>
<tr>
<th scope="col">{@L[1]@}</th>
<th scope="col">{@L[2]@}</th>
<th scope="col">{@L[3]@}</th>
<th scope="col">{@L[4]@}</th>
<th scope="col">{@L[5]@}</th>
<th scope="col">{@L[6]@}</th>
<th scope="col">{@L[7]@}</th>
<th scope="col">{@L[8]@}</th>
<th scope="col">{@L[9]@}</th>
<th scope="col">{@L[10]@}</th>
</tr>
<tr>
<th scope="col">{@L[11]@}</th>
<th scope="col">{@L[12]@}</th>
<th scope="col">{@L[13]@}</th>
<th scope="col">{@L[14]@}</th>
<th scope="col">{@L[15]@}</th>
<th scope="col">{@L[16]@}</th>
<th scope="col">{@L[17]@}</th>
<th scope="col">{@L[18]@}</th>
<th scope="col">{@L[19]@}</th>
<th scope="col">{@L[20]@}</th>
</tr>
<tr>
<th scope="col">{@L[21]@}</th>
<th scope="col">{@L[22]@}</th>
<th scope="col">{@L[23]@}</th>
<th scope="col">{@L[24]@}</th>
<th scope="col">{@L[25]@}</th>
<th scope="col">{@L[26]@}</th>
<th scope="col">{@L[27]@}</th>
<th scope="col">{@L[28]@}</th>
<th scope="col">{@L[29]@}</th>
<th scope="col">{@L[30]@}</th>
</tr>
</tbody>
</table>
<br>
<ol class="HELM_parts">
<li><p>Calculate the sample mean:</p>
<p> \( \bar{x} = \) [[input:ans1]] [[validation:ans1]].[[feedback:prt1]]</p></li>
<li><p>Calculate the sample standard deviation following the steps below.</p>
<p>Step 1: Calculate \( \sum x^2 = \)  [[input:ans2]] [[validation:ans2]].[[feedback:prt2]]</p>
<p>Step 2: Use your above answers to calculate \( \sum ( x - \bar{x})^2 =\) [[input:ans3]] [[validation:ans3]].[[feedback:prt3]]</p>
<p>Step 3: Use your answer in Step 2 to calculate the sample variance</p>
<p>\(s^2 =\) [[input:ans4]] [[validation:ans4]].[[feedback:prt4]]</p>
<p>Step 4: Use your answer in Step 3 to calculate the standard deviation</p>
<p>\(s =\) [[input:ans5]] [[validation:ans5]].[[feedback:prt5]]</p></li></ol><br>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text><![CDATA[<ol class="HELM_parts">
    <li>
        <p>\( \bar{x} = \dfrac{{@sum@}}{{@l@}} = {@m@}... = {@ta1@}\) to 3 d.p.</p>
    </li>

    <li>
        <p>\( \sum x^2 = {@ta2@}\).</p>
        <p>Let \(n\) denote the sample size, so \( n = {@l@}\). We have:</p>
        <p> \(\begin{align} \sum (x - \bar{x})^2 &amp;= \sum x^2 - n \bar{x}^2 \\&amp;= {@ta2@} - {@l@} \times ({@m@}...)^2 \\&amp;= {@sqdev@}... = {@ta3@} \end{align} \)</p>
        <p>to 3 d.p.</p>
        <p> \(s^2 = \dfrac{\sum (x - \bar{x})^2}{n-1} = \dfrac{{@sqdev@}...}{{@l@}-1} = {@v@}... = {@ta4@}\) to 3 d.p..</p>
        <p>\(s = \sqrt{s^2} = \sqrt{{@v@}...} = {@sqrt(v)@}... = {@ta5@}\) to 3 d.p.</p>
    </li>
</ol>

<p><strong>Remark</strong>: Do your calculations to a more precise degree of accuracy than what you are reporting to. This help minimise the risk of your results being numerically inaccurate because of compound rounding.</p>]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2021072200</text>
    </stackversion>
    <questionvariables>
      <text>L:[155.3,177.3,146.2+rand(2),163.1,161.8,146.3+rand(2),167.9,165.4,172.3,188.2,178.8,151.1+rand(2),189.4,164.9,174.8,160.2,187.1,163.2,147.1+rand(2),182.2,178.2,172.8,164.4,177.8,154.6,154.9,176.3,148.5+rand(2),161.8,178.4];
l:length(L);
sum:decimalplaces(float(lsum(i,i,L)),1);
sum2:lsum(i^2,i,L);
m: mean(L);
sqdev: sum2 - l*m^2;
v: sqdev/(l-1);
ta1:decimalplaces(float(m),3);
ta2:decimalplaces(float(sum2),3);
ta3:decimalplaces(float(sqdev),3);
ta4:decimalplaces(float(v),3);
ta5:decimalplaces(float(sqrt(v)),3);</text>
    </questionvariables>
    <specificfeedback format="html">
      <text/>
    </specificfeedback>
    <questionnote format="moodle_auto_format">
      <text>\( \bar{x} = {@ta1@}, v = {@ta4@}, s = {@ta5@}\) Bad rounding: \(s={@displaydp(float(sqrt(v)),3)@}\)</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>dispdp(ta1,3)</tans>
      <boxsize>7</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint>to 3 d.p.</syntaxhint>
      <syntaxattribute>1</syntaxattribute>
      <forbidwords>mean</forbidwords>
      <allowwords/>
      <forbidfloat>0</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>1</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options>maxdp:3, mindp:3</options>
    </input>
    <input>
      <name>ans2</name>
      <type>numerical</type>
      <tans>dispdp(ta2,3)</tans>
      <boxsize>7</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint>to 3 d.p.</syntaxhint>
      <syntaxattribute>1</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>0</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>1</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options>maxdp:3, mindp:3</options>
    </input>
    <input>
      <name>ans3</name>
      <type>numerical</type>
      <tans>dispdp(ta3,3)</tans>
      <boxsize>7</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint>to 3 d.p.</syntaxhint>
      <syntaxattribute>1</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>0</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>1</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options>maxdp:3, mindp:3</options>
    </input>
    <input>
      <name>ans4</name>
      <type>numerical</type>
      <tans>dispdp(ta4,3)</tans>
      <boxsize>7</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint>to 3 d.p.</syntaxhint>
      <syntaxattribute>1</syntaxattribute>
      <forbidwords>var1</forbidwords>
      <allowwords/>
      <forbidfloat>0</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>1</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options>maxdp:3, mindp:3</options>
    </input>
    <input>
      <name>ans5</name>
      <type>numerical</type>
      <tans>dispdp(ta5,3)</tans>
      <boxsize>7</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint>to 3 d.p.</syntaxhint>
      <syntaxattribute>1</syntaxattribute>
      <forbidwords>std1</forbidwords>
      <allowwords/>
      <forbidfloat>0</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>1</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options>maxdp:3, mindp:3</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>NumDecPlaces</answertest>
        <sans>ans1</sans>
        <tans>ta1</tans>
        <testoptions>3</testoptions>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt1-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</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>NumDecPlaces</answertest>
        <sans>ans2</sans>
        <tans>ta2</tans>
        <testoptions>3</testoptions>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt2-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt2-1-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>NumDecPlaces</answertest>
        <sans>ans3</sans>
        <tans>ta3</tans>
        <testoptions>3</testoptions>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt3-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>1</falsenextnode>
        <falseanswernote>prt3-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>1</name>
        <description/>
        <answertest>NumDecPlaces</answertest>
        <sans>ans3</sans>
        <tans>ans2-l*ans1^2</tans>
        <testoptions>3</testoptions>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt3-2-T</trueanswernote>
        <truefeedback format="html">
          <text><![CDATA[<p dir="ltr" style="text-align: left;">Are you rounding correctly? Do calculations to a high degree of accuracy, not with the rounded values entered earlier. Compound rounding introduces numerical inaccuracies.</p>]]></text>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt3-2-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>NumDecPlaces</answertest>
        <sans>ans4</sans>
        <tans>ta4</tans>
        <testoptions>3</testoptions>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt4-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>1</falsenextnode>
        <falseanswernote>prt4-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>1</name>
        <description/>
        <answertest>NumDecPlaces</answertest>
        <sans>ans4</sans>
        <tans>sqdev/l</tans>
        <testoptions>3</testoptions>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt4-2-T</trueanswernote>
        <truefeedback format="html">
          <text><![CDATA[<p dir="ltr" style="text-align: left;">Did you divide by \(n\) or \(n-1\)?</p>]]></text>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>2</falsenextnode>
        <falseanswernote>prt4-2-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>2</name>
        <description/>
        <answertest>NumDecPlaces</answertest>
        <sans>ans4</sans>
        <tans>ans3/(l-1)</tans>
        <testoptions>3</testoptions>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt4-3-T</trueanswernote>
        <truefeedback format="html">
          <text><![CDATA[<p dir="ltr" style="text-align: left;">Are you rounding correctly? Do calculations to a high degree of accuracy, not with the rounded values entered earlier. Compound rounding introduces numerical inaccuracies.<br></p>]]></text>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt4-3-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <prt>
      <name>prt5</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>NumDecPlaces</answertest>
        <sans>ans5</sans>
        <tans>ta5</tans>
        <testoptions>3</testoptions>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt5-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>1</falsenextnode>
        <falseanswernote>prt5-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>1</name>
        <description/>
        <answertest>NumDecPlaces</answertest>
        <sans>ans5</sans>
        <tans>sqrt(ans4)</tans>
        <testoptions>3</testoptions>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt5-2-T</trueanswernote>
        <truefeedback format="html">
          <text><![CDATA[<p dir="ltr" style="text-align: left;">Are you rounding correctly? Do calculations to a high degree of accuracy, not with the rounded values entered earlier. Compound rounding introduces numerical inaccuracies.<br></p>]]></text>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt5-2-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>313436495</deployedseed>
    <deployedseed>1610669078</deployedseed>
    <deployedseed>1893018489</deployedseed>
    <deployedseed>1651154054</deployedseed>
    <deployedseed>37095692</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>dispdp(ta1,3)</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>dispdp(ta2,3)</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>dispdp(ta3,3)</value>
      </testinput>
      <testinput>
        <name>ans4</name>
        <value>dispdp(ta4,3)</value>
      </testinput>
      <testinput>
        <name>ans5</name>
        <value>dispdp(ta5,3)</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>
      <expected>
        <name>prt5</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt5-1-T</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
