# Life Data Analysis Part II - Estimation Methods for Parametric Lifetime Models" In weibulltools: Statistical Methods for Life Data Analysis

knitr::opts_chunk$set( collapse = TRUE, screenshot.force = FALSE, comment = "#>" ) library(weibulltools)  This document introduces two methods for the parameter estimation of lifetime distributions. Whereas Rank Regression (RR) fits a straight line through transformed plotting positions (transformation is described precisely in vignette(topic = "Life_Data_Analysis_Part_I", package = "weibulltools")), Maximum likelihood (ML) strives to maximize a function of the parameters given the sample data. If the parameters are obtained, a cumulative distribution function (CDF) can be computed and added to a probability plot. In the theoretical part of this vignette the focus is on the two-parameter Weibull distribution. The second part is about the application of the provided estimation methods in weibulltools. All implemented models can be found in the help pages of rank_regression() and ml_estimation(). ## The Weibull Distribution The Weibull distribution is a continuous probability distribution, which is specified by the location parameter$\mu$and the scale parameter$\sigma$. Its CDF and PDF (probability density function) are given by the following formulas: $$F(t)=\Phi_{SEV}\left(\frac{\log(t) - \mu}{\sigma}\right)$$ $$f(t)=\frac{1}{\sigma t}\;\phi_{SEV}\left(\frac{\log(t) - \mu}{\sigma}\right)$$ The practical benefit of the Weibull in the field of lifetime analysis is that the common profiles of failure rates, which are observed over the lifetime of a large number of technical products, can be described using this statistical distribution. In the following, the estimation of the specific parameters$\mu$and$\sigma$is explained. ## Rank Regression (RR) In RR the CDF is linearized such that the true, unknown population is estimated by a straight line which is analytically placed among the plotting pairs. The lifetime characteristic, entered on the x-axis, is displayed on a logarithmic scale. A double-logarithmic representation of the estimated failure probabilities is used for the y-axis. Ordinary Least Squares (OLS) determines a best-fit line in order that the sum of squared deviations between this fitted regression line and the plotted points is minimized. In reliability analysis, it became prevalent that the line is placed in the probability plot in the way that the horizontal distances between the best-fit line and the points are minimized [^note1]. This procedure is called x on y rank regression. [^note1]: Berkson, J.: Are There Two Regressions?, Journal of the American Statistical Association 45 (250), DOI: 10.2307/2280676, 1950, pp. 164-180 The formulas for estimating the slope and the intercept of the regression line according to the described method are given below. Slope: $$\hat{b}=\frac{\sum_{i=1}^{n}(x_i-\bar{x})\cdot(y_i-\bar{y})}{\sum_{i=1}^{n}(y_i-\bar{y})^2}$$ Intercept: $$\hat{a}=\bar{x}-\hat{b}\cdot\bar{y}$$ With $$x_i=\log(t_i)\;;\; \bar{x}=\frac{1}{n}\cdot\sum_{i=1}^{n}\log(t_i)\;;$$ as well as $$y_i=\Phi^{-1}{SEV}\left[F(t)\right]=\log\left{-\log\left[1-F(t_i)\right]\right}\;and \; \bar{y}=\frac{1}{n}\cdot\sum{i=1}^{n}\log\left{-\log\left[1-F(t_i)\right]\right}.$$ The estimates of the intercept and slope are equal to the Weibull parameters$\mu$and$\sigma$, i.e. $$\hat{\mu}=\hat{a}$$ and $$\hat{\sigma}=\hat{b}.$$ In order to obtain the parameters of the shape-scale parameterization the intercept and the slope need to be transformed [^note2]. [^note2]: ReliaSoft Corporation: Life Data Analysis Reference Book, online: ReliaSoft, accessed 19 December 2020 $$\hat{\eta}=\exp(\hat{a})=\exp(\hat{\mu})$$ and $$\hat{\beta}=\frac{1}{\hat{b}}=\frac{1}{\hat{\sigma}}.$$ ## Maximum Likelihood (ML) The ML method of Ronald A. Fisher estimates the parameters by maximizing the likelihood function. Assuming a theoretical distribution, the idea of ML is that the specific parameters are chosen in such a way that the plausibility of obtaining the present sample is maximized. The likelihood and log-likelihood are given by the following equations: $$L = \prod_{i=1}^n\left{\frac{1}{\sigma t_i}\;\phi_{SEV}\left(\frac{\log(t_i) - \mu}{\sigma}\right)\right}$$ and $$\log L = \sum_{i=1}^n\log\left{\frac{1}{\sigma t_i}\;\phi_{SEV}\left(\frac{\log(t_i) - \mu}{\sigma}\right)\right}$$ Deriving and nullifying the log-likelihood function according to parameters results in two formulas that have to be solved numerically in order to obtain the estimates. In large samples, ML estimators have optimality properties. In addition, the simulation studies by Genschel and Meeker [^note3] have shown that even in small samples it is difficult to find an estimator that regularly has better properties than ML estimators. [^note3]: Genschel, U.; Meeker, W. Q.: A Comparison of Maximum Likelihood and Median-Rank Regression for Weibull Estimation, in: Quality Engineering 22 (4), DOI: 10.1080/08982112.2010.503447, 2010, pp. 236-255 ## Data To apply the introduced parameter estimation methods the shock and alloy datasets are used. ### Shock Absorber In this dataset kilometer-dependent problems that have occurred on shock absorbers are reported. In addition to failed items the dataset also contains non-defectives (censored) observations. The data can be found in Statistical Methods for Reliability Data [^note4]. [^note4]: Meeker, W. Q.; Escobar, L. A.: Statistical Methods for Reliability Data, New York, Wiley series in probability and statistics, 1998, p. 630 For consistent handling of the data, weibulltools introduces the function reliability_data() that converts the original dataset into a wt_reliability_data object. This formatted object allows to easily apply the presented methods. shock_tbl <- reliability_data(data = shock, x = distance, status = status) shock_tbl  ### Alloy T7989 The dataset alloy in which the cycles until a fatigue failure of a special alloy occurs are inspected. The data is also taken from Meeker and Escobar [^note5]. [^note5]: Meeker, W. Q.; Escobar, L. A.: Statistical Methods for Reliability Data, New York, Wiley series in probability and statistics, 1998, p. 131 Again, the data have to be formatted as a wt_reliability_data object: # Data: alloy_tbl <- reliability_data(data = alloy, x = cycles, status = status) alloy_tbl  ## RR and ML with Package weibulltools rank_regression() and ml_estimation() can be applied to complete data as well as failure and (multiple) right-censored data. Both methods can also deal with models that have a threshold parameter$\gamma\$.

