Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for stratification #21

Open
vjd opened this issue Jul 18, 2020 · 2 comments
Open

support for stratification #21

vjd opened this issue Jul 18, 2020 · 2 comments

Comments

@vjd
Copy link

vjd commented Jul 18, 2020

Are there are any plans to support stratification for the K-M fit?

@tbeason
Copy link
Contributor

tbeason commented Aug 13, 2020

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]

@AugustoCL
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants