Skip to contents

To run a Weibull Analysis, start by loading WeibullR and WeibullR.plotly

A Basic Example

Next, create some failure data for 5 different machines that fail at time 30, 49, 82, 90, and 96 respectively.

failures <- c(30, 49, 82, 90, 96)

Then use the WeibullR package to fit a Weibull distribution to the data, and the plotly_wblr() function to create a probability plot.

obj <- wblr.conf(wblr.fit(wblr(failures)))
plotly_wblr(obj)

Right Censored Model

Let’s add right censored data to the previous example. In addition to the 5 machines that failed, add suspensions for 3 machines that did not fail (right censored) at times 100, 45, and 10 respectively.

suspensions <- c(100, 45, 10)
obj <- wblr.conf(wblr.fit(wblr(failures, suspensions)))
plotly_wblr(obj, suspensions, fitCol = 'blue', confCol = 'blue')

Interval Censored Model

To create an interval censored model, let’s use the inspection data from Silkworth, 2020.

inspection_data <- data.frame(left=c(0, 6.12, 19.92, 29.64, 35.4, 39.72, 45.32, 52.32),
                            right=c(6.12, 19.92, 29.64, 35.4, 39.72, 45.32, 52.32, 63.48),
                            qty=c(5, 16, 12, 18, 18, 2, 6, 17))

Then add suspension data for units surviving until the last inspection date.

suspensions <- data.frame(time = 63.48, event = 0, qty = 73)

Finally, add a fit and plot the results.

obj <- wblr(suspensions, interval = inspection_data)
obj <- wblr.fit(obj, method.fit = "mle") 
obj <- wblr.conf(obj, method.conf = "fm", lty = 2)
suspensions <- as.vector(suspensions$time)
plotly_wblr(obj, susp = suspensions, fitCol = 'red', confCol = 'red', intCol = 'blue', 
            main = 'Parts Cracking Inspection Interval Analysis', 
            ylab =  'Cumulative % Cracked', xlab='Inspection Time')

3-Parameter Weibull Model

To fit a 3P Weibull, let’s create some new failure data and plot the results.

failures <- c(25, 30, 42, 49, 55, 67, 73, 82, 90, 96, 101, 110, 120, 132, 145)
fit <- wblr.conf(wblr.fit(wblr(failures), dist = "weibull3p"))
plotly_wblr(fit, fitCol='darkgreen', confCol = 'darkgreen')

Contour Plots

To build a contour plot, let’s rerun the first example and use the plotly_contour() function to create a plot.

failures <- c(30, 49, 82, 90, 96)
obj <- wblr.conf(wblr.fit(wblr(failures), method.fit = 'mle'), method.conf = 'lrb')
plotly_contour(obj, col = "blue")