# The LIFEREG Procedure

### Example 57.3 Overcoming Convergence Problems by Specifying Initial Values

This example illustrates the use of parameter initial value specification to help overcome convergence difficulties.

The following statements create a SAS data set.

```data raw;
input censor x c1 @@;
datalines;
0 16 0.00   0 17 0.00   0 18 0.00
0 17 0.04   0 18 0.04   0 18 0.04
0 23 0.40   0 22 0.40   0 22 0.40
0 33 4.00   0 34 4.00   0 35 4.00
1 54 40.00  1 54 40.00  1 54 40.00
1 54 400.00 1 54 400.00 1 54 400.00
;
```

Output 57.3.1 shows the contents of the data set `raw`.

Output 57.3.1: Contents of the Data Set

Obs censor x c1
1 0 16 0.00
2 0 17 0.00
3 0 18 0.00
4 0 17 0.04
5 0 18 0.04
6 0 18 0.04
7 0 23 0.40
8 0 22 0.40
9 0 22 0.40
10 0 33 4.00
11 0 34 4.00
12 0 35 4.00
13 1 54 40.00
14 1 54 40.00
15 1 54 40.00
16 1 54 400.00
17 1 54 400.00
18 1 54 400.00

The following SAS statements request that a Weibull regression model be fit to the data:

```title 'OLS (Default) Initial Values';
proc lifereg data=raw;
model x*censor(1) = c1 / distribution = Weibull itprint;
run;
```

Convergence was not attained in 50 iterations for this model, as the following messages to the log indicate:

```WARNING: Convergence was not attained in 50 iterations. You might want to
increase the maximum number of iterations (MAXITER= option) or
change the convergence criteria (CONVERGE = value) in the MODEL
statement.
WARNING: The procedure is continuing in spite of the above warning. Results
shown are based on the last maximum likelihood iteration. Validity
of the model fit is questionable.
```

The first line (`iter`=0) of the iteration history table, shown in Output 57.3.2, shows the default initial ordinary least squares (OLS) estimates of the parameters.

Output 57.3.2: Initial Least Squares

 OLS (Default) Initial Values

The LIFEREG Procedure

Iteration History for Parameter Estimates
Iter Ridge Loglikelihood Intercept c1 Scale
0 0 -22.891088 3.2324769714 0.0020664542 0.3995754195
1 0 -16.427074 3.5337141598 0.0028713635 0.3283544365
2 0 -13.216768 3.4480787541 0.0052801225 0.3816964358
3 0 -5.0786635 3.1966395335 0.0191439929 0.2325418958
4 0 -2.0018885 3.1848047525 0.0275425402 0.1963590539
5 0 -0.1814984 3.1478989655 0.0374731819 0.2103607621
6 0 2.90712131 3.0858183316 0.0659946149 0.1818245261
7 0.063 2.9991781 3.1014479187 0.0661096622 0.1648677081
8 0.063 3.01557837 3.0995493638 0.0662333056 0.1670552505
9 0.063 3.0301815 3.0992317977 0.0663580659 0.1669529486
10 0.063 3.0448013 3.0989901232 0.0664827053 0.1667371524
11 0.063 3.05941254 3.0987507448 0.0666071514 0.1665197313
12 0.063 3.07401474 3.0985118143 0.0667314052 0.1663026517
13 0.063 3.08860788 3.0982732928 0.066855467 0.1660859472
14 0.063 3.10319193 3.0980351787 0.0669793371 0.1658696184
15 0.063 3.11776689 3.0977974713 0.0671030156 0.1656536651
16 0.063 3.13233272 3.0975601698 0.0672265029 0.1654380873
17 0.063 3.1468894 3.0973232737 0.0673497993 0.165222885
18 0.063 3.16143692 3.0970867821 0.0674729049 0.1650080579
19 0.063 3.17597526 3.0968506943 0.06759582 0.1647936061
20 0.063 3.19050439 3.0966150098 0.0677185449 0.1645795293
21 0.063 3.2050243 3.0963797277 0.0678410799 0.1643658275
22 0.063 3.21953496 3.0961448474 0.0679634252 0.1641525006
23 0.063 3.23403635 3.0959103682 0.068085581 0.1639395483
24 0.063 3.24852845 3.0956762896 0.0682075476 0.1637269705
25 0.063 3.26301123 3.0954426107 0.0683293253 0.1635147672
26 0.063 3.27748468 3.095209331 0.0684509143 0.163302938
27 0.063 3.29194878 3.0949764498 0.0685723149 0.1630914829
28 0.063 3.3064035 3.0947439665 0.0686935273 0.1628804017
29 0.063 3.32084881 3.0945118805 0.0688145517 0.1626696942
30 0.063 3.3352847 3.0942801911 0.0689353885 0.1624593601
31 0.063 3.34971114 3.0940488977 0.0690560378 0.1622493994
32 0.063 3.36412812 3.0938179997 0.0691765 0.1620398118
33 0.063 3.3785356 3.0935874965 0.0692967752 0.1618305971
34 0.063 3.39293356 3.0933573875 0.0694168637 0.161621755
35 0.063 3.40732199 3.093127672 0.0695367658 0.1614132855
36 0.063 3.42170085 3.0928983495 0.0696564816 0.1612051882
37 0.063 3.43607013 3.0926694194 0.0697760116 0.1609974629
38 0.063 3.45042979 3.0924408811 0.0698953558 0.1607901095
39 0.063 3.46477983 3.092212734 0.0700145146 0.1605831276
40 0.063 3.4791202 3.0919849776 0.0701334882 0.160376517
41 0.063 3.4934509 3.0917576112 0.0702522768 0.1601702775
42 0.063 3.50777188 3.0915306343 0.0703708808 0.1599644088
43 0.063 3.52208314 3.0913040464 0.0704893002 0.1597589108
44 0.063 3.53638465 3.0910778468 0.0706075354 0.159553783
45 0.063 3.55067637 3.0908520349 0.0707255867 0.1593490254
46 0.063 3.5649583 3.0906266104 0.0708434542 0.1591446376
47 0.063 3.57923039 3.0904015725 0.0709611382 0.1589406193
48 0.063 3.59349263 3.0901769207 0.0710786389 0.1587369703
49 0.063 3.607745 3.0899526546 0.0711959567 0.1585336903
50 0.063 3.62198746 3.0897287734 0.0713130916 0.1583307791

