scipy.special.nrdtrimn#
- scipy.special.nrdtrimn(p, std, x, out=None) = <wrapped_ufunc 'nrdtrimn'>#
Calculate mean of normal distribution given other params.
- Parameters:
- parray_like
CDF values, in range (0, 1].
- stdarray_like
Standard deviation.
- xarray_like
Quantiles, i.e. the upper limit of integration.
- outndarray, optional
Optional output array for the function results
- Returns:
- mnscalar or ndarray
The mean of the normal distribution.
See also
scipy.stats.normNormal distribution
ndtrStandard normal cumulative probability distribution
ndtriInverse of standard normal CDF with respect to quantile
nrdtrisdInverse of normal distribution CDF with respect to standard deviation
Notes
Array API Standard Support
nrdtrimnhas support for Python Array API Standard compatible backends in addition to NumPy. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
⛔
PyTorch
✅
⛔
JAX
✅
⛔
Dask
✅
n/a
For the NumPy backend, this function supports all NumPy ufunc keyword arguments. Other backends may support
out, but typically none of the other ufunc kwargs.outis typically supported for CuPy and PyTorch, but not currently in cases where SciPy relies on a generic Array API implementation or, for PyTorch on CPU, falls back to the NumPy backend.outis never supported for JAX because JAX arrays are immutable.nrdtrimndoes not currently supportoutfor the PyTorch backend.See Support for the array API standard for more information.
Examples
nrdtrimncan be used to recover the mean of a normal distribution if we know the CDF value p for a given quantile x and the standard deviation std. First, we calculate the normal distribution CDF for an exemplary parameter set.>>> from scipy.stats import norm >>> mean = 3. >>> std = 2. >>> x = 6. >>> p = norm.cdf(x, loc=mean, scale=std) >>> p 0.9331927987311419
Verify that
nrdtrimnreturns the original value for mean.>>> from scipy.special import nrdtrimn >>> nrdtrimn(p, std, x) 3.0000000000000004