Computes the MLE for the model that assumes piecewise constant hazards on intervals defined by a grid of points. One applications for example is to calculate monthly hazard rates given numbers of events, numbers at risk and event times reported to the day. Can also handle time to event data stratified on a blocking factor.

1 |

`t.agg` |
Vector defining intervals upon which the user wants constant hazard rates. |

`time` |
Event times, possibly stratified on a blocking factor into multiple columns, in units that occur in enough numbers per interval specified above. If there is just a single column then it must be in column form (see example below). |

`nrisk` |
Numbers at risk at specified event times |

`nevent` |
Numbers of events at specified event times |

`time.a` |
User supplied left-hand endpoints of intervals of hazard constancy |

`nrisk.a` |
Numbers at risk on specified intervals |

`nevent.a` |
Numbers of events on specified intervals |

Grant Izmirlian <izmirlian@nih.gov>

1 2 3 4 5 6 7 8 9 | ```
library(PwrGSD)
data(lung)
fit.msf <- mysurvfit(Surv(time, I(status==2)) ~ sex, data=lung)
## A single stratum:
with(fit.msf$Table, agghaz(30, time, cbind(nrisk1), cbind(nevent1)))
## Multiple strata--pooled and group 1:
with(fit.msf$Table, agghaz(30, time, cbind(nrisk1+nrisk2,nrisk1), cbind(nevent1+nevent2,nevent1)))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.