(*args)
| 373 | |
| 374 | @derived_from(scipy.stats) |
| 375 | def f_oneway(*args): |
| 376 | # args = [np.asarray(arg, dtype=float) for arg in args] |
| 377 | # ANOVA on N groups, each in its own array |
| 378 | num_groups = len(args) |
| 379 | alldata = da.concatenate(args) |
| 380 | bign = len(alldata) |
| 381 | |
| 382 | # Determine the mean of the data, and subtract that from all inputs to a |
| 383 | # variance (via sum_of_sq / sq_of_sum) calculation. Variance is invariance |
| 384 | # to a shift in location, and centering all data around zero vastly |
| 385 | # improves numerical stability. |
| 386 | offset = alldata.mean() |
| 387 | alldata -= offset |
| 388 | |
| 389 | sstot = _sum_of_squares(alldata) - (_square_of_sums(alldata) / float(bign)) |
| 390 | ssbn = 0 |
| 391 | for a in args: |
| 392 | ssbn += _square_of_sums(a - offset) / float(len(a)) |
| 393 | |
| 394 | # Naming: variables ending in bn/b are for "between treatments", wn/w are |
| 395 | # for "within treatments" |
| 396 | ssbn -= _square_of_sums(alldata) / float(bign) |
| 397 | sswn = sstot - ssbn |
| 398 | dfbn = num_groups - 1 |
| 399 | dfwn = bign - num_groups |
| 400 | msb = ssbn / float(dfbn) |
| 401 | msw = sswn / float(dfwn) |
| 402 | f = msb / msw |
| 403 | |
| 404 | prob = _fdtrc(dfbn, dfwn, f) # equivalent to stats.f.sf |
| 405 | |
| 406 | return delayed(F_onewayResult, nout=2)(f, prob) |
| 407 | |
| 408 | |
| 409 | @derived_from(scipy.stats) |
nothing calls this directly
no test coverage detected
searching dependent graphs…