我正在开展一个项目,该项目涉及组合两个 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")
假设您想要感兴趣时间的概率
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/