2
$\begingroup$

I am trying to plot/generate a survival curve in Excel using the output from flexsurvreg in R. The below is a snapshot from R with the corresponding estimates (y axis values) for the time (x axis values). What I am trying to workout here is to find the formula (survivor function) so that I can utilise the meanlog and sdlog est, and input them in the formula with the x time to derive the survival probability (est). Any help is greatly appreciated, thanks.

I have the below formula but couldn't seem to work it out. What do I use in Excel for Φ, mu and sigma?

enter image description here

> model <- flexsurvreg(Surv(times_start, times_end, type="interval2")~1, dist="lnorm")
> model
Call:
flexsurvreg(formula = Surv(times_start, times_end, type = "interval2") ~ 
    1, dist = "lnorm")

Estimates: 
         est     L95%    U95%    se    
meanlog  2.6263  2.4568  2.7957  0.0864
sdlog    1.1380  0.9969  1.2991  0.0769

N = 225,  Events: 0,  Censored: 225
Total time at risk: 2734.501
Log-likelihood = -497.8637, df = 2
AIC = 999.7274

> summary(model)

      time       est       lcl       ucl
1   0.0001 1.0000000 1.0000000 1.0000000
2   0.7500 0.9947757 0.9871133 0.9981939
3   1.5000 0.9745022 0.9556606 0.9870252
4   2.2500 0.9446680 0.9165437 0.9666503
5   3.0000 0.9102695 0.8754248 0.9395832
6   3.7500 0.8741708 0.8355812 0.9097379
7   4.5000 0.8379620 0.7962243 0.8778450
8   5.2500 0.8025201 0.7585844 0.8444564
9   6.0000 0.7683175 0.7223318 0.8122682
10  6.7500 0.7355924 0.6877659 0.7821786
11  7.5000 0.7044459 0.6558354 0.7534993
12  8.2500 0.6748975 0.6243500 0.7261655
13  9.0000 0.6469193 0.5961911 0.7004432
14  9.7500 0.6204563 0.5685930 0.6745498
15 10.5000 0.5954384 0.5421064 0.6514573
16 11.2500 0.5717888 0.5174307 0.6294487
17 12.0000 0.5494284 0.4940210 0.6070700
18 12.7500 0.5282787 0.4725858 0.5865717
19 13.5000 0.5082639 0.4512857 0.5665737
20 14.2500 0.4893115 0.4324061 0.5480763
21 15.0000 0.4713531 0.4137265 0.5301801
22 15.7500 0.4543244 0.3964777 0.5132348
23 16.5000 0.4381654 0.3790013 0.4982930
24 17.2500 0.4228201 0.3625291 0.4830236
25 18.0000 0.4082367 0.3475374 0.4685829
26 18.7500 0.3943669 0.3337319 0.4543229
27 19.5000 0.3811658 0.3201412 0.4416411
28 20.2500 0.3685921 0.3072418 0.4293680
29 21.0000 0.3566073 0.2954934 0.4172957
30 21.7500 0.3451756 0.2846739 0.4057205
31 22.5000 0.3342639 0.2731213 0.3949677
32 23.2500 0.3238415 0.2629543 0.3839551
33 24.7500 0.3043525 0.2441482 0.3647242
34 26.2500 0.2865035 0.2271337 0.3464885
35 27.7500 0.2701166 0.2116445 0.3297161
36 29.2500 0.2550376 0.1965890 0.3142766
37 30.0000 0.2479457 0.1895891 0.3073740
38 34.5000 0.2107609 0.1563823 0.2693629
> 
$\endgroup$

2 Answers 2

0
$\begingroup$

I've just done exactly the same thing. Through trial and error I figured it out. In Excel, you can use:

1-lognormdist(t,meanlog,exp(sdlog))

I don't know why you have to exponentiate sdlog and not meanlog, but this produces the same survival predictions as R. Hope this helps :)

$\endgroup$
2
  • 1
    $\begingroup$ This doesn't appear to work for me when I test it. However simply 1-LOGNORMDIST(A1, 2.6263, 1.1380) does appear to work (where A1 is the time column) $\endgroup$
    – gowerc
    Commented Aug 22, 2023 at 10:17
  • 1
    $\begingroup$ Or alternatively you can use: 1-NORM.DIST(LN(A3),2.6263, 1.138, TRUE) $\endgroup$
    – gowerc
    Commented Aug 22, 2023 at 10:20
0
$\begingroup$

If you don't care about the formula and all you want is the predicted survival probability, you could just use the predict() method. Alternatively, if you are inlcluding covariates and you want the marginal survival probability for some covariate values you could use g-computation with the predict() method, or use implementations in packages like the adjustedCurves or contsurvplot packages.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.