Calculate the proc 95% CI life cycle for median survival time using survival package R

I'm trying to replicate the results proc lifetestin the SAS using the function R ( survivaland survifit) - and especially calculate 95% confidence interval for the median survival time.

I know that SAS uses the following formula to calculate the confidence interval for the median:

*abs(g(S(t))-g(1-0.5)/g'(S(t))σ(S(t)))<=1.96*

with g '(x), which is the first derivative of g (x) and σ (S (t)), is the standard error of the survival curve, and the default conversion of g to SAS is g(x)=log(-log(x))

Thus, the formula inside the absolute becomes:

(log(-log(S(t)))-log(-log(0.5)))*S(t)*log(S(t))/σ(S(t))

Here is an example of using data kidneyfrom a package survival:

fit1 = survfit(Surv(kidney$time,kidney$status)~kidney$sex, data=kidney)
print(fit1)
BCinds<-abs((log(-log(fit1$surv))-log(-log(0.5)))*fit1$surv*log(fit1$surv)/fit1$std.err)<=1.96

when I run the code obtained from print(fit1):

                n events median 0.95LCL 0.95UCL
kidney$sex=1 20     18     22      12      63
kidney$sex=2 56     40    130      66     190

, BCinds, CI (9, 154) = 1, = 2 CI - (39, 511).

sex=1 95%CI: (9, 154)  sex=2 95%CI: (39, 511)

SAS :

    ods graphics on;
proc lifetest data=work.test
    plots=survival(nocensor cb=hw cl strata=panel);
    strata sex/group=sex;
    time time*status(0);
    run;
ods graphics off;

:

 sex=1: median=22 and 95%CI: (12, 30)
 sex=2: median=130 and 95%CI: (58,185)

, ? , ? , , .

!

+4
2

, "" R- .

, survfit R SAS ( log-log).

, R-, R , SAS. , , kidney, :

    `survfit(Surv(kidney$time,kidney$status)~kidney$sex, conf.type="log-log"
    + )
    Call: survfit(formula = Surv(kidney$time, kidney$status) ~ kidney$sex, 
        conf.type = "log-log")

              n events median 0.95LCL 0.95UCL
kidney$sex=1 20     18     22      12      30
kidney$sex=2 56     40    130      58     185`

, survfit: "log", "log-log", "plain", "none"

, , , , - , , .

+1

- fit1$std.err BCinds. S(t) - fit1$std.err ( R survfit.object) -log (). summary(fit1)$std.err.

0

Source: https://habr.com/ru/post/1679963/


All Articles