loglik_profiling: Log-Likelihood Profile Function for Parametric Lifetime...

Description Usage Arguments Value References Examples

View source: R/ml_estimation.R

Description

This function evaluates the log-likelihood with respect to a given threshold parameter of a three-parametric lifetime distribution. In terms of Maximum Likelihood Estimation this function can be optimized (optim) to estimate the threshold parameter.

Usage

1
2
3
4
5
6
loglik_profiling(
  x,
  status,
  thres,
  distribution = c("weibull3", "lognormal3", "loglogistic3")
)

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).

thres

A numeric value for the threshold parameter.

distribution

Supposed three-parametric distribution of the random variable.

Value

Returns the log-likelihood value for the data with respect to the threshold parameter thres.

References

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Vectors:
cycles <- alloy$cycles
status <- alloy$status

# Determining the optimal loglikelihood value:
## Range of threshold parameter must be smaller than the first failure:
threshold <- seq(
  0,
  min(cycles[status == 1]) - 0.1,
  length.out = 50
)

## loglikelihood value with respect to threshold values:
profile_logL <- loglik_profiling(
  x = cycles,
  status = status,
  thres = threshold,
  distribution = "weibull3"
)

## Threshold value (among the candidates) that maximizes the
## loglikelihood:
threshold[which.max(profile_logL)]

## plot:
plot(
  threshold,
  profile_logL,
  type = "l"
)
abline(
  v = threshold[which.max(profile_logL)],
  h = max(profile_logL),
  col = "red"
)

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