Survival.jl
Survival.jl copied to clipboard
support for stratification
Are there are any plans to support stratification for the K-M fit?
Not sure if this is what you had in mind but it isn't hard to do this on your own. Suppose you have failure time data and also a variable on whether that thing/person was cool or not.
using DataFrames, Survival, Random
Random.seed!(111)
N = 100
df = DataFrame(cool=rand(Bool,N),time=randexp(N),status=rand(Bool,N))
# create EventTimes
df.evt = EventTime.(df.time,df.status)
# group data
gdf = groupby(df,:cool)
# fit separately for each group
KMs = [ fit(KaplanMeier,g.evt) for g in gdf]
if you can add this example to the documentation it will help a lot of people.
I myself had to google to come up with this example.