使用fitdistr()计算形状和比例参数但是按标签和代码分组[使用威布尔分布技术进行可靠性建模]

时间:2017-05-17 14:23:33

标签: r reliability weibull

Hello Every One此帖子的早期我已经发布了可重现的示例,它可以正常使用可重现的数据,但我尝试使用实际数据它给出了错误Error in summarise_impl(.data, dots) : optimization failed所以这里是实际的一瞥我得到一个错误,我对错误一无所知,因为如果它使用可重现的数据它应该运行完全相同。我还粘贴了下面的示例代码。

Tag= c("Z52" ,"Z52","Z66 - ZARK II","Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z82 V3","Z82 V3","Z82 V3","Z52","Z52","Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z82 V3","Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z82 V3","Z82 V3"        ,"Z88","Z88","Z88","Z52","Z82 V3","Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z82 V3","Z52","Z88","Z88","Z52" ,"Z88","Z82 V3","Z88","Z82 V3","Z82 V3","Z82 V3","Z88","Z88","Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z88","Z66 - ZARK II" ,"Z88"           ,"Z52","Z52","Z52","Z52","Z52","Z52","Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II","Z88","Z82 V3","Z82 V3","Z88","Z88","Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z52","Z52","Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II","Z66 - ZARK II" ,"Z82 V3","Z66 - ZARK II" ,"Z82 V3","Z88","Z82 V3","Z88","Z88","Z66 - ZARK II","Z82 V3","Z82 V3" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z82 V3","Z88","Z88","Z82 V3","Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z66 - ZARK II" ,"Z88"           ,"Z66 - ZARK II" ,"Z66 - ZARK II","Z66 - ZARK II" )
code = c(   270 ,270 ,269 ,135 ,135 ,135 ,331 ,331 ,331 ,136 ,270 ,269 ,269 ,283 ,135 ,135 ,331 ,331 ,432 ,432 ,283 ,270 ,283 ,135 ,135 ,331 ,136  ,94 ,125 ,136 ,254 ,103 ,283 ,214 ,214 ,214 ,283 ,149  ,51
             ,269 ,269 ,135  ,94 ,136 ,127 ,270 ,270 ,270 ,270 ,270 ,270 ,51 ,269 ,269 ,364 ,283 ,283  ,94 ,364 ,214  ,51 ,213 ,270  ,51 ,269 ,270 ,269 ,269 ,135 ,135 ,135 ,135 ,270 ,103 ,127 ,103  ,10  ,10
             ,283 ,283 ,212 ,103 ,250 ,137 ,137 ,137  ,10  ,10  ,95 ,103 ,269 ,269 ,270 ,269 ,269 ,269  ,10 ,137 ,137 ,137)
life = c(  1645 ,1645 ,1645 ,1645 ,1645 ,1645 ,1645 ,1645 ,1645 ,1645 ,1646 ,1646 ,1646 ,1646 ,1646 ,1646 ,1646 ,1646 ,1647 ,1647 ,1647 ,1647 ,1647 ,1647 ,1647 ,1647 ,1647 ,1648 ,1648 ,1648 ,1648
               ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1651 ,1651 ,1651
               ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1652 ,1652 ,1652 ,1653 ,1653 ,1653 ,1653 ,1653 ,1653 ,1654 ,1654 ,1654 ,1654 ,1654 ,1654 ,1654 ,1654 ,1654 ,1654
               ,1654 ,1654 ,1654 ,1654 ,1655 ,1655 ,1655)

R代码:

df=data.frame(Tag=Tag,Err_code=code,Life=life)

library(MASS)
library(dplyr)
by_ME<- group_by(df,Tag,Err_code)
fg1 <- summarise(by_ME,
                 shape_P=fitdistr(Life, "weibull")$estimate[1],
                 scale_P=fitdistr(Life, "weibull")$estimate[2],
                 n=n())

观察到错误
Error in summarise_impl(.data, dots) : optimization failed

0 个答案:

没有答案