BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
desireatem
Pyrite | Level 9

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 SetWORK.TEST
Dependent VariableLog(m1)
Dependent VariableLog(m2)
Number of Observations10
Noncensored Values0
Right Censored Values0
Left Censored Values0
Interval Censored Values10
Number of Parameters3
Incorrectly Specified Response Values190
Name of DistributionWeibull
Log Likelihood-2.99367E-11


   
Number of Observations Read200
Number of Observations Used10


    
ni13


   
-2 Log Likelihood0.000
AIC (smaller is better)6.000
AICC (smaller is better)10.000
BIC (smaller is better)6.908


   
-2 Log Likelihood0.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.


          
Intercept10.3219131.9364-258.269258.91260.000.9981
z1-0.0162137.7813-270.063270.03010.000.9999
Scale00.00050.00000.00050.0005
Weibull Shape02026.0460.00002026.0462026.046



The SAS System

The LIFEREG Procedure

   
Data SetWORK.TEST
Dependent VariableLog(m1)
Dependent VariableLog(m2)
Number of Observations36
Noncensored Values0
Right Censored Values0
Left Censored Values0
Interval Censored Values36
Number of Parameters3
Incorrectly Specified Response Values164
Name of DistributionWeibull
Log Likelihood-0.001373412


   
Number of Observations Read200
Number of Observations Used36


    
ni14


   
-2 Log Likelihood0.003
AIC (smaller is better)6.003
AICC (smaller is better)6.753
BIC (smaller is better)10.753


   
-2 Log Likelihood0.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.


          
Intercept10.76190.01980.72300.80071476.79<.0001
z0-0.12000.0000-0.1200-0.1200..
Scale00.00070.00000.00070.0007
Weibull Shape01361.0960.00001361.0961361.096



The SAS System

The LIFEREG Procedure

   
Data SetWORK.TEST
Dependent VariableLog(m1)
Dependent VariableLog(m2)
Number of Observations41
Noncensored Values0
Right Censored Values0
Left Censored Values0
Interval Censored Values41
Number of Parameters3
Incorrectly Specified Response Values159
Name of DistributionWeibull
Log Likelihood-1.036003E-6


   
Number of Observations Read200
Number of Observations Used41


    
ni15


   
-2 Log Likelihood0.000
AIC (smaller is better)6.000
AICC (smaller is better)6.649
BIC (smaller is better)11.141


   
-2 Log Likelihood0.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.


          
Intercept10.89504.3288-7.58939.37920.040.8362
z10.01763.0635-5.98676.02190.000.9954
Scale00.00090.00000.00090.0009
Weibull Shape01105.7400.00001105.7401105.740



The SAS System

The LIFEREG Procedure

   
Data SetWORK.TEST
Dependent VariableLog(m1)
Dependent VariableLog(m2)
Number of Observations71
Noncensored Values0
Right Censored Values0
Left Censored Values0
Interval Censored Values71
Number of Parameters3
Incorrectly Specified Response Values129
Name of DistributionWeibull
Log Likelihood-0.277627275


   
Number of Observations Read200
Number of Observations Used71


    
ni16


   
-2 Log Likelihood0.555
AIC (smaller is better)6.555
AICC (smaller is better)6.913
BIC (smaller is better)13.343


   
-2 Log Likelihood0.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.


          
Intercept11.12420.06091.00481.2436340.70<.0001
z1-0.03040.0575-0.14320.08230.280.5967
Scale00.00110.00000.00110.0011
Weibull Shape0886.11770.0000886.1177886.1177



The SAS System

The LIFEREG Procedure

   
Data SetWORK.TEST
Dependent VariableLog(m1)
Dependent VariableLog(m2)
Number of Observations65
Noncensored Values0
Right Censored Values0
Left Censored Values0
Interval Censored Values65
Number of Parameters3
Incorrectly Specified Response Values135
Name of DistributionWeibull
Log Likelihood-0.002267799


   
Number of Observations Read200
Number of Observations Used65


    
ni17


   
-2 Log Likelihood0.005
AIC (smaller is better)6.005
AICC (smaller is better)6.398
BIC (smaller is better)12.528


   
-2 Log Likelihood0.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.


          
Intercept11.26170.29050.69241.831118.86<.0001
z1-0.02350.1332-0.28460.23760.030.8600
Scale00.00120.00000.00120.0012
Weibull Shape0849.32060.0000849.3206849.3206



The SAS System

The LIFEREG Procedure

   
Data SetWORK.TEST
Dependent VariableLog(m1)
Dependent VariableLog(m2)
Number of Observations102
Noncensored Values0
Right Censored Values0
Left Censored Values0
Interval Censored Values102
Number of Parameters3
Incorrectly Specified Response Values98
Name of DistributionWeibull
Log Likelihood-2.161598446


   
Number of Observations Read200
Number of Observations Used102


    
ni18


   
-2 Log Likelihood4.323
AIC (smaller is better)10.323
AICC (smaller is better)10.568
BIC (smaller is better)18.198


   
-2 Log Likelihood4.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.


          
Intercept11.39080.00341.38411.3974167729<.0001
z1-0.01060.0068-0.02390.00262.480.1152
Scale00.00130.00000.00130.0013
Weibull Shape0745.89390.0000745.8939745.8939



The SAS System

The LIFEREG Procedure

   
Data SetWORK.TEST
Dependent VariableLog(m1)
Dependent VariableLog(m2)
Number of Observations91
Noncensored Values0
Right Censored Values0
Left Censored Values0
Interval Censored Values91
Number of Parameters3
Incorrectly Specified Response Values109
Name of DistributionWeibull
Log Likelihood-0.003588214


   
Number of Observations Read200
Number of Observations Used91


    
ni19


   
-2 Log Likelihood0.007
AIC (smaller is better)6.007
AICC (smaller is better)6.283
BIC (smaller is better)13.540


   
-2 Log Likelihood0.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.


          
Intercept11.53880.52410.51162.56598.620.0033
z1-0.03430.2623-0.54830.47980.020.8961
Scale00.00140.00000.00140.0014
Weibull Shape0698.03500.0000698.0350698.0350



The SAS System

The LIFEREG Procedure

   
Data SetWORK.TEST
Dependent VariableLog(m1)
Dependent VariableLog(m2)
Number of Observations103
Noncensored Values0
Right Censored Values0
Left Censored Values0
Interval Censored Values103
Number of Parameters3
Incorrectly Specified Response Values97
Name of DistributionWeibull
Log Likelihood-0.036363918


   
Number of Observations Read200
Number of Observations Used103


    
ni110


   
-2 Log Likelihood0.073
AIC (smaller is better)6.073
AICC (smaller is better)6.315
BIC (smaller is better)13.977


   
-2 Log Likelihood0.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.


          
Intercept11.62570.01861.58921.66227620.20<.0001
z1-0.04450.0321-0.10750.01841.920.1656
Scale00.00150.00000.00150.0015
Weibull Shape0661.47040.0000661.4704661.4704

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

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

View solution in original post

3 REPLIES 3
SteveDenham
Jade | Level 19

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

desireatem
Pyrite | Level 9

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

SteveDenham
Jade | Level 19

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

sas-innovate-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 840 views
  • 0 likes
  • 2 in conversation