loglik_profiling {weibulltools} | R Documentation |
Log-Likelihood Profile Function for Parametric Lifetime Distributions with Threshold
Description
This function evaluates the log-likelihood with respect to a given threshold parameter of a parametric lifetime distribution. In terms of Maximum Likelihood Estimation this function can be optimized (optim) to estimate the threshold parameter.
Usage
loglik_profiling(x, ...)
## S3 method for class 'wt_reliability_data'
loglik_profiling(
x,
wts = rep(1, nrow(x)),
thres,
distribution = c("weibull3", "lognormal3", "loglogistic3", "exponential2"),
...
)
Arguments
x |
A |
... |
Further arguments passed to or from other methods. Currently not used. |
wts |
Optional vector of case weights. The length of |
thres |
A numeric value for the threshold parameter. |
distribution |
Supposed parametric distribution of the random variable. |
Value
Returns the log-likelihood value for the threshold parameter thres
given
the data.
References
Meeker, William Q; Escobar, Luis A., Statistical methods for reliability data, New York: Wiley series in probability and statistics, 1998
Examples
# Reliability data preparation:
data <- reliability_data(
alloy,
x = cycles,
status = status
)
# Determining the optimal loglikelihood value:
## Range of threshold parameter must be smaller than the first failure:
threshold <- seq(
0,
min(data$x[data$status == 1]) - 0.1,
length.out = 50
)
## loglikelihood value with respect to threshold values:
profile_logL <- loglik_profiling(
x = data,
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"
)