Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fullstax/kaplan-meier-estimator

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fullstax/kaplan-meier-estimator

Kaplan-Meier-Estimator also known as the product limit estimator.

  • 3.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17
decreased by-41.38%
Maintainers
1
Weekly downloads
 
Created
Source

kaplan-meier-estimator

A JavaScript implementation of the Kaplan-Meier-Estimator also known as the product limit estimator.

Installation

node

npm install --save kaplan-meier-estimator

Browser

<script src="https://unpkg.com/kaplan-meier-estimator@latest/lib/kaplan-meier-estimator.umd.js">

Usage

esm/typescript usage

See examples/node for an example implementation.

import { compute } from '@fullstax/kaplan-meier-estimator';

const timeToEvents = [1, 12, 22, 29, 31, …];
const events = [false, true, false, true, true, …];

const kmData = compute(timeToEvents, events);
console.table(kmData);

CommonJs is also supported:

const { compute } = require('@fullstax/kaplan-meier-estimator');

browser usage

See examples/browser for an example implementation. To server this example jsu start d webserver in the root of this repository.

<script src="https://unpkg.com/@fullstax/kaplan-meier-estimator/lib/kaplan-meier-estimator.umd.js">
const timeToEvents = [1, 12, 22, 29, 31, …];
const events = [false, true, false, true, true, …];

const kmData = KME.compute((timeToEvents, events);

console.table(kmData);

example output

┌─────────┬───────┬──────┬───────┐
│ (index) │  rate │ time │ event │
├─────────┼───────┼──────┼───────┤
│    0    │   1   │  1   │ false │
│    1    │ 0.929 │  12  │ true  │
│    2    │ 0.929 │  22  │ false │
│    3    │ 0.851 │  29  │ true  │
│    4    │ 0.774 │  31  │ true  │
│    …    │   …   │   …  │   …   │
└─────────┴───────┴──────┴───────┘

Example

Data

#Time to Eventevent>S(t)
11false1
212true0.93
322false0.93
429true0.85
531true0.77
636false0.77
738false0.77
850false0.77
960false0.77
1061true0.64
1170true0.52
1288false0.52
1399false0.52
14110false0.52
15140false0.52

Plot

Kaplan-Meier example plot, CC-0

License

Licensed 2022 by fullstax GmbH & Co. KG under a MIT License.

FAQs

Package last updated on 29 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc