Attributable fraction function based on a Cox Proportional Hazard regression model as a coxph object (commonly used for cohort sampling designs with time-to-event outcomes).
coxph
Useful links