# naginterfaces.library.univar.estim_​weibull¶

naginterfaces.library.univar.estim_weibull(cens, x, ic, gamma, tol, maxit)[source]

estim_weibull computes maximum likelihood estimates for parameters of the Weibull distribution from data which may be right-censored.

For full information please refer to the NAG Library document for g07be

https://www.nag.com/numeric/nl/nagdoc_28.7/flhtml/g07/g07bef.html

Parameters
censstr, length 1

Indicates whether the data is censored or non-censored.

Each observation is assumed to be exactly specified. is not referenced.

Each observation is censored according to the value contained in , for .

xfloat, array-like, shape

contains the th observation, , for .

icint, array-like, shape

Note: the required length for this argument is determined as follows: if : ; otherwise: .

If , contains the censoring codes for the th observation, for .

If , the th observation is exactly specified.

If , the th observation is right-censored.

If , is not referenced.

gammafloat

Indicates whether an initial estimate of is provided.

If , it is taken as the initial estimate of and an initial estimate of is calculated from this value of .

If , initial estimates of and are calculated, internally, providing the data contains at least two distinct exact observations. (If there are only two distinct exact observations, the largest observation must not be exactly specified.) See Further Comments for further details.

tolfloat

The relative precision required for the final estimates of and . Convergence is assumed when the absolute relative changes in the estimates of both and are less than .

If , a relative precision of is used.

maxitint

The maximum number of iterations allowed.

If , a value of is used.

Returns
betafloat

The maximum likelihood estimate, , of .

gammafloat

Contains the maximum likelihood estimate, , of .

sebetafloat

An estimate of the standard error of .

segamfloat

An estimate of the standard error of .

corrfloat

An estimate of the correlation between and .

devfloat

The maximized kernel log-likelihood, .

nitint

The number of iterations performed.

Raises
NagValueError
(errno )

On entry, .

Constraint: or .

(errno )

On entry, .

Constraint: or .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: or .

(errno )

On entry, and .

Constraint: .

(errno )

Unable to calculate initial values.

(errno )

On entry, there are no exactly specified observations.

(errno )

The chosen method has not converged in iterations.

(errno )

The process has diverged.

(errno )

Hessian matrix of the Newton–Raphson process is singular.

(errno )

Potential overflow detected.

Notes

estim_weibull computes maximum likelihood estimates of the parameters of the Weibull distribution from exact or right-censored data.

For realizations, , from a Weibull distribution a value is observed such that

There are two situations:

1. exactly specified observations, when

2. right-censored observations, known by a lower bound, when .

The probability density function of the Weibull distribution, and hence the contribution of an exactly specified observation to the likelihood, is given by:

while the survival function of the Weibull distribution, and hence the contribution of a right-censored observation to the likelihood, is given by:

If of the observations are exactly specified and indicated by and the remaining are right-censored, then the likelihood function, is given by

To avoid possible numerical instability a different parameterisation is used, with . The kernel log-likelihood function, , is then:

If the derivatives , , , and are denoted by , , , and , respectively, then the maximum likelihood estimates, and , are the solution to the equations:

and

Estimates of the asymptotic standard errors of and are given by:

An estimate of the correlation coefficient of and is given by:

Note: if an estimate of the original parameter is required, then

The equations (1) and (2) are solved by the Newton–Raphson iterative method with adjustments made to ensure that .

References

Gross, A J and Clark, V A, 1975, Survival Distributions: Reliability Applications in the Biomedical Sciences, Wiley

Kalbfleisch, J D and Prentice, R L, 1980, The Statistical Analysis of Failure Time Data, Wiley