Homework 0
Revision as of 17:07, 7 May 2018 by imported>Tae Joo Hwang (Created page with "<pre> foreach (@set_a) { $sum_a += $_ }; foreach (@set_b) { $sum_b += $_ }; $avg_a = $sum_a / @set_a; $avg_b = $sum_b / @set_b; foreach (@set_a) { $var_a += ( $_ - $avg_a )**2 };...")
foreach (@set_a) { $sum_a += $_ }; foreach (@set_b) { $sum_b += $_ }; $avg_a = $sum_a / @set_a; $avg_b = $sum_b / @set_b; foreach (@set_a) { $var_a += ( $_ - $avg_a )**2 }; $var_a /= (@set_a-1); foreach (@set_b) { $var_b += ( $_ - $avg_b )**2 }; $var_b /= (@set_b-1); $df = @set_a + @set_b -2; $sigma = sqrt( ((@set_a-1)*$var_a + (@set_b-1)*$var_b) / $df ); $p = ($avg_a - $avg_b) / ($sigma * sqrt( 1/@set_a + 1/@set_b));