dask 2021.10.0

NotesParametersReturns
f(self, dfnum, dfden, size=None, chunks='auto', **kwargs)

This docstring was copied from numpy.random.mtrand.RandomState.f.

Some inconsistencies with the Dask version may exist.

Samples are drawn from an F distribution with specified parameters, :None:None:`dfnum` (degrees of freedom in numerator) and :None:None:`dfden` (degrees of freedom in denominator), where both parameters must be greater than zero.

The random variate of the F distribution (also known as the Fisher distribution) is a continuous probability distribution that arises in ANOVA tests, and is the ratio of two chi-square variates.

note

New code should use the f method of a default_rng() instance instead; please see the :None:ref:`random-quick-start`.

Notes

The F statistic is used to compare in-group variances to between-group variances. Calculating the distribution depends on the sampling, and so it is a function of the respective degrees of freedom in the problem. The variable :None:None:`dfnum` is the number of samples minus one, the between-groups degrees of freedom, while :None:None:`dfden` is the within-groups degrees of freedom, the sum of the number of samples in each group minus the number of groups.

Parameters

dfnum : float or array_like of floats

Degrees of freedom in numerator, must be > 0.

dfden : float or array_like of float

Degrees of freedom in denominator, must be > 0.

size : int or tuple of ints, optional

Output shape. If the given shape is, e.g., (m, n, k) , then m * n * k samples are drawn. If size is None (default), a single value is returned if dfnum and dfden are both scalars. Otherwise, np.broadcast(dfnum, dfden).size samples are drawn.

Returns

out : ndarray or scalar

Drawn samples from the parameterized Fisher distribution.

Draw samples from an F distribution.

See Also

Generator.f

which should be used for new code.

scipy.stats.f

probability density function, distribution or cumulative density function, etc.

Examples

An example from Glantz[1], pp 47-40:

Two groups, children of diabetics (25 people) and children from people without diabetes (25 controls). Fasting blood glucose was measured, case group had a mean value of 86.1, controls had a mean value of 82.2. Standard deviations were 2.09 and 2.49 respectively. Are these data consistent with the null hypothesis that the parents diabetic status does not affect their children's blood glucose levels? Calculating the F statistic from the data gives a value of 36.01.

Draw samples from the distribution:

This example is valid syntax, but we were not able to check execution
>>> dfnum = 1. # between group degrees of freedom  # doctest: +SKIP
... dfden = 48. # within groups degrees of freedom # doctest: +SKIP
... s = np.random.f(dfnum, dfden, 1000) # doctest: +SKIP

The lower bound for the top 1% of the samples is :

This example is valid syntax, but we were not able to check execution
>>> np.sort(s)[-10]  # doctest: +SKIP
7.61988120985 # random

So there is about a 1% chance that the F statistic will exceed 7.62, the measured value is 36, so the null hypothesis is rejected at the 1% level.

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /dask/array/random.py#285
type: <class 'function'>
Commit: