@@ -228,6 +228,8 @@ public function testMedian(int $ν, float $μ, float $expected)
228228 /**
229229 * @return array [ν, μ, median]
230230 * Data generated from SciPy: stats.nct(df, nc).ppf(0.5)
231+ * Covers edge cases, small/large degrees of freedom, and positive/negative noncentrality parameters
232+ * Parameter combinations selected to work within CDF numerical stability limits
231233 */
232234 public function dataProviderForMedian (): array
233235 {
@@ -239,6 +241,53 @@ public function dataProviderForMedian(): array
239241 [3 , 2 , 2.2038266580 ],
240242 [5 , 5 , 5.3311221227 ],
241243 [1 , 1 , 1.3202130994 ],
244+
245+ // Edge cases with small degrees of freedom
246+ [1 , 0 , 0.0000000000 ],
247+ [1 , -1 , -1.3202130994 ],
248+ [1 , 2 , 2.8090503337 ],
249+ [2 , 0 , 0.0000000000 ],
250+ [2 , 1 , 1.1424180718 ],
251+ [2 , -1 , -1.1424180718 ],
252+
253+ // Small to medium degrees of freedom with various μ
254+ [3 , 0 , 0.0000000000 ],
255+ [3 , -2 , -2.2038266580 ],
256+ [3 , 1 , 1.0911525466 ],
257+ [5 , 0 , 0.0000000000 ],
258+ [5 , -3 , -3.1832518216 ],
259+ [5 , 3 , 3.1832518216 ],
260+
261+ // Medium degrees of freedom
262+ [7 , 4 , 4.1754192166 ],
263+ [7 , -3 , -3.1254551455 ],
264+ [10 , -3 , -3.0846277081 ],
265+ [10 , 0 , 0.0000000000 ],
266+ [10 , 5 , 5.1526842648 ],
267+ [10 , -4 , -4.1179351977 ],
268+ [15 , 2 , 2.0350081771 ],
269+ [15 , -5 , -5.0977309360 ],
270+ [15 , 7 , 7.1438322816 ],
271+
272+ // Larger degrees of freedom
273+ [20 , 3 , 3.0401656737 ],
274+ [20 , -6 , -6.0880734585 ],
275+ [20 , 8 , 8.1224601549 ],
276+ [25 , 5 , 5.0560874073 ],
277+ [25 , -8 , -8.0961449024 ],
278+ [25 , 10 , 10.1238625718 ],
279+ [30 , 6 , 6.0567254706 ],
280+ [30 , -10 , -10.1017871668 ],
281+
282+ // Very large degrees of freedom
283+ [50 , 0 , 0.0000000000 ],
284+ [50 , 12 , 12.0722582854 ],
285+ [75 , 8 , 8.0294150239 ],
286+ [75 , -12 , -12.0467103655 ],
287+ [100 , 1 , 1.0025072838 ],
288+ [100 , -2 , -2.0050392625 ],
289+ [100 , 5 , 5.0129843046 ],
290+ [100 , -10 , -10.0278449401 ],
242291 ];
243292 }
244293}
0 commit comments