package scipy

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `Geom_gen
]
type t = [ `Geom_gen | `Object | `Rv_discrete | `Rv_generic ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val as_rv_discrete : t -> [ `Rv_discrete ] Obj.t
val as_rv_generic : t -> [ `Rv_generic ] Obj.t
val create : ?a:Py.Object.t -> ?b:Py.Object.t -> ?name:Py.Object.t -> ?badvalue:Py.Object.t -> ?moment_tol:Py.Object.t -> ?values:Py.Object.t -> ?inc:Py.Object.t -> ?longname:Py.Object.t -> ?shapes:Py.Object.t -> ?extradoc:Py.Object.t -> ?seed:Py.Object.t -> unit -> t

A geometric discrete random variable.

%(before_notes)s

Notes ----- The probability mass function for `geom` is:

.. math::

f(k) = (1-p)^k-1 p

for :math:`k \ge 1`.

`geom` takes :math:`p` as shape parameter.

%(after_notes)s

See Also -------- planck

%(example)s

val cdf : ?kwds:(string * Py.Object.t) list -> k:[ `Ndarray of [> `Ndarray ] Np.Obj.t | `I of int ] -> Py.Object.t list -> [> tag ] Obj.t -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Cumulative distribution function of the given RV.

Parameters ---------- k : array_like, int Quantiles. arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information). loc : array_like, optional Location parameter (default=0).

Returns ------- cdf : ndarray Cumulative distribution function evaluated at `k`.

val entropy : ?kwds:(string * Py.Object.t) list -> Py.Object.t list -> [> tag ] Obj.t -> Py.Object.t

Differential entropy of the RV.

Parameters ---------- arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information). loc : array_like, optional Location parameter (default=0). scale : array_like, optional (continuous distributions only). Scale parameter (default=1).

Notes ----- Entropy is defined base `e`:

>>> drv = rv_discrete(values=((0, 1), (0.5, 0.5))) >>> np.allclose(drv.entropy(), np.log(2.0)) True

val expect : ?func:Py.Object.t -> ?args:Py.Object.t -> ?loc:float -> ?lb:Py.Object.t -> ?ub:Py.Object.t -> ?conditional:bool -> ?maxcount:int -> ?tolerance:float -> ?chunksize:int -> [> tag ] Obj.t -> float

Calculate expected value of a function with respect to the distribution for discrete distribution by numerical summation.

Parameters ---------- func : callable, optional Function for which the expectation value is calculated. Takes only one argument. The default is the identity mapping f(k) = k. args : tuple, optional Shape parameters of the distribution. loc : float, optional Location parameter. Default is 0. lb, ub : int, optional Lower and upper bound for the summation, default is set to the support of the distribution, inclusive (``ul <= k <= ub``). conditional : bool, optional If true then the expectation is corrected by the conditional probability of the summation interval. The return value is the expectation of the function, `func`, conditional on being in the given interval (k such that ``ul <= k <= ub``). Default is False. maxcount : int, optional Maximal number of terms to evaluate (to avoid an endless loop for an infinite sum). Default is 1000. tolerance : float, optional Absolute tolerance for the summation. Default is 1e-10. chunksize : int, optional Iterate over the support of a distributions in chunks of this size. Default is 32.

Returns ------- expect : float Expected value.

Notes ----- For heavy-tailed distributions, the expected value may or may not exist, depending on the function, `func`. If it does exist, but the sum converges slowly, the accuracy of the result may be rather low. For instance, for ``zipf(4)``, accuracy for mean, variance in example is only 1e-5. increasing `maxcount` and/or `chunksize` may improve the result, but may also make zipf very slow.

The function is not vectorized.

val freeze : ?kwds:(string * Py.Object.t) list -> Py.Object.t list -> [> tag ] Obj.t -> Py.Object.t

Freeze the distribution for the given arguments.

Parameters ---------- arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution. Should include all the non-optional arguments, may include ``loc`` and ``scale``.

Returns ------- rv_frozen : rv_frozen instance The frozen distribution.

val generic_moment : ?kwargs:(string * Py.Object.t) list -> Py.Object.t list -> [> tag ] Obj.t -> Py.Object.t

Non-central moment of discrete distribution.

val interval : ?kwds:(string * Py.Object.t) list -> alpha:[> `Ndarray ] Np.Obj.t -> Py.Object.t list -> [> tag ] Obj.t -> Py.Object.t

Confidence interval with equal areas around the median.

Parameters ---------- alpha : array_like of float Probability that an rv will be drawn from the returned range. Each value should be in the range 0, 1. arg1, arg2, ... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information). loc : array_like, optional location parameter, Default is 0. scale : array_like, optional scale parameter, Default is 1.

Returns ------- a, b : ndarray of float end-points of range that contain ``100 * alpha %`` of the rv's possible values.

val isf : ?kwds:(string * Py.Object.t) list -> q:[> `Ndarray ] Np.Obj.t -> Py.Object.t list -> [> tag ] Obj.t -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Inverse survival function (inverse of `sf`) at q of the given RV.

Parameters ---------- q : array_like Upper tail probability. arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information). loc : array_like, optional Location parameter (default=0).

Returns ------- k : ndarray or scalar Quantile corresponding to the upper tail probability, q.

val logcdf : ?kwds:(string * Py.Object.t) list -> k:[ `Ndarray of [> `Ndarray ] Np.Obj.t | `I of int ] -> Py.Object.t list -> [> tag ] Obj.t -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Log of the cumulative distribution function at k of the given RV.

Parameters ---------- k : array_like, int Quantiles. arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information). loc : array_like, optional Location parameter (default=0).

Returns ------- logcdf : array_like Log of the cumulative distribution function evaluated at k.

val logpmf : ?kwds:(string * Py.Object.t) list -> k:[> `Ndarray ] Np.Obj.t -> Py.Object.t list -> [> tag ] Obj.t -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Log of the probability mass function at k of the given RV.

