# stats::binomialQuantile

Quantile function of the binomial distribution

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```stats::binomialQuantile(`n`, `p`)
```

## Description

`stats::binomialQuantile(n, p)` returns a procedure representing the quantile function (discrete inverse) of the cumulative distribution function `stats::binomialCDF(n, p)`. For 0 ≤ x ≤ 1, the quantile value k = stats::binomialQuantile(n, p)(x) satisfies

.

The procedure `f := stats::binomialQuantile(n, p)` can be called in the form `f(x)` with arithmetical expressions `x`. The return value of `f(x)` is either a natural number between 0 and n, or a symbolic expression:

• If n is a positive integer, p a real number satisfying 0 ≤ p ≤ 1, and x a real number satisfying 0 ≤ x ≤ 1, then f(x) returns an integer between 0 and n.

• If p = 0, then f(x) returns 0 for any values of n and x.

• If p = 1, then f(x) returns n for any values of n and x.

• For p ≠ 1, the call f(0) returns 0 for any value of n.

• For p ≠ 0, the call f(1) returns n for any value of n.

• In all other cases, `f(x)` returns the symbolic call `stats::binomialQuantile(n, p)(x)`.

Numerical values for `n` are only accepted if they are positive integers.

Numerical values for `p` are only accepted if they satisfy 0 ≤ p ≤ 1.

If floating-point arguments are passed to the quantile function f, the result is computed with floating-point arithmetic. This is faster than using exact arithmetic, but the result is subject to internal round-off errors. In particular, round-off may be significant for arguments x close to 1. Cf. Example 3.

## Environment Interactions

The function is sensitive to the environment variable `DIGITS` which determines the numerical working precision.

## Examples

### Example 1

We evaluate the quantile function with n = 30 and at some points:

```f := stats::binomialQuantile(30, 1/3): f(0), f((2/3)^30), f(PI/10), f(0.5), f(1 - 1/10^10)```

The quantile value f(x) satisfies

:

`x := 0.7: f(x)`

```stats::binomialCDF(30, 1/3)(float(f(x) - 1)), x, stats::binomialCDF(30, 1/3)(float(f(x)))```

`delete f, x:`

### Example 2

We use symbolic arguments:

`f := stats::binomialQuantile(n, p): f(x), f(9/10)`

When `n` and `p` evaluate to suitable numbers, the function `f` starts to produce quantile values:

```n := 80: p := 1/10: f(1/2), f(999/1000), f(1 - 1/10^10), f(1 - 1/10^80)```

`delete f, n, p:`

### Example 3

If floating-point arguments are passed to the quantile function, the result is computed with floating-point arithmetic. This is faster than using exact arithmetic, but the result is subject to internal round-off errors:

```f := stats::binomialQuantile(1000, 1/30): f(1 - 1/10^16) <> f(float(1 - 1/10^16))```

`delete f:`

## Parameters

 `n` The "trial parameter": an arithmetical expression representing a positive integer `p` The "probability parameter": an arithmetical expression representing a real number 0 ≤ p ≤ 1.