@@ -180,7 +180,7 @@ function colorsForStatisticResult(statisticResult: StatisticResult) {
180
180
}
181
181
182
182
const statisticComputeColor = function ( sign : number , pValue : number ) : [ string , string , StatisticResult ] {
183
- if ( pValue > 0.1 ) {
183
+ if ( pValue > 0.05 ) {
184
184
return undecided ; //['#fff','#000', StatisticResult.Undecided];
185
185
}
186
186
if ( sign <= 0 ) {
@@ -495,11 +495,16 @@ export class ResultTableData {
495
495
const s2_2 = compareWithResultsStdDev * compareWithResultsStdDev ;
496
496
const n1 = compareWithResultsValues . values . length ;
497
497
const n2 = resultValues . values . length ;
498
- const ny =
499
- Math . pow ( s1_2 / n1 + s2_2 / n2 , 2 ) /
500
- ( ( s1_2 * s1_2 ) / ( n1 * n1 * ( n1 - 1 ) ) + ( s2_2 * s2_2 ) / ( n2 * n2 * ( n2 - 1 ) ) ) ;
498
+ // Welch Welch–Satterthwaite dof
499
+ // const dof =
500
+ // Math.pow(s1_2 / n1 + s2_2 / n2, 2) /
501
+ // ((s1_2 * s1_2) / (n1 * n1 * (n1 - 1)) + (s2_2 * s2_2) / (n2 * n2 * (n2 - 1)));
502
+ // simple dof
503
+ const dof = n1 + n2 - 2 ;
501
504
const t = ( x1 - x2 ) / Math . sqrt ( s1_2 / n1 + s2_2 / n2 ) ;
502
- const p = ( 1.0 - jStat . studentt . cdf ( Math . abs ( t ) , ny ) ) * 2 ;
505
+ console . log ( `x1 ${ x1 } x2 ${ x2 } s1_2 ${ s1_2 } s2_2 ${ s2_2 } n1 ${ n1 } n2 ${ n2 } dof ${ dof } t ${ t } ` ) ;
506
+ const p = ( 1.0 - jStat . studentt . cdf ( Math . abs ( t ) , dof ) ) * 2 ;
507
+ console . log ( `check 0.975 percentile ${ jStat . studentt . cdf ( Math . abs ( 2.048 ) , dof ) } ` ) ;
503
508
504
509
const statisticalCol = statisticComputeColor ( t , p ) ;
505
510
const statisticalResult = ( p * 100 ) . toFixed ( 3 ) + "%" ;
0 commit comments