G07BEF computes maximum likelihood estimates for parameters of the Weibull distribution from data which may be right-censored.
G07BEF computes maximum likelihood estimates of the parameters of the Weibull distribution from exact or right-censored data.
For
realisations,
, from a Weibull distribution a value
is observed such that
There are two situations:
(a) |
exactly specified observations, when |
(b) |
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
.
- 1: CENS – CHARACTER(1)Input
On entry: indicates whether the data is censored or non-censored.
- Each observation is assumed to be exactly specified. IC is not referenced.
- Each observation is censored according to the value contained in
, for .
Constraint:
or .
- 2: N – INTEGERInput
On entry: , the number of observations.
Constraint:
.
- 3: X(N) – REAL (KIND=nag_wp) arrayInput
On entry: contains the th observation, , for .
Constraint:
, for .
- 4: IC() – INTEGER arrayInput
-
Note: the dimension of the array
IC
must be at least
if
, and at least
otherwise.
On entry: if
, then
contains the censoring codes for the
th observation, for
.
If , the th observation is exactly specified.
If , the th observation is right-censored.
If
, then
IC is not referenced.
Constraint:
if , then or , for .
- 5: BETA – REAL (KIND=nag_wp)Output
On exit: the maximum likelihood estimate, , of .
- 6: GAMMA – REAL (KIND=nag_wp)Input/Output
On entry: 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
, then 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, then the largest observation must not be exactly specified.) See
Section 8 for further details.
On exit: contains the maximum likelihood estimate, , of .
- 7: TOL – REAL (KIND=nag_wp)Input
On entry: 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
TOL.
If , then a relative precision of is used.
Constraint:
or .
- 8: MAXIT – INTEGERInput
On entry: the maximum number of iterations allowed.
If , then a value of is used.
- 9: SEBETA – REAL (KIND=nag_wp)Output
On exit: an estimate of the standard error of .
- 10: SEGAM – REAL (KIND=nag_wp)Output
On exit: an estimate of the standard error of .
- 11: CORR – REAL (KIND=nag_wp)Output
On exit: an estimate of the correlation between and .
- 12: DEV – REAL (KIND=nag_wp)Output
On exit: the maximized kernel log-likelihood, .
- 13: NIT – INTEGEROutput
On exit: the number of iterations performed.
- 14: WK(N) – REAL (KIND=nag_wp) arrayWorkspace
- 15: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Given that the Weibull distribution is a suitable model for the data and that the initial values are reasonable the convergence to the required accuracy, indicated by
TOL, should be achieved.
In a study,
patients receiving an analgesic to relieve headache pain had the following recorded relief times (in hours):
(See
Gross and Clark (1975).) This data is read in and a Weibull distribution fitted assuming no censoring; the parameter estimates and their standard errors are printed.