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

Evaluating estimators #53

Open
ya0 opened this issue Aug 3, 2023 · 2 comments
Open

Evaluating estimators #53

ya0 opened this issue Aug 3, 2023 · 2 comments

Comments

@ya0
Copy link

ya0 commented Aug 3, 2023

I have been using kaplan meier estomators and wrote a small function to evaluate the estimator at any timepoint. I have used this to generate statistics or diagnostic plots.

function evaluate(km_fit::KaplanMeier, t::Real)
    time_points = km_fit.events.time
    survival = km_fit.survival
    if t <= time_points[1]
        return 1
    else
        id = findlast(x -> x <= t, time_points) 
        return survival[id]
    end
end

@ararslan if you think this is a usefull feature i can create pull request. I have not looked at the Nelson Aalen estimator but maybe something similar can be done / in general for the nonparametric estimator type.

@ararslan
Copy link
Member

ararslan commented Aug 4, 2023

Nice idea! The functionality seems worthwhile to have but I wonder if it would make sense to define it as a method of getindex or even of the object itself. So with km = KaplanMeier(...) and a time t, that would be km[t] or km(t), respectively. What are your thoughts on that?

@ya0
Copy link
Author

ya0 commented Aug 4, 2023

Yes that would look nice, as in https://docs.julialang.org/en/v1/manual/methods/#Function-like-objects

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

No branches or pull requests

2 participants