2

我是 R 新手,使用 Weibull 分布函数时遇到问题。

我必须使用累积分布,所以我必须使用 pweibull 函数。我也知道形状必须在0.7到0.8之间。

 pweibull(q, shape, scale = 1, lower.tail = T, log.p = F)

现在到了棘手的部分,对于 q 参数,我需要传递通过 Weibull 逆计算的随机值,该逆将具有 0 和 1 之间的随机值作为输入。这个功能有用吗?

pdiweibull(x, q, beta)

总而言之,如果我创建一个包含 100 个随机数的向量,其值从 0 到 1,将其作为“x”参数传递给 pdiweibull,然后将该结果作为“q”参数传递给 pweibull,我是否将我的想法正确地转换为 R 代码?

4

1 回答 1

5

如果您对 Weibull 分布感兴趣,则不应使用“离散逆 Weibull 分布”,这是完全不同的。

而是只使用四个Weibull 分布函数

dweibull(x, shape, scale = 1, log = FALSE)
pweibull(q, shape, scale = 1, lower.tail = TRUE, log.p = FALSE)
qweibull(p, shape, scale = 1, lower.tail = TRUE, log.p = FALSE)
rweibull(n, shape, scale = 1)

对于密度、分布函数、分位数函数和随机值。

rweibull(100, shape=0.75, scale=1)将给出一百个值,可能是您想要的形式,qweibull(runif(100), shape=0.75, scale=1)或者可能类似于qweibull(x, shape=0.75, scale=1)where xis a vector of 100 random values between 0 and 1

于 2013-07-21T12:36:46.100 回答