In the following both methods are applied to the dataset shock.

### RR for two-parameter Weibull distribution

# rank_regression needs estimated failure probabilities:
shock_cdf <- estimate_cdf(shock_tbl, methods = "johnson")

# Estimating two-parameter Weibull:
rr_weibull <- rank_regression(shock_cdf, distribution = "weibull")
rr_weibull

# Probability plot:
weibull_grid <- plot_prob(
shock_cdf,
distribution = "weibull",
title_main = "Weibull Probability Plot",
title_x = "Mileage in km",
title_y = "Probability of Failure in %",
title_trace = "Defectives",
plot_method = "ggplot2"
)

weibull_plot <- plot_mod(
weibull_grid,
x = rr_weibull,
title_trace = "Rank Regression"
)

weibull_plot


### ML for two-parameter Weibull distribution

# Again estimating Weibull:
ml_weibull <- ml_estimation(
shock_tbl,
distribution = "weibull"
)

ml_weibull

# Add ML estimation to weibull_grid:
weibull_plot2 <- plot_mod(
weibull_grid,
x = ml_weibull,
title_trace = "Maximum Likelihood"
)

weibull_plot2


### ML for two- and three-parameter log-normal distribution

Finally, two- and three-parametric log-normal distributions are fitted to the alloy data using maximum likelihood.

# Two-parameter log-normal:
ml_lognormal <- ml_estimation(
alloy_tbl,
distribution = "lognormal"
)

ml_lognormal

# Three-parameter Log-normal:
ml_lognormal3 <- ml_estimation(
alloy_tbl,
distribution = "lognormal3"
)

ml_lognormal3


# Constructing probability plot:
tbl_cdf_john <- estimate_cdf(alloy_tbl, "johnson")

lognormal_grid <- plot_prob(
tbl_cdf_john,
distribution = "lognormal",
title_main = "Log-normal Probability Plot",
title_x = "Cycles",
title_y = "Probability of Failure in %",
title_trace = "Failed units",
plot_method = "ggplot2"
)

# Add two-parametric model to grid:
lognormal_plot <- plot_mod(
lognormal_grid,
x = ml_lognormal,
title_trace = "Two-parametric log-normal"
)

lognormal_plot


# Add three-parametric model to lognormal_plot:
lognormal3_plot <- plot_mod(
lognormal_grid,
x = ml_lognormal3,
title_trace = "Three-parametric log-normal"
)

lognormal3_plot


## Try the weibulltools package in your browser

Any scripts or data that you put into this service are public.

weibulltools documentation built on Jan. 16, 2021, 5:21 p.m.