getSMR {diseasemapping} | R Documentation |
The getSMR function calculates the rate of observe value over expected value. It will also merge back the observed value, expected value and the ratio back to the population data set.
getSMR(popdata, model, casedata, regionCode = "CSDUID", regionCodeCases = "CSD2006", area = FALSE, area.scale = 1, ...) ## S3 method for class 'data.frame': getSMR(popdata, model, casedata=NULL, regionCode = "CSDUID", regionCodeCases = "CSD2006", area = FALSE, area.scale = 1, ...) ## S3 method for class 'list': getSMR(popdata, model, casedata = NULL, regionCode = "CSDUID", regionCodeCases = "CSD2006", area = FALSE, area.scale = 1, years = NULL, personYears= TRUE, year.range = NULL, ...) ## S3 method for class 'SpatialPolygonsDataFrame': getSMR(popdata, ...)
popdata |
the name of population data set |
model |
rates, either fitted model (usually a glm object), or a vector of rates. |
... |
additional arguments |
casedata |
the name of case data set |
regionCode |
the name of district area column in population data set |
regionCodeCases |
the name of district area column in case data set |
area |
if TRUE , calculate the expected number of cases per area in each region |
area.scale |
control the unit of area. e.g $10^6$: per square kilometers |
years |
the vector of years |
personYears |
a logic variable. If TRUE , it compute offset adding person years |
year.range |
the range of the year vector |
If model
is numeric, it's assumed to be a vector of rates, with the names of the elements corresponding to columns of the population data set. Names do not need to match exactly (can have M in one set of names, male in another for instance).
Otherwise, model
is passed to the predict
function.
Returns a new population data set contains expected number of cases, observed number of cases and SMR. It has the same format as the population data set which put into the function.
data(casedata) data(popdata) therates = getRates(casedata, popdata, ~age*sex,breaks=c(seq(0, 80, by=10), Inf) ) thesmr = getSMR(popdata, therates, casedata) head(thesmr@data)