Welch's t-test: Difference between revisions
m
→Using Burkardt's betain: cleaned up testing
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: cleaned up testing) |
SqrtNegInf (talk | contribs) m (→Using Burkardt's betain: cleaned up testing) |
||
Line 1,211:
This uses the Soper reduction formula to evaluate the integral, which converges much more quickly than Simpson's formula.
<lang perl6>sub lgamma ( Num(Real) \n --> Num ){
use NativeCall;
sub lgamma (num64 --> num64) is native {}
Line 1,299 ⟶ 1,298:
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 @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 @d3 = 17.2,20.9,22.6,18.1,21.7,21.4,23.5,24.2,14.7,21.8;▼
my @d4 = 21.5,22.8,21.0,23.0,21.6,23.6,22.5,20.7,23.4,21.8,20.7,21.7,21.5,22.5,23.6,21.5,22.5,23.5,21.5,21.8;▼
my @d5 = 19.8,20.4,19.6,17.8,18.5,18.9,18.3,18.9,19.5,22.0;▼
my @d6 = 28.2,26.6,20.1,23.3,25.2,22.1,17.7,27.6,20.6,13.7,23.2,17.5,20.6,18.0,23.9,21.6,24.3,20.4,24.0,13.2;▼
my @d7 = 30.02,29.99,30.11,29.97,30.01,29.99;▼
my @d8 = 29.89,29.93,29.72,29.98,30.02,29.98;▼
my @x = 3.0,4.0,1.0,2.1;▼
my @y = 490.2,340.0,433.9;▼
my @s1 = 1.0/15,10.0/62.0;▼
my @s2 = 1.0/10,2/50.0;▼
my @v1 = 0.010268,0.000167,0.000167;▼
my @v2 = 0.159258,0.136278,0.122389;▼
my @z1 = 9/23.0,21/45.0,0/38.0;▼
my @z2 = 0/44.0,42/94.0,0/22.0;▼
my $error = 0;
my @answers = (
my @CORRECT_ANSWERS = (0.021378001462867,▼
0.021378001462867,
0.148841696605327,
0.0359722710297968,
Line 1,324 ⟶ 1,308:
0.00339907162713746,
0.52726574965384,
0.545266866977794
);
for (
my $pvalue = pvalue(@d1, @d2);▼
▲
my $error = abs($pvalue - @CORRECT_ANSWERS[0]);▼
▲
printf("Test sets 1 p-value = %.14g\n",$pvalue);▼
▲
▲
printf("the cumulative error is %g\n", $error);▼
) -> @left, @right {
}
{{out}}
▲the cumulative error is 5.50254e-15
=={{header|Phix}}==
|