@fullstax/kaplan-meier-estimator
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -15,3 +15,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KME={})}(this,(function(e){"use strict";function t(e,t){const n=(r=e.map(((e,n)=>({tte:e,ev:t[n]}))),s="tte",r.sort(((e,t)=>e[s]-t[s])));var r,s; | ||
* @returns {{ [K: number]: T[] }} | ||
*/const o=(u=e,Array.from(new Set(u)));var u;const d=function(e,t){return e.reduce(((e,n)=>{const r=t(n);return e[r]||(e[r]=[]),e[r].push(n),e}),{})}(n,(e=>e.tte)),c={n:n.length,e:0},f=o.reduce(((e,t)=>{const n=d[t],r=e.length?e[e.length-1]:c,s=n.filter((e=>e.ev)),o=r.n-r.e;return e.push({n:o,e:n.length,d:s.length,t:n[0].tte}),e}),[]);return f}e.compute=function(e,n){if(e.length!==n.length)throw new Error("[kaplan-meier-esimator]: events and censors must be of same length");const r=t(e,n),s={s:1,t:0};return r.reduce(((e,t)=>{const n=e.length?e[e.length-1]:s;return t.d?e.push({t:t.t||0,e:!0,s:n.s*(1-t.d/t.n),n:t.n,d:t.d,rate:t.d/t.n}):e.push({t:t.t||0,e:!1,s:n.s,n:t.n,d:t.d,rate:null}),e}),[]).map((e=>({rate:e.s,time:e.t,event:e.e||!1})))}})); | ||
*/const o=(u=e,Array.from(new Set(u)));var u;const d=function(e,t){return e.reduce(((e,n)=>{const r=t(n);return e[r]||(e[r]=[]),e[r].push(n),e}),{})}(n,(e=>e.tte)),c={n:n.length,e:0},f=o.reduce(((e,t)=>{const n=d[t],r=e.length?e[e.length-1]:c,s=n.filter((e=>e.ev)),o=r.n-r.e;return e.push({n:o,e:n.length,d:s.length,t:n[0].tte}),e}),[]);return f}e.compute=function(e,n){if(e.length!==n.length)throw new Error("[kaplan-meier-estimator]: events and censors must be of same length");const r=t(e,n),s={s:1,t:0};return r.reduce(((e,t)=>{const n=e.length?e[e.length-1]:s;return t.d?e.push({t:t.t||0,e:!0,s:n.s*(1-t.d/t.n),n:t.n,d:t.d,rate:t.d/t.n}):e.push({t:t.t||0,e:!1,s:n.s,n:t.n,d:t.d,rate:null}),e}),[]).map((e=>({rate:e.s,time:e.t,event:e.e||!1})))}})); | ||
//# sourceMappingURL=kaplan-meier-estimator.umd.js.map |
{ | ||
"name": "@fullstax/kaplan-meier-estimator", | ||
"description": "Kaplan-Meier-Estimator also known as the product limit estimator.", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"author": "fullstax Gmbh & Co. KG <dev@fullstax.de>", | ||
@@ -16,3 +16,2 @@ "contributors": [ | ||
], | ||
"type": "module", | ||
"license": "Apache-2.0", | ||
@@ -19,0 +18,0 @@ "module": "./lib/index.mjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
18368
No