sean-reed Sweden

A Python 3 implementation of the algorithm for calculating the system and survival signature from a binary decision diagram representation of a system's reliability structure function.

Binary Decision Diagrams (BDDs) in pure Python and Cython bindings to CUDD and BuDDy

Survival analysis in Python

issue closedCamDavidsonPilon/lifelines

The docstring says this function gives a plot of log(S(t)) against log(t) but it actually produces a plot of log(-log(S(t))) (correctly labelled on y-axis) against t (incorrectly labelled as log(t)) with a linear-scaled y-axis and log-scaled x-axis.

I can submit a fix for this but, assuming the intention of this function is to produce a straight line plot for Weibull distributed survival times, there are various solutions:

(a) Plot -log(S(t)) against t, with log-scaled x and y axes. (b) Plot -log(S(t)) against log(t), with linear-scaled x-axis and log-scaled y-axis. (c) Plot log(-log(S(t)) against log(t), with linear-scaled x and y axes.

My suggestion is solution (b) as it's closest to the current function name and docstring.

closed time in 2 months

sean-reed

pull request commentCamDavidsonPilon/lifelines

``````from lifelines.datasets import load_dd
from lifelines import KaplanMeierFitter

kmf = KaplanMeierFitter()
T = data["duration"]
E = data["observed"]
kmf.fit(T, event_observed=E)
kmf.plot_loglogs()
``````

Or with `kmf.plot_loglogs(show_censors=True)`:

sean-reed

comment created time in 2 months

PR opened CamDavidsonPilon/lifelines

+1 -1

0 comment

1 changed file

pr created time in 2 months

push eventsean-reed/lifelines

commit sha ed5d8e8957c726a543e6ea37bc218716e03852b0

Fix typo in kaplan_meier_fitter.py

push time in 2 months

PR opened CamDavidsonPilon/lifelines

Now plots log(-log(S)) against log(t) on linear axes.

+6 -5

0 comment

2 changed files

pr created time in 2 months

create barnchsean-reed/lifelines

created branch time in 2 months

delete branch sean-reed/lifelines

delete branch : log-rank-alternatives

delete time in 2 months

pull request commentCamDavidsonPilon/lifelines

Added some docs and also the Fleming-Harrington test (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6047314/#bib4) that allows testing for late differences in survival.

sean-reed

comment created time in 2 months

push eventsean-reed/lifelines

commit sha 0891170b43bfa951225c3c5300185453ab60ac48

Added Fleming-Harrington logrank test and some documentation for weighted logrank tests to Examples.rst.

push time in 2 months

pull request commentCamDavidsonPilon/lifelines

Thanks, leave it to me I'll add it.

sean-reed

comment created time in 2 months

issue commentCamDavidsonPilon/lifelines

Yes, sounds good to me.

sean-reed

comment created time in 2 months

issue commentCamDavidsonPilon/lifelines

On that second point, may also be useful to have the option to have the confidence intervals included in the plot? I don't think it's an option at the moment?

sean-reed

comment created time in 2 months

issue commentCamDavidsonPilon/lifelines

For checking proportional hazards I don't think it matters too much as the curves will be parallel either way if the assumption holds since it's just a different scaling of time. I think it's still useful to plot either log(t) on a linear axis or t on log axis (as it is now) though, as then Weibull distributed survival times should appear as an approximately straight line.

sean-reed

comment created time in 2 months

push eventsean-reed/lifelines

Fix typos in Weibull fitter description.

commit sha 6d0ff80ec23e81090f9f49c9acc0af3bd067c0ca

Merge pull request #1031 from sean-reed/patch-1 Fix typos in Weibull fitter description.

commit sha e172eea1125381097809b089f621517bc356d4be

Merge branch 'master' into log-rank-alternatives

commit sha 258be2c9e34f1706dc59c6454161e5f15f96c490

Updated option names for weighted log-rank tests.

push time in 2 months

pull request commentCamDavidsonPilon/lifelines

The weighted tests put emphasis on the beginning of the survival curve (e.g. Wilcoxon where weight is based on remaining number at risk), increasing the power of the test when it's expected the difference in survival is early on, whereas the standard log-rank test has maximum power for proportional hazards. For example, certain drugs reduce death rates early on (e.g. first 10 years over 20 year follow up) but have less effect on the death rate for those that survive beyond a certain point (e.g. between years 10 and 20). Another example might be an online store testing whether including a discount voucher with a customer's order influences the time to them placing their next order. You might expect it to influence the rate of re-ordering for the first few weeks after receiving the voucher but have a diminishing influence later on, so a weighted test may be more appropriate. Should add that the choice of whether to weight the test should be made in advance to avoid introducing bias. I can add something to the docs on this at some point.

sean-reed

comment created time in 2 months

Pull request review commentCamDavidsonPilon/lifelines

` def multivariate_logrank_test(     t_0: float, optional (default=-1)         the period under observation, -1 for all time. +    weightings: str, optional+        apply a weighted logrank test: options are "w" for Wilcoxon (also known as Breslow), "tw"`

Yes, that seems better.

sean-reed

comment created time in 2 months

issue openedCamDavidsonPilon/lifelines

The docstring says this function gives a plot of log(S(t)) against log(t) but it actually produces a plot of log(-log(S(t))) (correctly labelled on y-axis) against t (incorrectly labelled as log(t)) with a linear-scaled y-axis and log-scaled x-axis.

I can submit a fix for this but, assuming the intention of this function is to produce a straight line plot for Weibull distributed survival times, there are various solutions:

(a) Plot -log(S(t)) against t, with log-scaled x and y axes. (b) Plot -log(S(t)) against log(t), with linear-scaled x-axis and log-scaled y-axis. (c) Plot log(-log(S(t)) against log(t), with linear-scaled x and y axes.

My suggestion is solution (b) as it's closest to the current function name and docstring.

created time in 2 months

push eventsean-reed/lifelines

Fix typos in Weibull fitter description.

commit sha 6d0ff80ec23e81090f9f49c9acc0af3bd067c0ca

Merge pull request #1031 from sean-reed/patch-1 Fix typos in Weibull fitter description.

push time in 2 months

PR opened CamDavidsonPilon/lifelines

+1 -1

0 comment

1 changed file

pr created time in 2 months

push eventsean-reed/lifelines

Fix typos in Weibull fitter description.

push time in 2 months

PR opened CamDavidsonPilon/lifelines

See issue #452

+126 -8

0 comment

2 changed files

pr created time in 2 months

delete branch sean-reed/lifelines

delete branch : wilcoxon

delete time in 2 months

create barnchsean-reed/lifelines

created branch time in 2 months

push eventsean-reed/lifelines

commit sha fff34db897ca2f544f3258fd91caf5db71627e17

Moved iloc to top level function.

commit sha 94e38fdd2082146fa3acb676b172d5e1165b834b

commit sha a368b003d46a3e3c2548021e91dba2fffbe3128b

commit sha 290d5833384a16c2ca76995f4c0f9514e15c807b

commit sha 027ffd71f30ed5b81dc5447737d798de3000f2ba

v0.24.6

commit sha 0959c432e0b758c66e23f0cd21f8f2785c96eaf6

v0.24.6

commit sha c16a3d9f112ab695388dcb276467da0def30d8d1

fix iloc

commit sha 4f762299ee1a2de53ca233441d61f702499099f4

wip

commit sha c8df258d307fc10492ba35e3856bbeceb8490d9b

commit sha 504498186e4aa66a10e02ebd26abd4979dd905bc

changelog

commit sha 6c45a8fc1d346432c2a00f21283ed15954e0e849

Merge pull request #1008 from CamDavidsonPilon/v0.24.6 v0.24.6

commit sha c95aa6df74ee955ddb08553c156fe5f0c926765e

Typo in parametric baseline estimation method for splines

commit sha 7ccf194368e21dd673b8ca0a0c47044bee088eef

Merge pull request #1009 from spiros/patch-1 Typo in parametric baseline estimation method for splines

commit sha b33d1aa14559bc1d2f43ce21f46d6c6b68ca5dce

doc bug hunting

commit sha e994713efd517fd2d1d47de2ce497c5befd4f411

clean up survival regression docs

commit sha 948d31f29d009fcbea1e8754a0c74eec184a0081

wip - these time-v functions are confusing as heck

docs improvements

commit sha d1e121f2a10d9088ce2b24f098307d5050ddc403

more corrections

commit sha ed2b20097c13309eb626bcc3b4a488c55c935dcc

done?

push time in 2 months

startedCamDavidsonPilon/lifelines

started time in 3 months

issue commentCamDavidsonPilon/lifelines

Great, I will add the other log-rank test variants and the unit tests etc. soon.

yong27

comment created time in 3 months

issue commentCamDavidsonPilon/lifelines

There are a few other popular variations on the log-rank test that could also be added such as Peto and Flemington-Harrington.

yong27

comment created time in 3 months

issue commentCamDavidsonPilon/lifelines

I had a go at adding the Wilcoxon and Tarone-Ware test stats: https://github.com/sean-reed/lifelines/blob/bb93312c4462c5a808118a6f1b79ea76aab2a9f7/lifelines/statistics.py#L649

Not much to the implementation of the tests themselves since just a case of applying weightings in the numerator and covariance matrix computations within the existing log-rank statistic implementation - mostly a refactoring to avoid duplicated code between the test statsistics. I still need to add some unit tests but were correct on on a few test examples I tried...

yong27

comment created time in 3 months

create barnchsean-reed/lifelines

created branch time in 3 months

delete branch sean-reed/lifelines

delete branch : wilcoxon

delete time in 3 months

push eventsean-reed/lifelines

commit sha bb93312c4462c5a808118a6f1b79ea76aab2a9f7