Welch's t-test: Difference between revisions
Content added Content deleted
m (→Using Burkardt's betain: while (1) changed to while(True), tab indent changed to 4 spaces, array2_size accounted for as well) |
m (→Using Burkardt's betain: removed assignment of $cx to itself, added 'return' at end, made spacing more consistent) |
||
Line 922: | Line 922: | ||
return 1.0; |
return 1.0; |
||
} |
} |
||
# say "mean1 = $mean1 mean2 = $mean2"; |
|||
my $variance1 = 0.0; |
my $variance1 = 0.0; |
||
my $variance2 = 0.0; |
my $variance2 = 0.0; |
||
Line 961: | Line 960: | ||
($xx, $cx, $pp, $qq, $indx) = ($cx, $value, 0.5, $A, 1); |
($xx, $cx, $pp, $qq, $indx) = ($cx, $value, 0.5, $A, 1); |
||
} else { |
} else { |
||
($xx |
($xx, $pp, $qq, $indx) = ($value, $A, 0.5, 0); |
||
} |
} |
||
$term = 1.0; |
$term = 1.0; |
||
Line 971: | Line 970: | ||
$temp = $qq - $ai; |
$temp = $qq - $ai; |
||
$rx = $xx if $ns == 0; |
$rx = $xx if $ns == 0; |
||
while (1) { |
|||
$term = $term * $temp * $rx / ( $pp + $ai ); |
|||
$value = $value + $term; |
|||
$temp = abs ($term); |
|||
if ($temp <= $acu && $temp <= $acu * $value) { |
|||
$value = $value * exp ($pp * log($xx) |
$value = $value * exp ($pp * log($xx) |
||
+ ($qq - 1.0) * log($cx) - $beta) / $pp; |
+ ($qq - 1.0) * log($cx) - $beta) / $pp; |
||
$value = 1.0 - $value if $indx; |
$value = 1.0 - $value if $indx; |
||
last; |
last; |
||
} |
|||
$ai = $ai + 1.0; |
$ai = $ai + 1.0; |
||
$ns = $ns - 1; |
|||
if (0 <= $ns) { |
|||
$temp = $qq - $ai; |
|||
$rx = $xx if $ns == 0; |
|||
} else { |
|||
$temp = $psq; |
|||
$psq = $psq + 1.0; |
|||
} |
|||
} |
} |
||
$value; |
return $value; |
||
} |
} |
||
my @d1 = (27.5,21.0,19.0,23.6,17.0,17.9,16.9,20.1,21.9,22.6,23.1,19.6,19.0,21.7,21.4); |
my @d1 = (27.5,21.0,19.0,23.6,17.0,17.9,16.9,20.1,21.9,22.6,23.1,19.6,19.0,21.7,21.4); |
||
my @d2 = (27.1,22.0,20.8,23.4,23.4,23.5,25.8,22.0,24.8,20.2,21.9,22.1,22.9,20.5,24.4); |
my @d2 = (27.1,22.0,20.8,23.4,23.4,23.5,25.8,22.0,24.8,20.2,21.9,22.1,22.9,20.5,24.4); |