Learn R Programming

weibulltools (version 2.0.0)

loglik_function: Log-Likelihood Function for Parametric Lifetime Distributions

Description

This function computes the log-likelihood value with respect to a given set of parameters. For two-parametric models the location and scale parameters are required. If a three-parametric lifetime distribution is needed an additional threshold parameter has to be provided. In terms of Maximum Likelihood Estimation this function can be optimized (optim) to estimate the parameters and variance-covariance matrix of the parameters.

Usage

loglik_function(
  x,
  status,
  wts = rep(1, length(x)),
  dist_params,
  distribution = c("weibull", "lognormal", "loglogistic", "normal", "logistic", "sev",
    "weibull3", "lognormal3", "loglogistic3")
)

Value

Returns the log-likelihood value for the data with respect to the parameters given in dist_params.

Arguments

x

A numeric vector which consists of lifetime data. Lifetime data could be every characteristic influencing the reliability of a product, e.g. operating time (days/months in service), mileage (km, miles), load cycles.

status

A vector of binary data (0 or 1) indicating whether unit i is a right censored observation (= 0) or a failure (= 1).

wts

Optional vector of case weights. The length of wts must be the same as the number of observations in x.

dist_params

A (named) numeric vector of (log-)location-scale parameters in the order of location (\(\mu\)) and scale (\(\sigma\)). If a three-parametric model is selected, the threshold parameter (\(\gamma\)) has to be the third element.

distribution

Supposed distribution of the random variable.

References

Meeker, William Q; Escobar, Luis A., Statistical methods for reliability data, New York: Wiley series in probability and statistics, 1998

Examples

Run this code
# Vectors:
cycles <- alloy$cycles
status <- alloy$status

# Example 1 - Evaluating Log-Likelihood function of two-parametric weibull:
loglik_weib <- loglik_function(
  x = cycles,
  status = status,
  dist_params = c(5.29, 0.33),
  distribution = "weibull"
)

# Example 2 - Evaluating Log-Likelihood function of three-parametric weibull:
loglik_weib3 <- loglik_function(
  x = cycles,
  status = status,
  dist_params = c(4.54, 0.76, 92.99),
  distribution = "weibull3"
)

Run the code above in your browser using DataLab