proc lifereg output by levels

Solved
Super Contributor
Posts: 328

proc lifereg output by levels

I wish to know why the ooutput for the lifereg procedure starts from ni=3 not ni=1??

DATA test;

one   = 1;

beta0 =  1.0;

beta1 = 0.75;

beta2 =  -.5;

errsd =  1;

seed  = -1;

n=1;

do while (n le 200);

ni=1;

do while (ni le 10);

z = abs(normal(6));

error = rannor(seed);

time = ni;

test=7*ranuni(seed)+1;  /** uniform (1,8)  */;

m1=min(time, test);

m2=max(0,time-test);

olf = (test le time);

y = beta0*z + beta1*m1 +beta2*m2 + errsd*error;

output test;

ni+1;

end;

n+1;

end;

proc sort data=test;

by ni;

run;

proc lifereg data=test outest=a_1;

class ni;

model (m1, m2) = Z/D=WEIBULL;

output out=b_1 xbeta=lp;

ods output ParameterEstimates=Para;

by ni;

run;

ods trace off;

OUTPUT

 The SAS System

The LIFEREG Procedure

Data Set WORK.TEST Log(m1) Log(m2) 10 0 0 0 10 3 190 Weibull -2.99367E-11

 Number of Observations Read 200 10

 ni 1 3

 -2 Log Likelihood 0 AIC (smaller is better) 6 AICC (smaller is better) 10 BIC (smaller is better) 6.908

 -2 Log Likelihood 0 Weibull AIC (smaller is better) 6 Weibull AICC (smaller is better) 10 Weibull BIC (smaller is better) 6.908

 WARNING: Negative of Hessian not positive definite.

 Intercept z Scale Weibull Shape 1 0.3219 131.936 -258.269 258.913 0.00 0.9981 1 -0.0162 137.781 -270.063 270.03 0.00 0.9999 0 0.0005 0 0.0005 0.0005 0 2026.05 0 2026.05 2026.05

 The SAS System

The LIFEREG Procedure

Data Set WORK.TEST Log(m1) Log(m2) 36 0 0 0 36 3 164 Weibull -0.001373412

 Number of Observations Read 200 36

 ni 1 4

 -2 Log Likelihood 0.003 AIC (smaller is better) 6.003 AICC (smaller is better) 6.753 BIC (smaller is better) 10.753

 -2 Log Likelihood 0.003 Weibull AIC (smaller is better) 6.003 Weibull AICC (smaller is better) 6.753 Weibull BIC (smaller is better) 10.753

 WARNING: Negative of Hessian not positive definite.

 Intercept z Scale Weibull Shape 1 0.7619 0.0198 0.723 0.8007 1476.79 <.0001 0 -0.12 0 -0.12 -0.12 . . 0 0.0007 0 0.0007 0.0007 0 1361.1 0 1361.1 1361.1

 The SAS System

The LIFEREG Procedure

Data Set WORK.TEST Log(m1) Log(m2) 41 0 0 0 41 3 159 Weibull -1.036003E-6

 Number of Observations Read 200 41

 ni 1 5

 -2 Log Likelihood 0 AIC (smaller is better) 6 AICC (smaller is better) 6.649 BIC (smaller is better) 11.141

 -2 Log Likelihood 0 Weibull AIC (smaller is better) 6 Weibull AICC (smaller is better) 6.649 Weibull BIC (smaller is better) 11.141

 WARNING: Negative of Hessian not positive definite.

 Intercept z Scale Weibull Shape 1 0.895 4.3288 -7.5893 9.3792 0.04 0.8362 1 0.0176 3.0635 -5.9867 6.0219 0.00 0.9954 0 0.0009 0 0.0009 0.0009 0 1105.74 0 1105.74 1105.74

 The SAS System

The LIFEREG Procedure

Data Set WORK.TEST Log(m1) Log(m2) 71 0 0 0 71 3 129 Weibull -0.277627275

 Number of Observations Read 200 71

 ni 1 6

 -2 Log Likelihood 0.555 AIC (smaller is better) 6.555 AICC (smaller is better) 6.913 BIC (smaller is better) 13.343

 -2 Log Likelihood 0.555 Weibull AIC (smaller is better) 6.555 Weibull AICC (smaller is better) 6.913 Weibull BIC (smaller is better) 13.343

 WARNING: Negative of Hessian not positive definite.

 Intercept z Scale Weibull Shape 1 1.1242 0.0609 1.0048 1.2436 340.70 <.0001 1 -0.0304 0.0575 -0.1432 0.0823 0.28 0.5967 0 0.0011 0 0.0011 0.0011 0 886.118 0 886.118 886.118

 The SAS System

The LIFEREG Procedure

