指数分布Exponential Distribution

引言

指数分布描述了随机再次发生的独立事件序列的到达时间。如果μ是未来一个新独立事件发生的平均等待时间,它的概率密度函数是:

density function

下图是 μ = 1时的指数分布的概率曲线

exp(x)

R实践

Density, distribution function, quantile function and random generation for the exponential distribution with rate rate (i.e., mean 1/rate).

这里的rate 就是公式中的 1/μ,就是速率rate 等于1除以平均等待时间.

# dexp gives the density
dexp(x, rate = 1, log = FALSE)

# pexp gives the distribution function
pexp(q, rate = 1, lower.tail = TRUE, log.p = FALSE)

# qexp gives the quantile function
qexp(p, rate = 1, lower.tail = TRUE, log.p = FALSE)

# rexp generates random deviates for the exponential distribution
rexp(n, rate = 1)

如果 rate 没有指定,则取默认值为 1.

Problem

假设超市收银员的平均结账时间是3分钟。计算收银员在两分钟内完成某个顾客的结账的概率。

Solution

结帐处理速度等于1除以平均结帐完成时间。因此,结帐处理速度是 每分钟1/3。然后我们应用指数分布的pexp函数,其速率为1/3。

Answer

> pexp(q = 2, rate = 1/3)
[1] 0.487

参考

原文地址:https://www.cnblogs.com/songbiao/p/12750547.html