adibender/pam

More careful CI calculation

Closed this issue · 0 comments

We need to be more careful constructing CI.
For example the simple calculation at the moment (using hazar -2SE on predictions obtained with `type="response") can produce negative lower bounds.
This can also lead to cumulative hazard lower CI bounds to be non-monotonous.

  ped <- split_data(Surv(time, status)~ trt + age, data=veteran, id="id")
  pam <- gam(ped_status ~ s(tend, k=5) + trt, 
    data=ped, family = poisson(), offset = offset)
  haz_test <- add_hazard(ped_info(ped), pam) %>% 
    summarize_at(c("hazard", "lower", "upper"), funs(any(. < 0)))
  add_hazard(ped_info(ped), pam) %>% select(hazard, lower) %>% 
    filter(lower  < 0)
## # A tibble: 2 x 2
##        hazard         lower
##         <dbl>         <dbl>
## 1 0.001996501 -0.0001095794
## 2 0.001971281 -0.0001270231