mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 02:14:13 +00:00
Add surv Verb to Estimate a Survival Curve (#1788)
Add a surv verb to estimate a survival curve using Kaplan-Meier. It requires duration and status (event or censored) columns, and outputs each distinct duration and corresponding probability of survival.
This commit is contained in:
parent
35c7eeb977
commit
df73ad8ec0
9 changed files with 216 additions and 4 deletions
|
|
@ -1261,6 +1261,16 @@ Options:
|
|||
--transpose Show output with field names as column names..
|
||||
-h|--help Show this message.
|
||||
|
||||
================================================================
|
||||
surv
|
||||
Usage: mlr surv -d {duration-field} -s {status-field}
|
||||
|
||||
Estimate Kaplan-Meier survival curve (right-censored).
|
||||
Options:
|
||||
-d {field} Name of duration field (time-to-event or censoring).
|
||||
-s {field} Name of status field (0=censored, 1=event).
|
||||
-h, --help Show this message.
|
||||
|
||||
================================================================
|
||||
tac
|
||||
Usage: mlr tac [options]
|
||||
|
|
|
|||
1
test/cases/verb-surv/0001/cmd
Normal file
1
test/cases/verb-surv/0001/cmd
Normal file
|
|
@ -0,0 +1 @@
|
|||
mlr --csv --from test/input/surv.csv surv -d duration -s status
|
||||
0
test/cases/verb-surv/0001/experr
Normal file
0
test/cases/verb-surv/0001/experr
Normal file
4
test/cases/verb-surv/0001/expout
Normal file
4
test/cases/verb-surv/0001/expout
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
time,survival
|
||||
1.00000000,0.80000000
|
||||
3.00000000,0.53333333
|
||||
5.00000000,0.00000000
|
||||
6
test/input/surv.csv
Normal file
6
test/input/surv.csv
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
duration,status
|
||||
1,1
|
||||
2,0
|
||||
3,1
|
||||
4,0
|
||||
5,1
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue