r - 在 R 中组合两个 Weibull 分布

标签 r statistics distribution weibull

我正在开展一个项目,该项目涉及组合两个 Weibull 分布,从而创建双峰曲线。然后我的目标是使用它进行预测。我在网上搜索过,似乎找不到任何关于此的内容,或者 R 是否具有允许我组合两个 Weibulls 的功能。 下面显示了我用来创建两个 Weibull 分布的代码,我希望将它们组合起来形成一个概率密度函数。

curve(dweibull(x, scale=30.59898985, shape=2.27136646),from=0, to=70, main="Weibull distribution")
curve(dweibull(x, scale=19.39743639, shape=1.22800332),from=0, to=70, main="Weibull distribution")

任何帮助都会很棒。

谢谢!

最佳答案

合并概率分布然后使用最终列表的元素“y”进行预测是否有意义?如果是这样,这应该有效。最终的 AUC 仍然是 ~1。

dwb1 <- curve(dweibull(x, scale=30.59898985, shape=2.27136646),from=0, to=70, main="Weibull distribution")
dwb2 <- curve(dweibull(x, scale=19.39743639, shape=1.22800332),from=0, to=70, main="Weibull distribution")

# combine
final.dwb <- lapply(c("x", "y"), (function(i){
  (dwb1[[i]] + dwb2[[i]])/2
}))
names(final.dwb) <- c("x", "y")

# plot
plot(final.dwb$y ~ final.dwb$x, xlim=c(0,70), main = "combined Weibull distributions", type = "n", las = 2)
lines(final.dwb$y ~ final.dwb$x, xlim=c(0,70), main = "combined Weibull distributions")

Combined distribution plot

假设您想要感兴趣时间的概率

t1 = 30

在你有的x中查找最接近t1的然后返回对应的y

id <- which.min(abs(t1 - final.dwb$x))
final.dwb$y[id]

关于r - 在 R 中组合两个 Weibull 分布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45694550/

相关文章:

R 如何根据另一个变量的范围获得一个变量的平均值?

r - dplyr:根据列的匹配字符串改变列

statistics - 检测以特定频率生成的数据模式

python - 获取给定累积概率的随机变量的值 (Python)

r - 如何可视化概率分布函数之间的差异?

r - ggplot 不会标记点

r - r.squaredGLMM() 错误

algorithm - 如何开发一个程序来最大限度地减少手写调查的人工转录错误

algorithm - 根据正常运行时间/重启创建计算设备 "health"的公式

python - 将独立的Python应用程序分发到其他机器