结合R中的两个Weibull分布 [英] Combining two Weibull distributions in R

查看:50
本文介绍了结合R中的两个Weibull分布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事一个项目,该项目涉及合并两个Weibull分布,从而创建双峰曲线.然后,我打算以此为基础进行预测.我已经在网上搜索过,但似乎找不到任何内容,或者R是否具有允许我组合两个Weibulls的功能.下面显示了我用来创建两个Weibull分布的代码,我希望将它们组合在一起以构成一个单一的概率密度函数.

I am working on a project which involves combining two Weibull distributions and thus creating a double peaked curve. I then aim to make predictions using this. I have searched online and I can't seem to find anything on this or if R has a function that allows me to combine two Weibulls. Below shows the code I have used to create the two Weibull distributions I wish to combine to make one single probability density function.

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.

Would it make sense to combine the probability distributions and then use the element "y" of your final list to make predictions? If so, this should work. The final AUC is still ~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")

说您想要在感兴趣的时间出现概率

Say you want the probability at a time of interest

t1 = 30

在您拥有的x中搜索并找到最接近t1的x,然后返回相应的y

Search among the x you have and find the closest to t1 and then return the corresponding y

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

这篇关于结合R中的两个Weibull分布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