loglik_function.default: Log-Likelihood Function for Parametric Lifetime Distributions

View source: R/likelihood_functions.R

loglik_function.defaultR Documentation

Log-Likelihood Function for Parametric Lifetime Distributions

Description

This function computes the log-likelihood value with respect to a given set of parameters. In terms of Maximum Likelihood Estimation this function can be optimized (optim) to estimate the parameters and variance-covariance matrix of the parameters.

Usage

## Default S3 method:
loglik_function(
  x,
  status,
  wts = rep(1, length(x)),
  dist_params,
  distribution = c("weibull", "lognormal", "loglogistic", "sev", "normal", "logistic",
    "weibull3", "lognormal3", "loglogistic3", "exponential", "exponential2"),
  ...
)

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 a unit is a right censored observation (= 0) or a failure (= 1).

wts

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

dist_params

A vector of parameters. An overview of the distribution-specific parameters can be found in section 'Distributions'.

distribution

Supposed distribution of the random variable.

...

Further arguments passed to or from other methods. Currently not used.

Value

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

Distributions

The following table summarizes the available distributions and their parameters

  • location parameter \mu,

  • scale parameter \sigma or \theta and

  • threshold parameter \gamma.

The order within dist_params is given in the table header.

distribution dist_params[1] dist_params[2] dist_params[3]
"sev" \mu \sigma -
"weibull" \mu \sigma -
"weibull3" \mu \sigma \gamma
"normal" \mu \sigma -
"lognormal" \mu \sigma -
"lognormal3" \mu \sigma \gamma
"logistic" \mu \sigma -
"loglogistic" \mu \sigma -
"loglogistic3" \mu \sigma \gamma
"exponential" \theta - -
"exponential2" \theta \gamma -

References

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

See Also

loglik_function

Examples

# 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"
)


weibulltools documentation built on April 5, 2023, 5:10 p.m.