# Predict Failure time/ Weibull analysis

Suppose I want to predict how many machine are going to fail in the next three years. The data collected are in days, so we want to predict no. of fails in next 1095 days.

All the machines (100 of them) started from, say, 1975 and until today, only 13 have failed. Now, I want to predict how many are going to fail in the next three years.

Some of the issues I encountered, in my opinion:

1. Ideally, we have the fixed time to run the tests on these machines, BUT in this case, we don't have the fixed time. I can assume today's date as the final date, that is, my testing time interval is [1975, Today's date]

2. So, I have to put all the other machines that didn't fail as Censored observation.

3. BUT when I do that, the data does not follow, I believe, Weibull distribution, a standard process to analyze failure times (Weibull analysis).

4. Do we have enough data to come up with an appropriate model? And if this is what we have to work with, how can we do that?

5. Can we still use Weibull analysis approach for this case, and estimate the scale and shape parameter and use it to find the expected no. of failures given by:

       N(t)=(1-e^(t/a)^b)n


where a is the scale parameter and b is the shape parameter; n is the population of machines which began operating continuously at the same time t=0

Here are some of the arbitrary failure times ( I cannot share the data due to confidentiality issues):

10162, 8300, 11110, 11520, 11520, 8460, 7320, 11424, 11112, 11321, 11584, 10436, 9560


These are given in days from, say Jan 1, 1975. These are the machines that are built to last, so it is not uncommon to see these kind of minimal failure rates.

The precision of survival analysis is typically limited by the number of events. A rule of thumb is that you need about 15 events per parameter that you want to fit; you only have 13 events while a Weibull (and many parametric survival models) has 2 parameters. I'm not sure that there are enough events to rule out a Weibull distribution, but there are many other distribution famililes provided in R packages like survival and flexsurv that you could try, and those packages also let you define your own distributions.

The problems with extrapolation from so few events can be illustrated with a Weibull model of the 13 failure times that you provided. Censoring the other 87 cases at the last event time, 11584 days, putting the data together into a data frame, and fitting and plotting with the flexsurv package gives the following:

ftimes <- c(10162, 8300, 11110, 11520, 11520, 8460, 7320, 11424, 11112, 11321, 11584, 10436, 9560)
allTimes <- c(ftimes,rep(11584,87))
events <- c(rep(1,13),rep(0,87))
failDF <- data.frame(time=allTimes,event=events)
library(flexsurv)
weiFit <- flexsurvreg(Surv(time,event)~1,data=failDF,dist="weibull")
plot(weiFit,t=seq(6000,15000,length.out=100),xlim=c(6000,15000),bty="n",xlab="Days",ylab="Survivl Probability")
abline(v=12679) This superimposes the Weibull fit and its 95% confidence intervals (in red) over the Kaplan-Meier plot of the observations (in black). The vertical line is a prediction time 1095 days after the last event time. The point estimate of survival at that time is 75% (or 75 out of 100 original units still in service at that time), but the 95% confidence interval covers a range from about 40% to 84%.

So you might estimate a loss of 12 more units over the next 1095 days, but it could reasonably be as few as 3 more or as many as 47 more. I played with a few other distributions (gamma, lognormal, loglogistic); the Weibull was the most conservative among them, with the widest confidence interval.