Jump to content

Welch's t-test: Difference between revisions

m
→‎{{header|C}}: removed redundant variable 'x', should save RAM and make easier to read
m (contradiction with the following sentence (it's a translation of a specific R command))
m (→‎{{header|C}}: removed redundant variable 'x', should save RAM and make easier to read)
Line 130:
);
// printf("Welch = %lf DOF = %lf\n", WELCH_T_STATISTIC, DEGREES_OF_FREEDOM);
const double a = DEGREES_OF_FREEDOM/2, x = DEGREES_OF_FREEDOM/(WELCH_T_STATISTIC*WELCH_T_STATISTIC+DEGREES_OF_FREEDOM);
double value = DEGREES_OF_FREEDOM/(WELCH_T_STATISTIC*WELCH_T_STATISTIC+DEGREES_OF_FREEDOM);
if ((isinf(xvalue) != 0) || (isnan(xvalue) != 0)) {
return 1.0;
}
if ((isinf(avalue) != 0) || (isnan(avalue) != 0)) {
return 1.0;
}
 
/* Purpose:
 
BETAIN computes the incomplete Beta function ratio.
Line 192 ⟶ 193:
double temp;
double term;
double value;
double xx;
 
value = x;
// ifault = 0;
//Check the input arguments.
Line 202 ⟶ 201:
// return value;
}
if ( xvalue < 0.0 || 1.0 < xvalue )
{
// *ifault = 2;
Line 210 ⟶ 209:
Special cases.
*/
if ( xvalue == 0.0 || xvalue == 1.0 ) {
return value;
}
psq = a + 0.5;
cx = 1.0 - xvalue;
 
if ( a < psq * xvalue )
{
xx = cx;
cx = xvalue;
pp = 0.5;
qq = a;
Line 226 ⟶ 225:
else
{
xx = xvalue;
pp = a;
qq = 0.5;
Line 281 ⟶ 280:
}
}
 
return value;
}
Cookies help us deliver our services. By using our services, you agree to our use of cookies.