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 |
ni=3
Data Set | WORK.TEST |
---|---|
Dependent Variable | Log(m1) |
Dependent Variable | Log(m2) |
Number of Observations | 10 |
Noncensored Values | 0 |
Right Censored Values | 0 |
Left Censored Values | 0 |
Interval Censored Values | 10 |
Number of Parameters | 3 |
Incorrectly Specified Response Values | 190 |
Name of Distribution | Weibull |
Log Likelihood | -2.99367E-11 |
Number of Observations Read | 200 |
---|---|
Number of Observations Used | 10 |
ni=3
ni | 1 | 3 |
---|
-2 Log Likelihood | 0.000 |
AIC (smaller is better) | 6.000 |
AICC (smaller is better) | 10.000 |
BIC (smaller is better) | 6.908 |
-2 Log Likelihood | 0.000 |
Weibull AIC (smaller is better) | 6.000 |
Weibull AICC (smaller is better) | 10.000 |
Weibull BIC (smaller is better) | 6.908 |
WARNING: Negative of Hessian not positive definite. |
Intercept | 1 | 0.3219 | 131.9364 | -258.269 | 258.9126 | 0.00 | 0.9981 |
---|---|---|---|---|---|---|---|
z | 1 | -0.0162 | 137.7813 | -270.063 | 270.0301 | 0.00 | 0.9999 |
Scale | 0 | 0.0005 | 0.0000 | 0.0005 | 0.0005 | ||
Weibull Shape | 0 | 2026.046 | 0.0000 | 2026.046 | 2026.046 |
The SAS System |
The LIFEREG Procedure
ni=4
Data Set | WORK.TEST |
---|---|
Dependent Variable | Log(m1) |
Dependent Variable | Log(m2) |
Number of Observations | 36 |
Noncensored Values | 0 |
Right Censored Values | 0 |
Left Censored Values | 0 |
Interval Censored Values | 36 |
Number of Parameters | 3 |
Incorrectly Specified Response Values | 164 |
Name of Distribution | Weibull |
Log Likelihood | -0.001373412 |
Number of Observations Read | 200 |
---|---|
Number of Observations Used | 36 |
ni=4
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 | 1 | 0.7619 | 0.0198 | 0.7230 | 0.8007 | 1476.79 | <.0001 |
---|---|---|---|---|---|---|---|
z | 0 | -0.1200 | 0.0000 | -0.1200 | -0.1200 | . | . |
Scale | 0 | 0.0007 | 0.0000 | 0.0007 | 0.0007 | ||
Weibull Shape | 0 | 1361.096 | 0.0000 | 1361.096 | 1361.096 |
The SAS System |
The LIFEREG Procedure
ni=5
Data Set | WORK.TEST |
---|---|
Dependent Variable | Log(m1) |
Dependent Variable | Log(m2) |
Number of Observations | 41 |
Noncensored Values | 0 |
Right Censored Values | 0 |
Left Censored Values | 0 |
Interval Censored Values | 41 |
Number of Parameters | 3 |
Incorrectly Specified Response Values | 159 |
Name of Distribution | Weibull |
Log Likelihood | -1.036003E-6 |
Number of Observations Read | 200 |
---|---|
Number of Observations Used | 41 |
ni=5
ni | 1 | 5 |
---|
-2 Log Likelihood | 0.000 |
AIC (smaller is better) | 6.000 |
AICC (smaller is better) | 6.649 |
BIC (smaller is better) | 11.141 |
-2 Log Likelihood | 0.000 |
Weibull AIC (smaller is better) | 6.000 |
Weibull AICC (smaller is better) | 6.649 |
Weibull BIC (smaller is better) | 11.141 |
WARNING: Negative of Hessian not positive definite. |
Intercept | 1 | 0.8950 | 4.3288 | -7.5893 | 9.3792 | 0.04 | 0.8362 |
---|---|---|---|---|---|---|---|
z | 1 | 0.0176 | 3.0635 | -5.9867 | 6.0219 | 0.00 | 0.9954 |
Scale | 0 | 0.0009 | 0.0000 | 0.0009 | 0.0009 | ||
Weibull Shape | 0 | 1105.740 | 0.0000 | 1105.740 | 1105.740 |
The SAS System |
The LIFEREG Procedure
ni=6
Data Set | WORK.TEST |
---|---|
Dependent Variable | Log(m1) |
Dependent Variable | Log(m2) |
Number of Observations | 71 |
Noncensored Values | 0 |
Right Censored Values | 0 |
Left Censored Values | 0 |
Interval Censored Values | 71 |
Number of Parameters | 3 |
Incorrectly Specified Response Values | 129 |
Name of Distribution | Weibull |
Log Likelihood | -0.277627275 |
Number of Observations Read | 200 |
---|---|
Number of Observations Used | 71 |
ni=6
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 | 1 | 1.1242 | 0.0609 | 1.0048 | 1.2436 | 340.70 | <.0001 |
---|---|---|---|---|---|---|---|
z | 1 | -0.0304 | 0.0575 | -0.1432 | 0.0823 | 0.28 | 0.5967 |
Scale | 0 | 0.0011 | 0.0000 | 0.0011 | 0.0011 | ||
Weibull Shape | 0 | 886.1177 | 0.0000 | 886.1177 | 886.1177 |
The SAS System |
The LIFEREG Procedure
ni=7
Data Set | WORK.TEST |
---|---|
Dependent Variable | Log(m1) |
Dependent Variable | Log(m2) |
Number of Observations | 65 |
Noncensored Values | 0 |
Right Censored Values | 0 |
Left Censored Values | 0 |
Interval Censored Values | 65 |
Number of Parameters | 3 |
Incorrectly Specified Response Values | 135 |
Name of Distribution | Weibull |
Log Likelihood | -0.002267799 |
Number of Observations Read | 200 |
---|---|
Number of Observations Used | 65 |
ni=7
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 | 1 | 1.2617 | 0.2905 | 0.6924 | 1.8311 | 18.86 | <.0001 |
---|---|---|---|---|---|---|---|
z | 1 | -0.0235 | 0.1332 | -0.2846 | 0.2376 | 0.03 | 0.8600 |
Scale | 0 | 0.0012 | 0.0000 | 0.0012 | 0.0012 | ||
Weibull Shape | 0 | 849.3206 | 0.0000 | 849.3206 | 849.3206 |
The SAS System |
The LIFEREG Procedure
ni=8
Data Set | WORK.TEST |
---|---|
Dependent Variable | Log(m1) |
Dependent Variable | Log(m2) |
Number of Observations | 102 |
Noncensored Values | 0 |
Right Censored Values | 0 |
Left Censored Values | 0 |
Interval Censored Values | 102 |
Number of Parameters | 3 |
Incorrectly Specified Response Values | 98 |
Name of Distribution | Weibull |
Log Likelihood | -2.161598446 |
Number of Observations Read | 200 |
---|---|
Number of Observations Used | 102 |
ni=8
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 | 1 | 1.3908 | 0.0034 | 1.3841 | 1.3974 | 167729 | <.0001 |
---|---|---|---|---|---|---|---|
z | 1 | -0.0106 | 0.0068 | -0.0239 | 0.0026 | 2.48 | 0.1152 |
Scale | 0 | 0.0013 | 0.0000 | 0.0013 | 0.0013 | ||
Weibull Shape | 0 | 745.8939 | 0.0000 | 745.8939 | 745.8939 |
The SAS System |
The LIFEREG Procedure
ni=9
Data Set | WORK.TEST |
---|---|
Dependent Variable | Log(m1) |
Dependent Variable | Log(m2) |
Number of Observations | 91 |
Noncensored Values | 0 |
Right Censored Values | 0 |
Left Censored Values | 0 |
Interval Censored Values | 91 |
Number of Parameters | 3 |
Incorrectly Specified Response Values | 109 |
Name of Distribution | Weibull |
Log Likelihood | -0.003588214 |
Number of Observations Read | 200 |
---|---|
Number of Observations Used | 91 |
ni=9
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.540 |
-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.540 |
WARNING: Negative of Hessian not positive definite. |
Intercept | 1 | 1.5388 | 0.5241 | 0.5116 | 2.5659 | 8.62 | 0.0033 |
---|---|---|---|---|---|---|---|
z | 1 | -0.0343 | 0.2623 | -0.5483 | 0.4798 | 0.02 | 0.8961 |
Scale | 0 | 0.0014 | 0.0000 | 0.0014 | 0.0014 | ||
Weibull Shape | 0 | 698.0350 | 0.0000 | 698.0350 | 698.0350 |
The SAS System |
The LIFEREG Procedure
ni=10
Data Set | WORK.TEST |
---|---|
Dependent Variable | Log(m1) |
Dependent Variable | Log(m2) |
Number of Observations | 103 |
Noncensored Values | 0 |
Right Censored Values | 0 |
Left Censored Values | 0 |
Interval Censored Values | 103 |
Number of Parameters | 3 |
Incorrectly Specified Response Values | 97 |
Name of Distribution | Weibull |
Log Likelihood | -0.036363918 |
Number of Observations Read | 200 |
---|---|
Number of Observations Used | 103 |
ni=10
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 | 1 | 1.6257 | 0.0186 | 1.5892 | 1.6622 | 7620.20 | <.0001 |
---|---|---|---|---|---|---|---|
z | 1 | -0.0445 | 0.0321 | -0.1075 | 0.0184 | 1.92 | 0.1656 |
Scale | 0 | 0.0015 | 0.0000 | 0.0015 | 0.0015 | ||
Weibull Shape | 0 | 661.4704 | 0.0000 | 661.4704 | 661.4704 |
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
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
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
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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.