R/rmst_on_summary.R

Defines functions rmst_on_summary

rmst_on_summary <- function(df, tmax) {
  not_dead <- mapply(
    function(eligible, event) {
      if (eligible == 0) {
        return(1)
      } else {
        return((eligible - event) / eligible)
      }
    },
    df$eligible[df$time < tmax],
    df$event[df$time < tmax]
  )
  
  return(sum(cumprod(not_dead)))
}

Try the fastpseudo package in your browser

Any scripts or data that you put into this service are public.

fastpseudo documentation built on May 1, 2019, 6:35 p.m.