Data Set WORK.TEST Log(m1) Log(m2) 65 0 0 0 65 3 135 Weibull -0.002267799

 Number of Observations Read 200 65

 ni 1 7

 -2 Log Likelihood 0.005 AIC (smaller is better) 6.005 AICC (smaller is better) 6.398 BIC (smaller is better) 12.528

 -2 Log Likelihood 0.005 Weibull AIC (smaller is better) 6.005 Weibull AICC (smaller is better) 6.398 Weibull BIC (smaller is better) 12.528

 WARNING: Negative of Hessian not positive definite.

 Intercept z Scale Weibull Shape 1 1.2617 0.2905 0.6924 1.8311 18.86 <.0001 1 -0.0235 0.1332 -0.2846 0.2376 0.03 0.8600 0 0.0012 0 0.0012 0.0012 0 849.321 0 849.321 849.321

 The SAS System

The LIFEREG Procedure

Data Set WORK.TEST Log(m1) Log(m2) 102 0 0 0 102 3 98 Weibull -2.161598446

 Number of Observations Read 200 102

 ni 1 8

 -2 Log Likelihood 4.323 AIC (smaller is better) 10.323 AICC (smaller is better) 10.568 BIC (smaller is better) 18.198

 -2 Log Likelihood 4.323 Weibull AIC (smaller is better) 10.323 Weibull AICC (smaller is better) 10.568 Weibull BIC (smaller is better) 18.198

 WARNING: Negative of Hessian not positive definite.

 Intercept z Scale Weibull Shape 1 1.3908 0.0034 1.3841 1.3974 167729 <.0001 1 -0.0106 0.0068 -0.0239 0.0026 2.48 0.1152 0 0.0013 0 0.0013 0.0013 0 745.894 0 745.894 745.894

 The SAS System

The LIFEREG Procedure

Data Set WORK.TEST Log(m1) Log(m2) 91 0 0 0 91 3 109 Weibull -0.003588214

 Number of Observations Read 200 91

 ni 1 9

 -2 Log Likelihood 0.007 AIC (smaller is better) 6.007 AICC (smaller is better) 6.283 BIC (smaller is better) 13.54

 -2 Log Likelihood 0.007 Weibull AIC (smaller is better) 6.007 Weibull AICC (smaller is better) 6.283 Weibull BIC (smaller is better) 13.54

 WARNING: Negative of Hessian not positive definite.

 Intercept z Scale Weibull Shape 1 1.5388 0.5241 0.5116 2.5659 8.62 0.0033 1 -0.0343 0.2623 -0.5483 0.4798 0.02 0.8961 0 0.0014 0 0.0014 0.0014 0 698.035 0 698.035 698.035

 The SAS System

The LIFEREG Procedure

Data Set WORK.TEST Log(m1) Log(m2) 103 0 0 0 103 3 97 Weibull -0.036363918

 Number of Observations Read 200 103

 ni 1 10

 -2 Log Likelihood 0.073 AIC (smaller is better) 6.073 AICC (smaller is better) 6.315 BIC (smaller is better) 13.977

 -2 Log Likelihood 0.073 Weibull AIC (smaller is better) 6.073 Weibull AICC (smaller is better) 6.315 Weibull BIC (smaller is better) 13.977

 WARNING: Negative of Hessian not positive definite.

 Intercept z Scale Weibull Shape 1 1.6257 0.0186 1.5892 1.6622 7620.20 <.0001 1 -0.0445 0.0321 -0.1075 0.0184 1.92 0.1656 0 0.0015 0 0.0015 0.0015 0 661.47 0 661.47 661.47

Accepted Solutions
Solution
‎04-24-2015 08:45 AM
Posts: 2,655

Re: proc lifereg output by levels

Well, you have to guarantee that m2>m1, so the calculations:

m1=min(time, test);

m2=max(0,time-test);

have to return valid numbers from time and test.  Certainly m2 needs to be changed so that it gives reasonable values when time (ni) is small, as time-test is liable to be less than 0.

Steve Denham

All Replies
Posts: 2,655

Re: proc lifereg output by levels

According to the log, there are no valid observations for the variable m1 for ni=1 and ni=2.  Thus, your output, as it is by ni, starts with ni=3.  Just on a guess, I would surmise that your data has m1 (the initial time) greater than m2 (the final time) for these two variables, hence it returns the error message.

Steve Denham

Super Contributor
Posts: 328

Re: proc lifereg output by levels

Thank you SteveDenham,

I wish to ask there is a way to simulate the data such that, there is valid observations for the variable m1 for ni=1 and ni=2?

Thank you

Solution
‎04-24-2015 08:45 AM
Posts: 2,655

Re: proc lifereg output by levels

Well, you have to guarantee that m2>m1, so the calculations:

m1=min(time, test);

m2=max(0,time-test);

have to return valid numbers from time and test.  Certainly m2 needs to be changed so that it gives reasonable values when time (ni) is small, as time-test is liable to be less than 0.

Steve Denham

🔒 This topic is solved and locked.