2

A mechanical component was run continuously till it failed (test-to-failure). We have data of one such experiment.

Data Dictionary

  1. age --> time in mins.
  2. life_per --> age/total time to failure

  3. life_status --> faliure==1 and 0== non failure (note: we only have 1 record with life_status=1 i.e. the time/age when it failed)

  4. feature1 --> covariate/sensor reading taken the component.

enter image description here

Note: only the begining and ending of the data is showning the image.

From this data how do I calculate the Weibull hazard rate function for feature1 variable in R or Python?

I tried the below code.

Code (reference 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)

Formulas from https://warwick.ac.uk/fac/sci/wmg/ftmsc/modules/modulelist/peuss/slides/section_8b_peussdistributions_2_slides_compatibility_mode.pdf

enter image description here enter image description here Questions

  1. Is the hazard rate function for feature1 calculated the correct way in the code? In the code hazard function is not at all a function of time or age component. I thought hazard function should always be function of time.
  2. In the formula it seems that hazard function is a function of time. So I am confused on whether hazard function for feature1 should be calculated based on time or without it.
GeorgeOfTheRF
  • 8,244
  • 23
  • 57
  • 80
  • That is impossible. You have one observation; a Weibull distribution has two parameters. You could try an exponential distribution (which has a fixed hazard); you don't need any code for this: the hazard or lambda will be `1/1730` per minute. – Jan van der Laan Jan 11 '18 at 12:45
  • I want to calculate hazard failure rate for feature1 variable. I have updated the question with more explanation. – GeorgeOfTheRF Jan 11 '18 at 12:48
  • What is the cdf calculated for single variable here then? https://stackoverflow.com/questions/15303310/weibull-cumulative-distribution-function-starting-from-fitdistr-command – GeorgeOfTheRF Jan 11 '18 at 12:50
  • There were multiple time observations (each with an implicit event) in the example you cited. You only have one event. Come on people. Let's close this question. It's not even on-topic. Not to mention that it was answered by Jan van der Laan. – IRTFM Jan 14 '18 at 23:59

0 Answers0