Giter VIP home page Giter VIP logo

kaplanmeier's Introduction

kaplanmeier - Python package to compute the kaplan meier curves, log-rank test, and make the plots.

Python PyPI Version License Coffee Github Forks GitHub Open Issues Project Status Downloads Downloads

Star it if you like it!

Installation

  • Install kaplanmeier from PyPI (recommended). kaplanmeier is compatible with Python 3.6+ and runs on Linux, MacOS X and Windows.
  • Distributed under the MIT license.

Requirements

  • Create environment:
conda create -n env_KM python=3.6
conda activate env_KM
pip install matplotlib numpy pandas seaborn lifelines

Installation

pip install kaplanmeier

Import kaplanmeier package

import kaplanmeier as km

Example:

df = km.example_data()
time_event=df['time']
censoring=df['Died'] 
labx=df['group']

# Compute survival
out=km.fit(time_event, censoring, labx)

Make figure with cii_alpha=0.05 (default)

km.plot(out)

km.plot(out, cmap='Set1', cii_lines=None, cii_alpha=0.05)

km.plot(out, cmap='Set1', cii_lines='line', cii_alpha=0.05)

km.plot(out, cmap=[(1, 0, 1),(0, 1, 1)])

km.plot(out, cmap='Set2')

km.plot(out, cmap='Set2', methodtype='custom')

  • df looks like this:
     time  Died  group
0     485     0      1
1     526     1      2
2     588     1      2
3     997     0      1
4     426     1      1
..    ...   ...    ...
175   183     0      1
176  3196     0      1
177   457     1      2
178  2100     1      1
179   376     0      1

[180 rows x 3 columns]

Citation

Please cite kaplanmeier in your publications if this is useful for your research. Here is an example BibTeX entry:

@misc{erdogant2019kaplanmeier,
  title={kaplanmeier},
  author={Erdogan Taskesen},
  year={2019},
  howpublished={\url{https://github.com/erdogant/kaplanmeier}},
}

References

Maintainer

  • Erdogan Taskesen, github: erdogant
  • Contributions are welcome.
  • If you wish to buy me a Coffee for this work, it is very appreciated :)

kaplanmeier's People

Contributors

alabamagan avatar erdogant avatar ndaniel avatar neikxd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.