MCPcopy Index your code
hub / github.com/dask/dask / f_oneway

Function f_oneway

dask/array/stats.py:375–406  ·  view source on GitHub ↗
(*args)

Source from the content-addressed store, hash-verified

373
374@derived_from(scipy.stats)
375def 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)

Callers

nothing calls this directly

Calls 4

delayedFunction · 0.90
_sum_of_squaresFunction · 0.85
_square_of_sumsFunction · 0.85
meanMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…