stat/distuv: provide complete InverseGamma test coverage
MODIFY
stat/distuv/inversegamma_test.go
stat/distuv/inversegamma_test.go
@@ -56,4 +56,55 @@ func testInverseGamma(t *testing.T, f InverseGamma, i int) {
checkProbContinuous(t, i, x, 0, math.Inf(1), f, 1e-10)
checkQuantileCDFSurvival(t, i, x, f, 5e-2)
checkMode(t, i, x, f, 1e-2, 1e-2)
+
+ cdf0 := f.CDF(0)
+ if cdf0 != 0 {
+ t.Errorf("Expected zero CDF at 0, but got: %v", cdf0)
+ }
+ cdfNeg := f.CDF(-0.0001)
+ if cdfNeg != 0 {
+ t.Errorf("Expected zero CDF for a negative argument, but got: %v", cdfNeg)
+ }
+ surv0 := f.Survival(0)
+ if surv0 != 1 {
+ t.Errorf("Mismatch in Survival at 0. Got %v, want 1", surv0)
+ }
+ survNeg := f.Survival(-0.0001)
+ if survNeg != 1 {
+ t.Errorf("Mismatch in Survival for a negative argument. Got %v, want 1", survNeg)
+ }
+ if f.NumParameters() != 2 {
+ t.Errorf("Mismatch in NumParameters. Got %v, want 2", f.NumParameters())
+ }
+ pdf0 := f.Prob(0)
+ if pdf0 != 0 {
+ t.Errorf("Expected zero PDF at 0, but got: %v", pdf0)
+ }
+ pdfNeg := f.Prob(-0.0001)
+ if pdfNeg != 0 {
+ t.Errorf("Expected zero PDF for a negative argument, but got: %v", pdfNeg)
+ }
+}
+
+func TestInverseGammaLowAlpha(t *testing.T) {
+ t.Parallel()
+ f := InverseGamma{Alpha: 1, Beta: 1}
+ mean := f.Mean()
+ if !math.IsInf(mean, 1) {
+ t.Errorf("Expected +Inf mean for alpha <= 1, got %v", mean)
+ }
+ f = InverseGamma{Alpha: 2, Beta: 1}
+ stdDev := f.StdDev()
+ if !math.IsInf(stdDev, 1) {
+ t.Errorf("Expected +Inf standard deviation for alpha <= 2, got %v", stdDev)
+ }
+ variance := f.Variance()
+ if !math.IsInf(variance, 1) {
+ t.Errorf("Expected +Inf variance for alpha <= 2, got %v", variance)
+ }
+ f = InverseGamma{Alpha: 4, Beta: 1}
+ exKurt := f.ExKurtosis()
+ if !math.IsInf(exKurt, 1) {
+ t.Errorf("Expected +Inf excess kurtosis for alpha <= 4, got %v", exKurt)
+ }
}

stat/distuv: provide complete InverseGamma test coverage