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.
# S4 method for SpatialPolygonsDataFrame,ANY,ANY,ANY,ANY
getSMR(
popdata, model, casedata, regionCode , regionCodeCases ,
area.scale = 1, sex=c('m','f'),...
)
# S4 method for list,ANY,ANY,ANY,ANY
getSMR(
popdata, model, casedata, regionCode , regionCodeCases ,
area.scale=1, sex=c('m','f'), ...
)
# S4 method for data.frame,ANY,missing,missing,missing
getSMR(
popdata, model, casedata, regionCode , regionCodeCases ,
area.scale = 1, sex=c('m','f'),...
)# S4 method for data.frame,ANY,data.frame,missing,missing
getSMR(
popdata, model, casedata, regionCode , regionCodeCases ,
area.scale = 1, sex=c('m','f'),...
)
# S4 method for data.frame,ANY,data.frame,character,missing
getSMR(
popdata, model, casedata, regionCode , regionCodeCases ,
area.scale = 1, sex=c('m','f'),...
)
# S4 method for data.frame,ANY,missing,character,missing
getSMR(
popdata, model, casedata, regionCode , regionCodeCases ,
area.scale = 1, sex=c('m','f'),...
)
# S4 method for data.frame,ANY,data.frame,character,character
getSMR(
popdata, model, casedata, regionCode , regionCodeCases ,
area.scale = 1, sex=c('m','f'),...
)
the name of population data set
rates, either fitted model (usually a glm
object), or a vector of rates.
the name of case data set
the name of district area column in population data set
the name of district area column in case data set
scale the unit of area. e.g $10^6$: if your spatial coordinates are metres and you want intensity in cases per km2
possible subsetting of cases and population, set sex='f'
for females only.
additional arguments. When popdata
is a list
, arguments
can be
personYears
(logical, convert rates to person years),
years
(a vector with the year of each dataset), or
year.range
(two dimensional vector with first and last year)
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.
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.
# NOT RUN {
data(kentucky)
kentucky2 = getSMR(kentucky, larynxRates, larynx,
regionCode="County")
data.frame(kentucky2)[1:10,grep("^F|^M", names(kentucky2), invert=TRUE)]
# }
Run the code above in your browser using DataLab