(a, axis=0, nan_policy="propagate")
| 263 | |
| 264 | @derived_from(scipy.stats) |
| 265 | def skewtest(a, axis=0, nan_policy="propagate"): |
| 266 | if nan_policy != "propagate": |
| 267 | raise NotImplementedError( |
| 268 | "`nan_policy` other than 'propagate' have not been implemented." |
| 269 | ) |
| 270 | |
| 271 | b2 = skew(a, axis) |
| 272 | n = float(a.shape[axis]) |
| 273 | if n < 8: |
| 274 | raise ValueError( |
| 275 | f"skewtest is not valid with less than 8 samples; {int(n)} samples were given." |
| 276 | ) |
| 277 | y = b2 * math.sqrt(((n + 1) * (n + 3)) / (6.0 * (n - 2))) |
| 278 | beta2 = ( |
| 279 | 3.0 |
| 280 | * (n**2 + 27 * n - 70) |
| 281 | * (n + 1) |
| 282 | * (n + 3) |
| 283 | / ((n - 2.0) * (n + 5) * (n + 7) * (n + 9)) |
| 284 | ) |
| 285 | W2 = -1 + math.sqrt(2 * (beta2 - 1)) |
| 286 | delta = 1 / math.sqrt(0.5 * math.log(W2)) |
| 287 | alpha = math.sqrt(2.0 / (W2 - 1)) |
| 288 | y = np.where(y == 0, 1, y) |
| 289 | Z = delta * np.log(y / alpha + np.sqrt((y / alpha) ** 2 + 1)) |
| 290 | |
| 291 | return delayed(SkewtestResult, nout=2)(Z, 2 * distributions.norm.sf(np.abs(Z))) |
| 292 | |
| 293 | |
| 294 | @derived_from(scipy.stats) |
no test coverage detected
searching dependent graphs…