The log-logistic distribution is more robust to large values of the response than the Weibull distribution, so one approach to improving the convergence performance is to fit a log-logistic distribution, and if this converges, use the resulting parameter estimates as initial values in a subsequent fit of a model with the Weibull distribution.

The following statements fit a log-logistic distribution to the data:

```proc lifereg data=raw;
model x*censor(1) = c1 / distribution = llogistic;
run;
```

The algorithm converges, and the maximum likelihood estimates for the log-logistic distribution are shown in Output 57.3.3

Output 57.3.3: Estimates from the Log-Logistic Distribution

 OLS (Default) Initial Values

The LIFEREG Procedure

Analysis of Maximum Likelihood Parameter Estimates
Parameter DF Estimate Standard
Error
95% Confidence Limits Chi-Square Pr > ChiSq
Intercept 1 2.8983 0.0318 2.8360 2.9606 8309.43 <.0001
c1 1 0.1592 0.0133 0.1332 0.1852 143.85 <.0001
Scale 1 0.0498 0.0122 0.0308 0.0804

The following statements refit the Weibull model by using the maximum likelihood estimates from the log-logistic fit as initial values:

```proc lifereg data=raw outest=outest;
model x*censor(1) = c1 / itprint distribution = weibull
intercept=2.898 initial=0.16 scale=0.05;
output out=out xbeta=xbeta;
run;
```

Examination of the resulting output in Output 57.3.4 shows that the convergence problem has been solved by specifying different initial values.

Output 57.3.4: Final Estimates from the Weibull Distribution

 OLS (Default) Initial Values

The LIFEREG Procedure

Model Information
Data Set WORK.RAW
Dependent Variable Log(x)
Censoring Variable censor
Censoring Value(s) 1
Number of Observations 18
Noncensored Values 12
Right Censored Values 6
Left Censored Values 0
Interval Censored Values 0
Number of Parameters 3
Name of Distribution Weibull
Log Likelihood 11.232023272

 Algorithm converged.

Analysis of Maximum Likelihood Parameter Estimates
Parameter DF Estimate Standard
Error
95% Confidence Limits Chi-Square Pr > ChiSq
Intercept 1 2.9699 0.0326 2.9059 3.0338 8278.86 <.0001
c1 1 0.1435 0.0165 0.1111 0.1758 75.43 <.0001
Scale 1 0.0844 0.0189 0.0544 0.1308
Weibull Shape 1 11.8526 2.6514 7.6455 18.3749

As an example of an alternative way of specifying initial values, the following invocation of PROC LIFEREG, using the INEST= data set to provide starting values for the three parameters, is equivalent to the previous invocation:

```data in;
input  intercept c1 scale;
datalines;
2.898 0.16 0.05
;

proc lifereg data=raw inest=in outest=outest;
model x*censor(1) = c1 / itprint distribution = weibull;
output out=out xbeta=xbeta;
run;
```