[LON-CAPA-users] Hints for first LON-CAPA question

Raymond Batchelor batchelo at sfu.ca
Thu Jun 13 15:52:06 EDT 2013


See my revised xml which I've appended below:


----- Original Message -----
From: "Joseph Mingrone" <jrm at mathstat.dal.ca>
To: lon-capa-users at mail.lon-capa.org
Sent: Thursday, 13 June, 2013 12:04:44
Subject: [LON-CAPA-users] Hints for first LON-CAPA question

Joseph Mingrone <jrm at mathstat.dal.ca> writes:

Hello all;

I'm creating a problem that I've included below.  My questions are:

1. How can a student submit each part of the question separately?

****   Use <part></part> tags.

2. In the table, I'm building the header with $row1 .= "<td>$i+1</td>",
but the $i+1 isn't evaluated and 0+1, 1+1, etc. is shown. How can I get
the intended output?

****   Define a new variable within the "for loop".

3. How can \bar{x} be displayed?

**** set display argument in tags  <m display="mimetex">

4. In the last radiobuttonresponse question, only one foil is showing up
even though I've specified max=3.  How can I make all three show up?

*** a radiobuttonresponse can have ONLY one "true" foil.
     two of your foils were designated "unused" -- I changed that to "false"

5. This is my first attempt at a question and I have no sample code
other than what's in the manual.  If you have any other suggestions
about style or best practices, please pass them along.

Use the "colourfull" editor  "EDIT" and use the small blue "?" links to find all sorts of useful info about everything.

:-)

Thanks,

Joseph

<problem>

<parameter name="maxtries" id="11" type="int_pos" default="1" description="Maximum Number of Tries" />

<script type="loncapa/perl">
$n = &random(8,16,1);

$mu_a = &random(4,16,.01);
$sd_a = &random(1,5,.01);
@a=&random_normal($n,55,$mu_a,$sd_a);

$mu_b = &random(4,16,.01);
$sd_b = &random(1,5,.01);
@b=&random_normal($n,55,$mu_b,$sd_b);

$table = '<table border=1>';
$row1 = '<tr><td></td>';
$row2 = '<tr><td>A</td>';
$row3 = '<tr><td>B</td>';
for ($i=0; $i<$n; $i++)
{
    $I=$i+1;
    $row1 .= "<td>$I</td>";
    $row2 .= "<td>&roundto($a[$i],2)</td>";
    $row3 .= "<td>&roundto($b[$i],2)</td>";
}
$row1 .= '</tr>';
$row2 .= '</tr>';
$row3 .= '</tr>';
$table .= $row1;
$table .= $row2;
$table .= "$row3</table>";
</script>

<startouttext />
<p>
Super Sneaker Company is evaluating two different materials, A and B, to be used to construct the soles of their new active shoe targeted to city high school students in Canada. While material B costs less than material A, the company suspects that mean wear for material B is greater than mean wear for material A. Two study designs were initially developed to test this suspicion. In both designs, Halifax was chosen as a representative city of the targeted market. In Study Design 1, 10 high school students were drawn at random from the Halifax School District database. After obtaining their shoe sizes, the company manufactured 10 pairs of shoes, each pair with one shoe having a sole constructed from material A and the other shoe, a sole constructed from material B.
</p><endouttext />
<part>
<startouttext />
The researcher in charge of this design asked the company to randomly assign material A to the right shoe or to the left shoe, for each of the ten pairs. Why?
<endouttext />

<radiobuttonresponse direction="vertical" max="3" id="12" randomize="yes">
    <foilgroup>
        <foil location="random" value='true' name="foil1">
            <startouttext />Right shoe wear is generally different than left shoe wear.<endouttext />
        </foil>
        <foil location="random" value='false' name="foil2">
            <startouttext />Right shoe wear is always less than left shoe wear.<endouttext />
        </foil>
        <foil location="random" value='false' name="foil3">
            <startouttext />Right shoe wear is always greater than left shoe wear.<endouttext />
        </foil>
        <foil location="random" value='false' name="foil4">
            <startouttext />Left shoe wear is always less than right shoe wear.<endouttext />
        </foil>
        <foil location="random" value='false' name="foil5">
            <startouttext />Left shoe wear is always greater than right shoe wear.<endouttext />
        </foil>
    </foilgroup>
