This function takes fitted data from a serflm() or similar procedure and computes difference between observed and predicted mortality.

fludiff(data = NULL, obsvar = NULL, fitvar = NULL, serfrule = F)

Arguments

data

A dataframe class object, must contain observed, fitted variables

obsvar

named observed outcome variable

fitvar

named fitted trend variable. Can specify either fit line, or upper threshold limit.

serfrule

Logical, default=F. If T the function will apply the Serfling rule which only counts consecutive observations of excess mortality.

Value

an object of class dataframe

Examples

require(flumodelr) df <- flumodelr::fludta serf_fit <- fluserf(fludta, outc =fludeaths, time =yrweek_dt) excess_fludeaths <- fludiff(serf_fit, obsvar=fludeaths, fitvar=y0)