turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- How do I find the mean of the CDF for PROC ICLIFET...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-08-2016 04:19 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-09-2016 05:46 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-09-2016 07:32 AM - edited 03-10-2016 04:09 AM

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;
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-09-2016 08:19 AM

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.