Main Content

expinv

Exponential inverse cumulative distribution function

Description

x = expinv(p) returns the inverse cumulative distribution function (icdf) of the standard exponential distribution, evaluated at the values in p.

example

x = expinv(p,mu) returns the icdf of the exponential distribution with mean mu, evaluated at the values in p.

example

[x,xLo,xUp] = expinv(p,mu,pCov) also returns the 95% confidence interval [xLo,xUp] of x when mu is an estimate with variance pCov.

[x,xLo,xUp] = expinv(p,mu,pCov,alpha) specifies the confidence level for the confidence interval [xLo xUp] to be 100(1–alpha)%.

Examples

collapse all

Assume that the lifetime of light bulbs are exponentially distributed with a mean of 700 hours. Find the median lifetime using expinv.

expinv(0.50,700)
ans = 485.2030

Half of the light bulbs will burn out within the first 485 hours of use.

Find a confidence interval estimating the median using exponentially distributed data.

Generate a sample of 1000 exponentially distributed random numbers with mean 5.

rng('default') % For reproducibility
x = exprnd(5,100,1);

Estimate the mean with a confidence interval.

[muhat,muci] = expfit(x)
muhat = 4.5852
muci = 2×1

    3.8043
    5.6355

Estimate the variance of the mean estimate.

[~,pCov] = explike(muhat,x)
pCov = 0.2102

Create a confidence interval for the median.

[x,xLo,xUp] = expinv(0.5,muhat,pCov);
xCi = [xLo; xUp]
xCi = 2×1

    2.6126
    3.8664

Alternatively, compute a more accurate confidence interval for x by evaluating expinv on the confidence interval muci.

xCi2 = expinv(0.5,muci)
xCi2 = 2×1

    2.6369
    3.9062

Input Arguments

collapse all

Probability values at which to evaluate the icdf, specified as a scalar value or an array of scalar values, where each element is in the range [0,1].

  • To evaluate the icdf at multiple values, specify p using an array.

  • To evaluate the icdfs of multiple distributions, specify mu using an array.

If either or both of the input arguments p and mu are arrays, then the array sizes must be the same. In this case, expinv expands each scalar input into a constant array of the same size as the array inputs. Each element in x is the icdf value of the distribution specified by the corresponding element in mu, evaluated at the corresponding element in p.

Example: [0.1,0.5,0.9]

Data Types: single | double

Mean of the exponential distribution, specified as a positive scalar value or an array of positive scalar values.

  • To evaluate the icdf at multiple values, specify p using an array.

  • To evaluate the icdfs of multiple distributions, specify mu using an array.

If either or both of the input arguments p and mu are arrays, then the array sizes must be the same. In this case, expinv expands each scalar input into a constant array of the same size as the array inputs. Each element in x is the icdf value of the distribution specified by the corresponding element in mu, evaluated at the corresponding element in p.

Example: [1 2 3 5]

Data Types: single | double

Variance of the estimate of mu, specified as a positive scalar.

You can estimate mu from data by using expfit. You can then estimate the variance of mu by using explike. The resulting confidence interval bounds are based on a normal approximation for the distribution of the log of the mu estimate. You can get a more accurate set of bounds by applying expinv to the confidence interval returned by expfit. For an example, see Confidence Interval of Exponential icdf Value.

Example: 0.10

Data Types: single | double

Significance level for the confidence interval, specified as a scalar in the range (0,1). The confidence level is 100(1–alpha)%, where alpha is the probability that the confidence interval does not contain the true value.

Example: 0.01

Data Types: single | double

Output Arguments

collapse all

icdf values evaluated at the probability values in p, returned as a scalar value or an array of scalar values. x is the same size as p and mu after any necessary scalar expansion. Each element in x is the icdf value of the distribution specified by the corresponding element in mu, evaluated at the corresponding element in p.

Lower confidence bound for x, returned as a scalar value or an array of scalar values. xLo has the same size as x.

Upper confidence bound for x, returned as a scalar value or an array of scalar values. xUp has the same size as x.

More About

collapse all

Exponential icdf

The exponential distribution is a one-parameter family of curves. The parameter μ is the mean.

The icdf of the exponential distribution is

x=F1(p|μ)=μln(1p).

The result x is the value such that an observation from an exponential distribution with parameter µ will falls in the range [0,x] with probability p. A common alternative parameterization of the exponential distribution is to use λ defined as the mean number of events in an interval as opposed to μ, which is the mean wait time for an event to occur. λ and μ are reciprocals.

For more information, see Exponential Distribution.

Alternative Functionality

  • expinv is a function specific to the exponential distribution. Statistics and Machine Learning Toolbox™ also offers the generic function icdf, which supports various probability distributions. To use icdf, create an ExponentialDistribution probability distribution object and pass the object as an input argument or specify the probability distribution name and its parameters. Note that the distribution-specific function expinv is faster than the generic function icdf.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a