agghaz {PwrGSD} | R Documentation |
Aggregated Hazard
Description
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.
Usage
agghaz(t.agg, time, nrisk, nevent)
Arguments
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 |
Value
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 |
Author(s)
Grant Izmirlian <izmirlian@nih.gov>
Examples
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(nrisk.sex1), cbind(nevent.sex1)))
## Multiple strata--pooled and group 1:
with(fit.msf$Table, agghaz(30, time, cbind(nrisk.sex1+nrisk.sex2,nrisk.sex1),
cbind(nevent.sex1+nevent.sex2,nevent.sex1)))