dask 2021.10.0

NotesParametersReturns
noncentral_chisquare(self, df, nonc, size=None, chunks='auto', **kwargs)

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

Some inconsistencies with the Dask version may exist.

The noncentral $\chi^2$ distribution is a generalization of the $\chi^2$ distribution.

note

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

Notes

The probability density function for the noncentral Chi-square distribution is

$$P(x;df,nonc) = \sum^{\infty}_{i=0}\frac{e^{-nonc/2}(nonc/2)^{i}}{i!} P_{Y_{df+2i}}(x),$$

where $Y_{q}$ is the Chi-square with q degrees of freedom.

Parameters

df : float or array_like of floats

Degrees of freedom, must be > 0.

versionchanged

Earlier NumPy versions required dfnum > 1.

nonc : float or array_like of floats

Non-centrality, must be non-negative.

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 df and nonc are both scalars. Otherwise, np.broadcast(df, nonc).size samples are drawn.

Returns

out : ndarray or scalar

Drawn samples from the parameterized noncentral chi-square distribution.

Draw samples from a noncentral chi-square distribution.

See Also

Generator.noncentral_chisquare

which should be used for new code.

Examples

Draw values from the distribution and plot the histogram

This example is valid syntax, but we were not able to check execution
>>> import matplotlib.pyplot as plt  # doctest: +SKIP
... values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000), # doctest: +SKIP
...  bins=200, density=True)
... plt.show() # doctest: +SKIP

Draw values from a noncentral chisquare with very small noncentrality, and compare to a chisquare.

This example is valid syntax, but we were not able to check execution
>>> plt.figure()  # doctest: +SKIP
... values = plt.hist(np.random.noncentral_chisquare(3, .0000001, 100000), # doctest: +SKIP
...  bins=np.arange(0., 25, .1), density=True)
... values2 = plt.hist(np.random.chisquare(3, 100000), # doctest: +SKIP
...  bins=np.arange(0., 25, .1), density=True)
... plt.plot(values[1][0:-1], values[0]-values2[0], 'ob') # doctest: +SKIP
... plt.show() # doctest: +SKIP

Demonstrate how large values of non-centrality lead to a more symmetric distribution.

This example is valid syntax, but we were not able to check execution
>>> plt.figure()  # doctest: +SKIP
... values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000), # doctest: +SKIP
...  bins=200, density=True)
... plt.show() # doctest: +SKIP
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#338
type: <class 'function'>
Commit: