Open main menu

Biolecture.org β

Changes

Homework 0

65 bytes added, 17:07, 7 May 2018
no edit summary
<prep>foreach (@set_a) { $sum_a += $_ };<br />foreach (@set_b) { $sum_b += $_ };<br />$avg_a = $sum_a / @set_a;<br />$avg_b = $sum_b / @set_b;<br />foreach (@set_a) { $var_a += ( $_ - $avg_a )**2 }; &nbsp;<br />$var_a /= (@set_a-1);<br />foreach (@set_b) { $var_b += ( $_ - $avg_b )**2 }; &nbsp;<br />$var_b /= (@set_b-1);<br />$df = @set_a + @set_b -2;<br />$sigma = sqrt( ((@set_a-1)*$var_a + (@set_b-1)*$var_b) / $df );<br />$p = ($avg_a - $avg_b) / ($sigma * sqrt( 1/@set_a + 1/@set_b));</prep>