Estimates the parameters of the two-parameter Weibull distribution using classical methods.

fitWD(
  data,
  est.method,
  opt.method,
  starts,
  lower = NULL,
  upper = NULL,
  verbose = FALSE,
  ...
)

Arguments

data

Numeric vector of observations.

est.method

Character string specifying the estimation method. Options include "MLE", "LSE", "WLSE", and "MPS".

opt.method

Character string specifying the optimization method used in optim, such as "Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN", or "Brent".

starts

Numeric vector of initial values for the parameters

lower

Numeric vector of lower bounds for parameters in constrained optimization. Ignored if NULL.

upper

Numeric vector of upper bounds for parameters in constrained optimization.

verbose

Logical. If TRUE, prints optimization progress.

...

Additional arguments passed to optim.

Value

A list containing:

estimates

Named numeric vector of estimated parameters \((a, b)\).

measures

Numeric vector of model selection criteria (log-likelihood, AIC, BIC).

initials

Initial values used in the optimization.

opt.fit

Full output from optim.

Details

Classical estimations fo the parameters of the two-parameter Weibull distribution

The two-parameter Weibull Distribution has cumulative distribution function (CDF) and probability density function (PDF):

$$ F(x) = 1 - \exp(-a x^b), $$ $$ f(x) = a b x^{b - 1} \exp(-a x^b ), $$

where \(x > 0\), \(a > 0\) is the scale parameter and \(b > 0\) is the shape parameter.

The parameters are estimated using the following methods:

  • Maximum Likelihood Estimation (MLE): Maximizes the log-likelihood under the MWD model.

  • Least Squares Estimation (LSE): Minimizes squared differences between empirical and theoretical CDFs. The empirical CDF uses Benard's approximation: \(F(x_{(i)}) = (i - 0.3)/(n + 0.4)\), for \(i = 1, \dots, n\).

  • Weighted Least Squares Estimation (WLSE): A modification of LSE that assigns weights to the squared differences. Uses weights \(w_i = \frac{(n+1)^2(n+2)}{i(n-i+1)}\), for \(i = 1, \dots, n\).

  • Maximum Product of Spacings (MPS): Maximizes the product of spacings of the fitted CDF.

Examples

# generate data from WD(a, b)
n <- 50
a <- 0.75; b <- 1.25; lambda <- 0 # reduces two-parameter Weibull distribution
set.seed(123)
X <- rMweibull(n, a, b, lambda)
init <- runif(2)

# fit model
fit.mle <- fitWD(data = X, est.method = "mle", opt.method = "L-BFGS-B", starts = init,
                 lower = c(1e-05,1e-05), upper = c(Inf,Inf), hessian = FALSE )
fit.mle$estimates
#>        a        b 
#> 0.675279 1.283785 

fit.lse <- fitWD(data = X, est.method = "lse", opt.method = "L-BFGS-B", starts = init,
                 lower = c(1e-05,1e-05), upper = c(Inf,Inf), hessian = FALSE )
fit.lse$estimates
#>         a         b 
#> 0.7012337 1.2147202 

fit.wlse <- fitWD(data = X, est.method = "wlse", opt.method = "L-BFGS-B", starts = init,
                  lower = c(1e-05,1e-05), upper = c(Inf,Inf), hessian = FALSE )
fit.wlse$estimates
#>        a        b 
#> 0.690969 1.236661 

fit.mps <- fitWD(data = X, est.method = "mps", opt.method = "L-BFGS-B", starts = init,
                 lower = c(1e-05,1e-05), upper = c(Inf,Inf), hessian = FALSE )
fit.mps$estimates
#>         a         b 
#> 0.6848478 1.1977846