Programming the statistical procedures from SAS

How do I find the mean of the CDF for PROC ICLIFETEST?

Reply
Occasional Contributor
Posts: 18

How do I find the mean of the CDF for PROC ICLIFETEST?

(I'm using SAS 9.4)

 

How do I find the mean for the cumulative distribution function I get from PROC ICLIFETEST. Is it equivalent to the median?

 

 


FailurePlot.png
Super Contributor
Posts: 287

Re: How do I find the mean of the CDF for PROC ICLIFETEST?

No, the median does generally not estimate the mean.

Just to clarify, I understand your question such that you want the estimate of the mean of time-to-event, not the mean of the distribution functions. It is not easy to estimate the mean of the time-to-event from the distribution function, but if you really insist it is the integral of survival function (1-F(t)) taken from 0 to infinity, and it will only work if your estimated survival function ends in 0 such that the integral dont go to infinity.

 

An easier approach is probably to make some parametric assumptions so that the mean has a parametric form. A weibull distribution is among the most popular choiches. Then you can estimate the mean with proc lifereg. This procedure works also if you have left, right or interval censored data which I guess you have since you use ICLIFETEST instead of LIFETEST.

Super Contributor
Posts: 287

Re: How do I find the mean of the CDF for PROC ICLIFETEST?

[ Edited ]

Actually, it is not as difficult to calculate the mean as I thought as first sight. As mentioned it can be calculated by intergrating 1-CDF. The CDF can be calculated from ICLIFETEST. In case you have only left censored values I think it is better to reverse the problem by taking inverse, and then use proc lifetest with right censored values. This is because I think the Kaplan Meier estimate is better than the Turnbull estimate.

 

Then the integral should be calculated. If you use ICLIFTETEST you can use this example where I find the mean from left censored values which was simulated from a gamma distribution with mean=10. The estimated mean (which is the integral) is written to the log-window.

 

data mydata;
  do i=1 to 5000;
    y=rand('gamma',10);
	c=rand('gamma',15);
	if y<c then do;
	  y=c;
	  d=1;
	end;
	else d=0;
	if d=1 then do; lower=.; upper=y; end;
	else do; lower=y;upper=y; end;
	output;
  end;
run;

ods listing close;
proc iclifetest data=mydata outsurv=turnbull ;
  time (lower,upper);
run;
ods listing;

data _NULL_;
  set turnbull end=end;
  retain lasttime lastvalue;
  if _N_=1 then do;
    integral=0;
	lastvalue=1;
	lasttime=0;
  end;

  integral+(leftboundary-lasttime)*(survprob+lastvalue)/2;
  integral+(rightboundary-leftboundary)*survprob;
  lasttime=rightboundary;
  lastvalue=survprob;
  if end then put integral;
run;
SAS Super FREQ
Posts: 3,546

Re: How do I find the mean of the CDF for PROC ICLIFETEST?

For an explanation of approximating the CDF by using trapezoidal approximations, see the article "An easy way to approximate a cumulative distribution function"  It might provide additional insights to @JacobSimonsen's computations.

Ask a Question
Discussion stats
  • 3 replies
  • 347 views
  • 3 likes
  • 3 in conversation