fix(stats): hold the Student-t tails past t-squared overflow
Assisted-by: GLM 5.3 Flash
This commit is contained in:
+8
-1
@@ -304,7 +304,14 @@ func NoncentralTCDF(t float64, df int, delta float64) (float64, error) {
|
||||
magnitude = -t
|
||||
shift = -delta
|
||||
}
|
||||
x := magnitude * magnitude / (magnitude*magnitude + float64(df))
|
||||
magnitude2 := magnitude * magnitude
|
||||
x := magnitude2 / (magnitude2 + float64(df))
|
||||
if math.IsInf(magnitude2, 1) {
|
||||
// A finite t whose square overflows drove the quotient through
|
||||
// Inf/Inf into a NaN the incomplete beta refused under its own
|
||||
// name. The beta argument's limit there is exactly 1.
|
||||
x = 1
|
||||
}
|
||||
if x == 0 {
|
||||
// t = 0: the value collapses to Φ(−δ) exactly.
|
||||
return NormalCDF(-delta), nil
|
||||
|
||||
Reference in New Issue
Block a user