*==================================================; * Example of an exponential regression *; *==================================================; options ls=75; data one; input y x cen; ***** you do not need to say [ly = log(y)] because it does log for you; ***** cannot have 0's in the responses, since log(0) is a no-no; cards; 15 2 0 13 3 1 9 1 1 19 3 1 12 2 1 ; proc lifereg data=one; model y = /dist=exponential; ***ignor censoring!! and no covariate ***; run; * the output is actually for an extreme value distribution estimates *; * Homework: Use the output, give the fitted hazard function of the weibull.*; * To force intercept=0, say noint as in /dist=weibull noint; * To force scale=1, use exp as dist. ; proc lifereg data=one; model y*cen(0)= /dist=exponential; run; ** To predict the median and other quantiles, i.e. ** the median of the dist by fitted model, try this example. proc lifereg data=one; model y*cen(0)= /dist=exponential; output out=new p=perc quantiles=0.1 0.5 0.9; run; proc print data=new; var _prob_ perc; run; *==========================================================; * Example of a Weibull (exponential) regression with a *; * doubly and interval censored data set: double *; *==========================================================; data double; input upper lower x; cards; 12 12 55 14 . 59 16 . 48 14 14 39 . 8 44 13 9 48 9 9 45 ; run; proc lifereg data=double; model (lower,upper)= / dist=weibull; run; *** To fix the intercept or scale at a given value, we can do ***; proc lifereg data=double; model (lower,upper)= / dist=weibull scale=0.5 noscale intercept=1 noint; run; *** if "noscale" is ommited then sas just use scale=0.5 as initial value in*; *** iteration of maximumization *; *** how to fix a covariate, like R offset() ??? ***; For similar effect to R function survreg() offset(), may be we can substract from the responses y the amount b*age and then do the fit use y-b*age as the new responses.