Programming the statistical procedures from SAS

Estimating the cumulative rate and CI at a certain time point from a Kaplan Meier

Reply
Regular Contributor
Posts: 163

Estimating the cumulative rate and CI at a certain time point from a Kaplan Meier

Hi all

I have a simple proc lifetest:

 

proc lifetest data=d4 atrisk plots=survival( f atrisk (atrisktickonly outside) test  ) notable;

strata status;

time Year*esldnum(0);

run;

 

How can I estimate 

1- The Cumulative rate and CI at a certain time point (t)

2- The total person-year follow up time for each strata?

 

Kind regards

Am

Respected Advisor
Posts: 4,748

Re: Estimating the cumulative rate and CI at a certain time point from a Kaplan Meier

1- From the manual :  proc lifetest data=d4 atrisk notable TIMELIST=t  ... ;

2- proc sql; select status, sum(year) as totalFollowUpYears from D4 group by status; quit;

PG
Super Contributor
Posts: 287

Re: Estimating the cumulative rate and CI at a certain time point from a Kaplan Meier

Agree...except that the confidence intervals are not shown by adding "timelist=". Only the estimated survival probability at time=t is shown.

Alternative, the survival probability and confidence intervals can be read from the dataset with the survival curve: (t=5 here).

proc lifetest data=d4 outsurv=outsurv;
strata status;
time Year*esldnum(0);
run;
data pointestimate;
set outsurv(where=(t<5));
by status;
if last.status;
run;

Regular Contributor
Posts: 163

Re: Estimating the cumulative rate and CI at a certain time point from a Kaplan Meier

Thank you all

I think what I would get from these analysis is the cumulative survival

What I am actually interested in is the cumulative hazard rate at the a certain time point (the median survival point)

Wouls appreciate any help with that

Kind regards

A

Respected Advisor
Posts: 4,748

Re: Estimating the cumulative rate and CI at a certain time point from a Kaplan Meier

Hazard estimates are only provided with the life table method in the OUTSURV= dataset.

PG
Regular Contributor
Posts: 163

Re: Estimating the cumulative rate and CI at a certain time point from a Kaplan Meier

Thanks again

The Outsurv tables provides "Survival Distribution Function Estimate", and that is not the cumulative hazards

Could anyone please comment on how to get the cumulative hazards at a certain time point and their confidence interval (at that time point)

Kind regards

 

Super Contributor
Posts: 287

Re: Estimating the cumulative rate and CI at a certain time point from a Kaplan Meier

[ Edited ]

If you want the cumulative survial rate (not the probability) then you just take -Log(S(t)), where S is the Kaplan Meier curve. Confidence intervals is found just be use same transformation of the confidence intervals of the Kaplan Meier curve.

 

Or, you can get it directly from proc phreg:

data simulation;
  do i=1 to 1000;
    t=rand('exponential',10);
    c=rand('exponential',10);
	event=(t<c);
	t=min(t,c);
	output;
  end;
run;
proc phreg data=simulation;
  model t*event(0)=;
  baseline out=out cumhaz=cumhaz lowercumhaz=lower uppercumhaz=upper;
ruN;

 and, if you want to pick out the function as a specific time-point you can do by find the last observation in the "out" dataset before (or at) the timepoint you are interested. Like in my suggestion above.

 

by the way, it is not so easy to find the median survival point if you have censoring. In that case you may need to assume some distribution of the survival time (weibull for instance) and then use proc lifereg to estimate the parameters. Afterward you can calculate median from the estimated parameters.

Regular Contributor
Posts: 163

Re: Estimating the cumulative rate and CI at a certain time point from a Kaplan Meier

[ Edited ]

Thank you JacobSimonsen

Very nice suggession

 

I tried a different approach:

 

ods output productlimitestimates=naout;
proc lifetest data=d4 nelson ;
strata group;
time time*event(0);
run;
proc sort data=naout (where=(cumhaz ne .));
by group time ;
run; data naout2; set naout; LowerCIFailure=failure-1.96*StdErr; UpperCIFailure=failure+1.96*StdErr; LowerCICumHaz=CumHaz-1.96*StdErrCumHaz; UpperCICumHaz=CumHaz+1.96*StdErrCumHaz; run;

Interestingly this produces the exact cum hazards estimates as the ones from proc phreg as you suggested

But the 95% confidence intervals are different, so I mudt have calculated it worngly

Any suggession is appreciated

Kind regards

Super Contributor
Posts: 287

Re: Estimating the cumulative rate and CI at a certain time point from a Kaplan Meier

I dont think you calculated it wrong. Your method can be asymptotical equivalent to what phreg produce. I think phreg cumputes the limits on some transformation of the cumulative hazard, which then is transformed back.

Unfortunately, it is not mentioned in the documentation how the limits of the cumulative hazard is computed. But I guess that it is calculated as -log() to the limits of S(t), and these limits are calculated on the log(S(t)) scale by default.
Regular Contributor
Posts: 163

Re: Estimating the cumulative rate and CI at a certain time point from a Kaplan Meier

I would appreciate if there is a way to programmatically calculate the confidence interval for failure using the lifetest procedure. THe option outsurv gives the confidence interval table for survival only and not for failure

Kind regards

 

Super Contributor
Posts: 287

Re: Estimating the cumulative rate and CI at a certain time point from a Kaplan Meier

since probability of failure is just 1-survial, you can calculate confidence limits for failure from the confidence limits of survival.

 

 

proc lifetest data=...          outsurv=outsurv;

...

..

run;

 

data outsurv;
  set outsurv;
  failure=1-survival;
  failure_lower=1-sdf_ucl;
  failure_upper=1-sdf_lcl;
run;

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