机械组件连续运行直至失败(测试失败)。我们有一个这样的实验数据。
数据字典
life_per - >年龄/总失败时间
life_status - > faliure == 1和0 ==非失败(注意:我们只有1 记录life_status = 1,即失败的时间/年龄
注意:只显示数据的开头和结尾。
从这些数据中我如何计算R或Python中feature1变量的Weibull危险率函数?
我尝试了以下代码。
代码(参考Weibull cumulative distribution function starting from "fitdistr" command)
fit_dist<-fitdist(base$feature1,"weibull",lower = c(0, 0), start = list(scale = 1, shape = 1))
rms_coefficients<-matrix(coef(fit_dist))
rownames(rms_coefficients)<-c("scale","shape")
rms_pdf<-dweibull(base$feature1,shape=rms_coefficients["shape",1],scale=rms_coefficients["scale",1])
rms_cdf<-1-exp(-((base$feature1/rms_coefficients["scale",1])^rms_coefficients["shape",1]))
hazard_rate_fun_feature1 <-rms_pdf/(1-rms_cdf)
来自https://warwick.ac.uk/fac/sci/wmg/ftmsc/modules/modulelist/peuss/slides/section_8b_peussdistributions_2_slides_compatibility_mode.pdf 的公式