phe_sii: Calculate Slope Index of Inequality using phe_sii

Description Usage Arguments Details Value Calculation Function arguments Warning Notes Author(s) References See Also Examples

View source: R/SII_function.R

Description

phe_sii returns the slope index of inequality (SII) statistic for each subgroup of the inputted dataframe, with lower and upper confidence limits based on the specified confidence. The Relative Index of Inequality (RII) can also be returned via an optional argument.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
phe_sii(
  data,
  quantile,
  population,
  x = NULL,
  value = NULL,
  value_type = 0,
  lower_cl = NULL,
  upper_cl = NULL,
  se = NULL,
  multiplier = 1,
  repetitions = 1e+05,
  confidence = 0.95,
  rii = FALSE,
  reliability_stat = FALSE,
  type = "full"
)

Arguments

data

data.frame containing the required input fields, pre-grouped if an SII is required for each subgroup; unquoted string; no default

quantile

field name within data that contains the quantile label (e.g. decile). The number of quantiles should be between 5 and 100; unquoted string; no default

population

field name within data that contains the quantile populations (ie, denominator). Non-zero populations are required for all quantiles to calculate SII for an area; unquoted string; no default

x

(for indicators that are proportions) field name within data that contains the members of the population with the attribute of interest (ie, numerator). This will be divided by population to calculate a proportion as the indicator value (if value field is not provided); unquoted string; no default

value

field name within data that contains the indicator value (this does not need to be supplied for proportions if count and population are given); unquoted string; no default

value_type

indicates the indicator type (1 = rate, 2 = proportion, 0 = other); integer; default 0

lower_cl

field name within data that contains 95% lower confidence limit of indicator value (to calculate standard error of indicator value). This field is needed if the se field is not supplied; unquoted string; no default

upper_cl

field name within data that contains 95% upper confidence limit of indicator value (to calculate standard error of indicator value). This field is needed if the se field is not supplied; unquoted string; no default

se

field name within data that contains the standard error of the indicator value. If not supplied, this will be calculated from the 95% lower and upper confidence limits (i.e. one or the other of these fields must be supplied); unquoted string; no default

multiplier

factor to multiply the SII and SII confidence limits by (e.g. set to 100 to return prevalences on a percentage scale between 0 and 100). If the multiplier is negative, the inverse of the RII is taken to account for the change in polarity; numeric; default 1;

repetitions

number of random samples to perform to return confidence interval of SII (and RII). Minimum is 1000, no maximum (though the more repetitions, the longer the run time); numeric; default 100,000

confidence

confidence level used to calculate the lower and upper confidence limits of SII, expressed as a number between 0.9 and 1, or 90 and 100. It can be a vector of 0.95 and 0.998, for example, to output both 95% and 99.8% CIs; numeric; default 0.95

rii

option to return the Relative Index of Inequality (RII) with associated confidence limits as well as the SII; logical; default FALSE

reliability_stat

option to carry out the SII confidence interval simulation 10 times instead of once and return the Mean Average Difference between the first and subsequent samples (as a measure of the amount of variation). Warning: this will significantly increase run time of the function and should first be tested on a small number of repetitions; logical; default FALSE

type

"full" output includes columns in the output dataset specifying the parameters the user has input to the function (value_type, multiplier, CI_confidence, CI_method); character string either "full" or "standard"; default "full"

Details

The SII and RII are two measures of health inequality. They show the relation between the level of health or frequency of a health problem in different population groups and the ranking of these groups on the social scale.

The input dataframe should be grouped before passing to the function if an SII/RII for each subgroup is required, and quantiles ordered from least to most advantaged.

Value

The SII with lower and upper confidence limits for each subgroup of the inputted data.frame.

Calculation

The SII is calculated using linear regression [1]. To allow for differences in population size between quantiles (e.g. deprivation deciles), each is given a rank score (or relative rank) based on the midpoint of its range in the cumulative distribution of the total area population. The quantiles are first ordered (e.g from 1 most deprived to 10 least deprived for deprivation deciles). If quantile 1 then contains 12% of the total population, its relative rank is 0.12/2=0.6. If quantile 2 includes 10% of the population, its relative rank is 0.12+(0.10/2)=0.17. A square root transformation is applied to the regression to account for heteroskedasticity (the tendancy for the variances of the quantile values to be related to the size of the values, ie larger values will tend to have larger variances). A regression model is fitted to the transformed data: Y * √ a = √ a + b * √ a, where Y is the value of the indicator for the quantile, a is the proportion of the total population in the quantile and b is the relative rank.

