🚨 Shai-Hulud Strikes Again:More than 500 packages and 700+ versions compromised.Technical Analysis β†’
Socket
Book a DemoInstallSign in
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.

latest
Source
npmnpm
Version
3.1.2
Version published
Maintainers
1
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