weibull for free form data (interval)

#1
How do i implement lifereg or generate a weibull distribution for this kind of data?

Time (Mins) Cumulative % Failure
0-30 4
30-60 10
60-90 15
90-120 18
120-150 22
150-180 27
 
#2
You mean binned data? Well, you should avoid binning in the first place; better to record the failure times directly and do a maximum likelihood fit to them. But if the data is given to you like this, obviously you can't un-bin. You can do a chi-squared fit to the counts in each bin, adjusting the Weibull parameters to minimize the chi-squared. You can use these bin counts directly and fit to the CDF, or you can convert to binned failure times (4, 10-4=6, 15-10=5, etc.) and fit to the PDF.
 
#3
Thanks for your reply. I am unable to un-bin as the data is available only as such. How does one use Lifereg for such data? I am confused with the syntax as I am new to SAS.
 

Mean Joe

TS Contributor
#4
A couple of questions:

1) Do you know the sample size? SAS has 3 types of model statements, but you can only use one of them in a proc call. If you do not know sample size, then I don't think you can use lifereg.

2) In the data you provided, cumulative failure % only goes up to 27. Does that mean the other 73% is censored, with survival > 180 minutes?


I wrote up some code, and I'll post it now because I don't want to save it. But it assumes you know the sample size:

%let SAMPLESIZE=500; *put your sample size here;


data talkstats;
input interval $ cumpct;
datalines;
0-30 4
30-60 10
60-90 15
90-120 18
120-150 22
150-180 27
;
run;


data talkstats2(drop=interval);
set talkstats end=last;
time_begin=input(substr(interval,1,index(interval,"-")-1),8.);
time_end=input(substr(interval,index(interval,"-")+1),8.);
if (last) then do;
output;
*un-comment the code below, if your data past 180 minutes are indeed censored;
/* time_begin=.; cumpct=100; output;*/
end;
else output;
run;


data talkstats3(drop=beginpct intervalpct temp);
retain beginpct;
set talkstats2;
if _N_=1 then beginpct=0;
intervalpct=cumpct-beginpct;

temp=intervalpct * &SAMPLESIZE/100;
do while (temp>0);
output;
temp=temp-1;
end;

beginpct=cumpct;
run;


proc lifereg data=talkstats3;
model (time_begin, time_end) = ;
run;

*SAS also has a model statement where you can do: model r/n = ;
but since you have interval-type survival times then you cannot use that type of model, I believe;
 
#5
Joe,
Thanks for your reply. Answers to your questions are:

Nope I do not know the total sample size. Only 27% has failed till the time I have mentioned. Since I do not know the sample size I am forced to assume that the rest of the sample survive greater than the max time given in my data. They would then be right censored.