The SII is the gradient of the resulting fitted line, and could be positive or negative according to the indicator polarity. Since the relative ranks, by definition, range from 0 to 1, the SII is the difference between the fitted value at x=1 and x=0.

The RII is the ratio of the fitted value at x=1,Y1 and the fitted value at x=0,Y0. which can be calculated as: RII = (Y0 + SII)/Y0

Function arguments

The indicator type can be specified via the value_type parameter. Transformations can be applied to the indicator value and its confidence limits before calculating the standard error in cases where the confidence interval around the indicator value is likely to be non-symmetric. This is a log transformation for rates, and logit for proportions.

If the standard error is supplied directly to the function from the input dataset, this is used instead of calculating one from the indicator confidence limits.

Warning

The SII calculation assumes a linear relationship between indicator value and quantile, and small populations within quantiles can make it unstable.

This function does not include checks for linearity or stability; it is the user's responsibility to ensure the input data is suitable for the SII calculation.

Notes

this function is using nest and unnest functions from tidyr version 1.0.0.

Author(s)

Emma Clegg, emma.clegg@phe.gov.uk

References

[1] Low A & Low A. Measuring the gap: quantifying and comparing local health inequalities. Journal of Public Health; 2004;26:388-395.

See Also

Other PHEindicatormethods package functions: phe_dsr(), phe_isr(), phe_life_expectancy(), phe_mean(), phe_proportion(), phe_quantile(), phe_rate(), phe_smr()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
library(dplyr)

data <- data.frame(area = c(rep("Area1", 10), rep("Area2", 10)),
                   decile = c(1:10, 1:10),
                   population = c(7291, 7997, 6105, 7666, 5790, 6934, 5918, 5974, 7147, 7534, 21675,
                                  20065, 19750, 24713, 20112, 19618, 22408, 19752, 18939, 19312),
                   value = c(75.9, 78.3, 83.8, 83.6, 80.5, 81.1, 81.7, 84.2, 80.6, 86.3, 70.5,
                              71.6, 72.5, 73.5, 73.1, 76.2, 78.7, 80.6, 80.9, 80),
                   lowerCL = c(72.7,75.3,80.9,80.2,77.1,78,79,81.4,75.8,83.2,
                               70.1,71.1,72,73.1, 72.7, 75.7, 78.2,80.1,80.4,79.5),
                   upperCL = c(79.1,81.4,86.8,87.1,83.8,84.2,84.4,86.9,85.4,
                                89.4,71,72.1,73.2,73.7,75.8,78.8,79.8,81.2,81.3,80.9),
                   StandardError = c(1.64,1.58,1.51,1.78,1.7,1.56,1.37,1.4,2.43,
                                     1.57,0.23,0.26,0.3,0.16,0.79,0.78,0.4,0.28,0.23,0.35)
                   )


# Run SII function on the two areas in the data
phe_sii(group_by(data, area),
        decile,
        population,
        value_type = 0, # default normal distribution
        value = value,
        lower_cl = lowerCL,
        upper_cl = upperCL,
        confidence = 0.95,
        rii = TRUE,
        type = "standard")

# Supplying the standard error instead of the indicator 95% confidence limits
# gives the same result
phe_sii(group_by(data, area),
        decile,
        population,
        value_type = 0,
        value = value,
        se = StandardError,
        confidence = 0.95,
        rii = TRUE,
        type = "standard")

# multiple confidence intervals
phe_sii(group_by(data, area),
        decile,
        population,
        value_type = 0,
        value = value,
        se = StandardError,
        confidence = c(0.95, 0.998),
        repetitions = 10000,
        rii = TRUE,
        type = "standard")

PHEindicatormethods documentation built on July 1, 2020, 6:01 p.m.