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

CI types: simultaneous confidence bands #116

Open
fabian-s opened this issue Sep 10, 2019 · 3 comments
Open

CI types: simultaneous confidence bands #116

fabian-s opened this issue Sep 10, 2019 · 3 comments
Labels
feature feature requests priority: low

Comments

@fabian-s
Copy link
Collaborator

... instead of the pointwise intervals we do now.

Would probably make more sense for at least some of the functional estimates we return like hazard (ratios), survival functions etc.

Implementation could be based on code here:
https://www.fromthebottomoftheheap.net/2016/12/15/simultaneous-interval-revisited/

@fabian-s fabian-s added the feature feature requests label Sep 10, 2019
@fabian-s
Copy link
Collaborator Author

.. not sure how to pull this through the delta method, though.

@StaffanBetner
Copy link
Contributor

Could be obtained via the package gratia, developed by @gavinsimpson.

Example:

library(survival)
library(pammtools)
#> 
#> Attaching package: 'pammtools'
#> The following object is masked from 'package:stats':
#> 
#>     filter
library(gratia)

as_ped(Surv(time, status) ~ temperature + voltage, data = capacitor) |>
  pamm(formula = ped_status ~ s(tend, bs="ad", k = 20)+temperature+voltage) |>
  derivatives(interval = "simultaneous")
#> # A tibble: 200 x 8
#>    smooth  var    data derivative     se  crit    lower  upper
#>    <chr>   <chr> <dbl>      <dbl>  <dbl> <dbl>    <dbl>  <dbl>
#>  1 s(tend) tend   216      0.0823 0.0324  3.20 -0.0213  0.186 
#>  2 s(tend) tend   220.     0.0774 0.0281  3.20 -0.0125  0.167 
#>  3 s(tend) tend   225.     0.0724 0.0247  3.20 -0.00657 0.151 
#>  4 s(tend) tend   229.     0.0672 0.0220  3.20 -0.00325 0.138 
#>  5 s(tend) tend   234.     0.0618 0.0200  3.20 -0.00213 0.126 
#>  6 s(tend) tend   238.     0.0562 0.0184  3.20 -0.00265 0.115 
#>  7 s(tend) tend   243.     0.0505 0.0171  3.20 -0.00422 0.105 
#>  8 s(tend) tend   247.     0.0445 0.0159  3.20 -0.00623 0.0953
#>  9 s(tend) tend   252.     0.0384 0.0146  3.20 -0.00825 0.0852
#> 10 s(tend) tend   256.     0.0322 0.0132  3.20 -0.0100  0.0744
#> # ... with 190 more rows

@gavinsimpson
Copy link
Contributor

@StaffanBetner That would be for the derivative of the specified smooth though, not the smooth itself or a derived quantity like the hazard ratio etc.

I'm in the process of exposing the simulation-based approach to simultaneous intervals for smooths (it's there via confint() methods but it needs a tidy version like the output from derivatives(), and more general exposure if possible so users could apply it to other quantities than just smooths.

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

No branches or pull requests

4 participants