2017-08-15 119 views
3

我正在研究一个涉及组合两个威布尔分布并因此创建双峰值曲线的项目。然后,我的目标是使用这个预测。我在网上搜索,我似乎无法找到任何东西,或者如果R有一个函数,允许我结合两个Weibulls。 下面显示了我用来创建两个Weibull分布的代码,我希望这两个分布组合起来构成一个概率密度函数。结合R中的两个威布尔分布

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") 

任何帮助将是惊人的。

谢谢!

回答

3

结合概率分布然后使用最终列表的元素“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] 
+0

我觉得他说应该是双峰? –

+2

我明白问题不在于绘图......她有两个概率分布合并成一个单一的预测。看个人分布表明他们的组合不会产生双峰分布。 –

+0

可以放在一边,不应该还是双峰?如果不是,那么我不确定这是否正确地合并了分布? –