Description Usage Arguments Value Examples
rii
calculates the relative index of inequality (RII) or the slope index of inequality (SII) and
confidence intervals for either measure. The SII is obtained via OLS regression of the health variable
on the midpoints of the cumulative population distribution.
The RII is calculated as SII divided by health outcome across all socioeconomic positions. Simulation
is used to calculate confidence intervals (see method
below).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
data |
Name of data set. |
health |
Health outcome of interest. |
population |
Population counts. Should correspond to data provided in |
ses |
Categorical deprivation measure used for splitting the data. Should be ordered, such as numeric or a factor. |
age |
Variable that defines 5-year age groups, should be ordered and numeric, such as 1 through 18. If the age group coding starts with 0 it will be assumed that age groups 0 and 1-4 are separate. If the age group starts with 1, it will be assumed that the first age group is 0-4 (ages 0 and 1-4 are combined). |
groups |
Conditions such as sex or ethnicity that together define the sub-population for which the
RII/SII is calculated for. Default is |
age_group |
The age groups the standardized rates should be calculated for. By default the function calculates
results for the following age groups: 0-14, 15-29, 30-44, 45-59, 60-74, 75+, 0-64 and all ages.
User supplied age groups should be provided using the standard population groups as cut-offs, e.g. use
|
st_pop |
The standard population weights used for calculating rates, default 2013 ESP for 18 age groups with 0-4 as
the first age group. See |
N |
Number of simulations for the confidence intervals, default 1000. |
RII |
Logical, should RII or SII be calculated, default |
CI |
Confidence intervals, 95 by default but can be set to any number between 0 and 100. |
method |
The method used for simulating confidence intervals. Default |
W |
Logical, should weighted regression be used for RII/SII, default |
total |
The total number of people in the standard population, i.e. are rates be calculated per 1000 or 100 000, default 1000. Relevant for SII only. |
A data frame giving RII/SII by age groups together with confidence intervals
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | d <- health_data
# RII with 95% CI
rii(d, bad, pop, quintile, age, ethnicity == "all")
# SII with 99% CI, using weighted least squares
rii(d, bad, pop, quintile, age, ethnicity == "all", RII = FALSE, CI = 99, W = TRUE)
# Supply own population weights
new_w <- c(0.075, 0.075, 0.075, 0.06, 0.060, 0.060, 0.06, 0.070, 0.050,
0.050, 0.050, 0.06, 0.060, 0.055, 0.050, 0.040, 0.025, 0.025)
# RII with user supplied weights
rii(d, bad, pop, quintile, age, ethnicity == "all", RII = FALSE, CI = 99, st_pop = new_w)
# SII for new age groups with 95% CI
rii(d, bad, pop, quintile, age, ethnicity == "Scot" & ur2fold == "Urban",
age_group=c("0-19", "20-34", "35-49"), RII = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.