</radiobuttonresponse>
</part>
<part>
<parameter name="maxtries" type="int_pos" description="Maximum Number of Tries" default="1" />
<startouttext />
<p>
After 3 months, the amount of wear in each shoe was recorded in standardized units as follows:
<parse>$table</parse>
</p>
The null hypothesis for the test is:
<endouttext />

<radiobuttonresponse max="4" randomize="yes" direction="vertical">
    <foilgroup>
      <foil location="random" value='true' name="foil1">
         <startouttext /><m display="mimetex">$\mu_a - \mu_b = 0$</m><endouttext />
      </foil>
      <foil location="random" value='true' name="foil2">
         <startouttext /><m display="mimetex">$\mu_b - \mu_a = 0$</m><endouttext />
      </foil>
      <foil location="random" value='false' name="foil3">
         <startouttext /><m display="mimetex">$ \bar{x}_a < \bar{X}_b $</m><endouttext />
      </foil>
      <foil location="random" value='false' name="foil4">
         <startouttext /><m display="mimetex">$ \bar{x}_a - \bar{x}_b = 0 $</m><endouttext />
      </foil>
      <foil location="random" value='false' name="foil5">
         <startouttext /><m display="mimetex">$ \bar{x}_b - \bar{x}_a = 0 $</m><endouttext />
      </foil>
    </foilgroup>
</radiobuttonresponse>
</part><part>
<parameter name="maxtries" type="int_pos" description="Maximum Number of Tries" default="1" />
<startouttext />
The alternative hypothesis is:
<endouttext />

<radiobuttonresponse max="4" randomize="yes" direction="vertical">
    <foilgroup>
      <foil location="random" value='true' name="foil1">
         <startouttext /><m display="mimetex">$\mu_a - \mu_b \ne 0$</m><endouttext />
      </foil>
      <foil location="random" value='true' name="foil2">
         <startouttext /><m display="mimetex">$\mu_b - \mu_a > 0$</m><endouttext />
      </foil>
      <foil location="random" value='false' name="foil3">
         <startouttext /><m display="mimetex">$\mu_b - \mu_a > 0$</m><endouttext />
      </foil>
      <foil location="random" value='false' name="foil4">
         <startouttext /><m display="mimetex">$\mu_a - \mu_b > 0$</m><endouttext />
      </foil>
      <foil location="random" value='false' name="foil5">
         <startouttext /><m display="mimetex">$ \bar{x} < $</m><endouttext />
      </foil>
      <foil location="random" value='false' name="foil6">
         <startouttext /><m display="mimetex">$ \bar{x}_a - \bar{x}_b < 0 $</m><endouttext />
      </foil>
      <foil location="random" value='false' name="foil7">
         <startouttext /><m display="mimetex">$ \bar{x}_b - \bar{x}_a < 0 $</m><endouttext />
      </foil>
    </foilgroup>
</radiobuttonresponse>
</part><part>
<parameter name="maxtries" type="int_pos" description="Maximum Number of Tries" default="3" />
<startouttext />To test the hypothesis that mean wear for material B is greater than mean wear for material A, calculate the test statistic.<endouttext />
<numericalresponse answer="">
  <responseparam type="tolerance" default="5%" name="tol" description="Numerical Tolerance" />
  <responseparam name="sig" type="int_range,0-16" default="0,15" description="Significant Figures" />
  <textline readonly="no" />
</numericalresponse>
</part><part>

<startouttext />Which of the statistical tables should you use?  You only have one try!<endouttext />
<radiobuttonresponse max="3" randomize="yes" direction="vertical">
  <foilgroup>
    <foil name="t" value="true" location="random">
      <startouttext />t-distribution<endouttext />
    </foil>
    <foil name="z" value="false" location="random">
      <startouttext />z-distribution<endouttext />
    </foil>
    <foil name="chi" value="false" location="random">
      <startouttext /><m display="mimetex">$\chi^2$</m><endouttext />
    </foil>
  </foilgroup>
</radiobuttonresponse>
</part>

</problem>


More information about the LON-CAPA-users mailing list