The following data are taken from Lawless (1982, p. 193) and represent the number of days that it took rats that were painted with a carcinogen to develop carcinoma. The last two observations are censored data from a group of 19 rats.
data pike; input days cens @@; datalines; 143 0 164 0 188 0 188 0 190 0 192 0 206 0 209 0 213 0 216 0 220 0 227 0 230 0 234 0 246 0 265 0 304 0 216 1 244 1 ;
Suppose you want to compute the maximum likelihood estimates of the scale parameter ( in Lawless), the shape parameter ( in Lawless), and the location parameter ( in Lawless). The observed likelihood function of the three-parameter Weibull transformation (Lawless 1982, p. 191) is
where n is the number of individuals involved in the experiment, is the set of individuals whose lifetimes are observed, , and is defined by the data set. Then the log-likelihood function is
For , the logarithmic terms become infinite as . That is, is unbounded. Thus our interest is restricted to c values greater than or equal to 1. Further, for the logarithmic terms to be defined, it is required that and .
The following PROC OPTMODEL call specifies the maximization of the log-likelihood function for the three-parameter Weibull estimation:
proc optmodel; set OBS; num days {OBS}; num cens {OBS}; read data pike into OBS=[_N_] days cens; var sig >= 1.0e-6 init 10; var c >= 1.0e-6 init 10; var theta >= 0 <= min {i in OBS: cens[i] = 0} days[i] init 10; impvar fi {i in OBS} = (if cens[i] = 0 then log(c) - c * log(sig) + (c - 1) * log(days[i] - theta) ) - ((days[i] - theta) / sig)^c; max logf = sum {i in OBS} fi[i]; set VARS = 1.._NVAR_; num mycov {i in VARS, j in 1..i}; solve with NLP / covest=(cov=2 covout=mycov); print sig c theta; print mycov; create data covdata from [i j]={i in VARS, j in 1..i} var_i=_VAR_[i].name var_j=_VAR_[j].name mycov; quit;
The solution is displayed in Output 10.6.1. The solution that the NLP solver obtains closely matches the local maximum , , and that are given in Lawless (1982, p. 193).