Parameters ---------- k : array_like Quantiles. arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information). loc : array_like, optional Location parameter. Default is 0.

Returns ------- logpmf : array_like Log of the probability mass function evaluated at k.

val logsf : ?kwds:(string * Py.Object.t) list -> k:[> `Ndarray ] Np.Obj.t -> Py.Object.t list -> [> tag ] Obj.t -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Log of the survival function of the given RV.

Returns the log of the 'survival function,' defined as 1 - `cdf`, evaluated at `k`.

Parameters ---------- k : array_like Quantiles. arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information). loc : array_like, optional Location parameter (default=0).

Returns ------- logsf : ndarray Log of the survival function evaluated at `k`.

val mean : ?kwds:(string * Py.Object.t) list -> Py.Object.t list -> [> tag ] Obj.t -> float

Mean of the distribution.

Parameters ---------- arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information) loc : array_like, optional location parameter (default=0) scale : array_like, optional scale parameter (default=1)

Returns ------- mean : float the mean of the distribution

val median : ?kwds:(string * Py.Object.t) list -> Py.Object.t list -> [> tag ] Obj.t -> float

Median of the distribution.

Parameters ---------- arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information) loc : array_like, optional Location parameter, Default is 0. scale : array_like, optional Scale parameter, Default is 1.

Returns ------- median : float The median of the distribution.

See Also -------- rv_discrete.ppf Inverse of the CDF

val moment : ?kwds:(string * Py.Object.t) list -> n:[ `N_1 of Py.Object.t | `I of int ] -> Py.Object.t list -> [> tag ] Obj.t -> Py.Object.t

n-th order non-central moment of distribution.

Parameters ---------- n : int, n >= 1 Order of moment. arg1, arg2, arg3,... : float The shape parameter(s) for the distribution (see docstring of the instance object for more information). loc : array_like, optional location parameter (default=0) scale : array_like, optional scale parameter (default=1)

val pmf : ?kwds:(string * Py.Object.t) list -> k:[> `Ndarray ] Np.Obj.t -> Py.Object.t list -> [> tag ] Obj.t -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Probability mass function at k of the given RV.

Parameters ---------- k : array_like Quantiles. arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information) loc : array_like, optional Location parameter (default=0).

Returns ------- pmf : array_like Probability mass function evaluated at k

val ppf : ?kwds:(string * Py.Object.t) list -> q:[> `Ndarray ] Np.Obj.t -> Py.Object.t list -> [> tag ] Obj.t -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Percent point function (inverse of `cdf`) at q of the given RV.

Parameters ---------- q : array_like Lower tail probability. arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information). loc : array_like, optional Location parameter (default=0).

Returns ------- k : array_like Quantile corresponding to the lower tail probability, q.

val rvs : ?kwargs:(string * Py.Object.t) list -> Py.Object.t list -> [> tag ] Obj.t -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Random variates of given type.

Parameters ---------- arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information). loc : array_like, optional Location parameter (default=0). size : int or tuple of ints, optional Defining number of random variates (Default is 1). Note that `size` has to be given as keyword, not as positional argument. random_state : None or int or ``np.random.RandomState`` instance, optional If int or RandomState, use it for drawing the random variates. If None, rely on ``self.random_state``. Default is None.

Returns ------- rvs : ndarray or scalar Random variates of given `size`.

val sf : ?kwds:(string * Py.Object.t) list -> k:[> `Ndarray ] Np.Obj.t -> Py.Object.t list -> [> tag ] Obj.t -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Survival function (1 - `cdf`) at k of the given RV.

Parameters ---------- k : array_like Quantiles. arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information). loc : array_like, optional Location parameter (default=0).

Returns ------- sf : array_like Survival function evaluated at k.

val stats : ?kwds:(string * Py.Object.t) list -> Py.Object.t list -> [> tag ] Obj.t -> Py.Object.t

Some statistics of the given RV.

Parameters ---------- arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information) loc : array_like, optional location parameter (default=0) scale : array_like, optional (continuous RVs only) scale parameter (default=1) moments : str, optional composed of letters 'mvsk' defining which moments to compute: 'm' = mean, 'v' = variance, 's' = (Fisher's) skew, 'k' = (Fisher's) kurtosis. (default is 'mv')

Returns ------- stats : sequence of requested moments.

val std : ?kwds:(string * Py.Object.t) list -> Py.Object.t list -> [> tag ] Obj.t -> float

Standard deviation of the distribution.

Parameters ---------- arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information) loc : array_like, optional location parameter (default=0) scale : array_like, optional scale parameter (default=1)

Returns ------- std : float standard deviation of the distribution

val support : ?kwargs:(string * Py.Object.t) list -> Py.Object.t list -> [> tag ] Obj.t -> Py.Object.t

Return the support of the distribution.

Parameters ---------- arg1, arg2, ... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information). loc : array_like, optional location parameter, Default is 0. scale : array_like, optional scale parameter, Default is 1. Returns ------- a, b : float end-points of the distribution's support.

val var : ?kwds:(string * Py.Object.t) list -> Py.Object.t list -> [> tag ] Obj.t -> float

Variance of the distribution.

Parameters ---------- arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution (see docstring of the instance object for more information) loc : array_like, optional location parameter (default=0) scale : array_like, optional scale parameter (default=1)

Returns ------- var : float the variance of the distribution

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Format.formatter -> t -> unit

Pretty-print the object to a formatter.

OCaml

Innovation. Community. Security.