Learn R Programming

weibulltools (version 1.0.1)

delta_method: Delta Method for Parametric Lifetime Distributions

Description

The Delta Method estimates the standard error for quantities that can be written as non-linear functions of ML estimators like quantiles. I.e. the (log-)location-scale (and threshold) parameters and variance-covariance matrix of these need to be estimated by Maximum Likelihood.

Usage

delta_method(p, loc_sc_params, loc_sc_varcov, distribution = c("weibull",
  "lognormal", "loglogistic", "normal", "logistic", "sev", "weibull3",
  "lognormal3", "loglogistic3"), direction = c("y", "x"))

Arguments

p

a numeric value of a probability or a quantile. If the standard error of quantile is of interest a specific probability needs to be supplied and if the standard error of a standardized quantile (z-value) should be calculated a specific quantile should be provided.

loc_sc_params

a (named) numeric vector of estimated (by Maximum Likelihood) location and scale parameters for a specified distribution. The order of elements is important. First entry needs to be the location parameter \(\mu\) and the second element needs to be the scale parameter \(\sigma\). If a three-parametric model is used the third element is the threshold parameter \(\gamma\).

loc_sc_varcov

a (named) numeric matrix of estimated (by Maximum Likelihood) location and scale variances and covariances for a specified distribution. The order of elements is important. First entry of the diagonal needs to be the variance of the location parameter Var(\(\mu\)) and the second element of the diagonal needs to be the variance of the scale parameter Var(\(\sigma\)). If a three-parametric model is used the third element of the diagonal needs to be the variance of the threshold parameter Var(\(\gamma\)).

distribution

supposed distribution of the random variable. The value can be "weibull", "lognormal", "loglogistic", "normal", "logistic", "sev" (smallest extreme value), "weibull3", "lognormal3" or "loglogistic3". Other distributions have not been implemented yet.

direction

a character string specifying the direction of the computed standard errors. Must be either "y" (used for confidence intervals of failure probabilities in confint_fisher) or "x" (used for confidence intervals of quantiles in confint_fisher). If p is a quantile then direction needs to be "y" and vice versa.

Value

A numeric value with estimated standard errors of quantiles or standardized z values. Both are required for the computation of normal approximation confidence intervals. If standard errors of standardized z values are compueted one can calculate confidence intervals for distribution probabilities (z-procedure, which is used inside confint_fisher).

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
# NOT RUN {
obs   <- seq(10000, 100000, 10000)
state <- c(0, 1, 1, 0, 0, 0, 1, 0, 1, 0)

mle <- ml_estimation(x = obs, event = state,
                     distribution = "weibull", conf_level = 0.95)
delta_prob <- sapply(obs, delta_method,
                          loc_sc_params = mle$loc_sc_coefficients,
                          loc_sc_varcov = mle$loc_sc_vcov,
                          distribution = "weibull",
                          direction = "y")
# }

Run the code above in your browser using DataLab