Retrieve baseline hazard rate and band index at a given attained age
Source:R/sim_cox_age_data_helpers.R
dot-rate_and_band_at_age.RdDetermines which attained-age band contains a given
attained_age and returns both the band index and the
corresponding baseline hazard rate.
Arguments
- attained_age
Numeric scalar giving the current attained age.
- lookup_table
List containing numeric vectors
lo,hi, andrate, defining the lower bounds, upper bounds, and baseline hazard rates for each age band.- tolerance
Small non-negative numeric scalar used when comparing
attained_ageto band boundaries.
Value
A list with components:
- band_index
Integer index of the age band containing
attained_age.- baseline_rate
Numeric scalar baseline hazard rate for the identified band.
If attained_age lies outside the support of the age bands,
both elements are returned as NA.
Details
Age bands are defined by lookup_table$lo and
lookup_table$hi and are treated as left-closed,
right-open intervals: [lo, hi). The final band is treated
as closed on the right to ensure coverage of its upper boundary.
A numerical tolerance is used to avoid instability at band
boundaries due to floating-point rounding.