Package {epistandardiseR}


Type: Package
Title: Tools for Direct Standardisation with Confidence Intervals
Version: 0.0.2
Description: Provides tools to compute directly standardised rates using the 2013 European Standard Population for age and deprivation-standardised rates using a 10% per decile assumption. Sex standardisation uses an assumed equal proportion of both males and females. The package Includes variance estimation and 95% confidence intervals for population health applications. Functions support flexible grouping variables and age bands, enabling reproducible and automated analyses.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Imports: dplyr, rlang, magrittr, stats, tidyr
Depends: R (≥ 3.5)
URL: https://github.com/JoeBlackford/epistandardiseR
BugReports: https://github.com/JoeBlackford/epistandardiseR/issues
Config/roxygen2/version: 8.0.0
NeedsCompilation: no
Packaged: 2026-08-28 08:39:04 UTC; Joe.Blackford
Author: Joe Blackford [aut, cre]
Maintainer: Joe Blackford <joseph.blackford@outlook.com>
Repository: CRAN
Date/Publication: 2026-09-09 14:40:16 UTC

Direct Age and Deprivation Standardisation with Confidence Intervals

Description

Computes directly age and deprivation standardised rates with 95% confidence intervals using the 2013 European Standard Population with an equal 10% distribution across deprivation deciles. Confidence intervals are calculated using Byar's method. Lower confidence interval limits below zero are reported as zero.

Usage

direct_age_dep_standardise(
  data,
  var,
  ageband,
  deprivation,
  observed,
  population,
  multiplier = 1000
)

Arguments

data

Dataframe containing observed counts and population.

var

One or more grouping variables (quoted or unquoted).

ageband

Column specifying age bands.

deprivation

Column specifying deprivation deciles.

observed

Column containing observed counts.

population

Column containing denominator population.

multiplier

Scale for rates (default = 1,000).

Value

A tibble containing the grouping variables, total observed events, total population, crude rate, age- and deprivation- standardised rate, and 95% confidence intervals.

Examples

example_data <- data.frame(
  variable = c("A", "A", "A", "A"),
  ageband = c("0-4", "0-4", "5-9", "5-9"),
  deprivation = c(1, 2, 1, 2),
  observed = c(10, 12, 20, 22),
  population = c(1000, 1100, 1200, 1300)
)

direct_age_dep_standardise(
  data = example_data,
  var = "variable",
  ageband = "ageband",
  deprivation = "deprivation",
  observed = "observed",
  population = "population"
)


Direct Age and Sex Standardisation with Confidence Intervals

Description

Computes directly age- and sex-standardised rates with 95% confidence intervals using the 2013 European Standard Population with a 50:50 male/female distribution within each age band. Confidence intervals are calculated using Byar's method. Lower confidence interval limits below zero are reported as zero.

Usage

direct_age_sex_standardise(
  data,
  var,
  ageband,
  sex,
  observed,
  population,
  multiplier = 1000
)

Arguments

data

Dataframe containing observed counts and population.

var

One or more grouping variables (quoted or unquoted).

ageband

Column specifying age bands.

sex

Column specifying sex categories.

observed

Column containing observed counts.

population

Column containing denominator population.

multiplier

Scale for rates (default = 1,000).

Value

A tibble containing the grouping variables, total observed events, total population, crude rate, age- and sex-standardised rate, and 95% confidence intervals.

Examples

example_data <- data.frame(
  variable = c("A", "A", "A", "A"),
  ageband = c("0-4", "0-4", "5-9", "5-9"),
  sex = c("F", "M", "F", "M"),
  observed = c(10, 12, 20, 22),
  population = c(1000, 1100, 1200, 1300)
)

direct_age_sex_standardise(
  data = example_data,
  var = "variable",
  ageband = "ageband",
  sex = "sex",
  observed = "observed",
  population = "population"
)


Direct Age Standardisation with Confidence Intervals

Description

Computes directly age-standardised rates with 95% confidence intervals using the 2013 European Standard Population and Byar’s method.

Computes directly age-standardised rates with 95% confidence intervals using the 2013 European Standard Population and Byar's method.

Usage

direct_age_standardise(
  data,
  var,
  ageband,
  observed,
  population,
  multiplier = 1000
)

direct_age_standardise(
  data,
  var,
  ageband,
  observed,
  population,
  multiplier = 1000
)

Arguments

data

Dataframe with observed values and population.

var

One or more grouping variables (quoted or unquoted).

ageband

Column specifying age bands.

observed

Column with observed counts.

population

Column with denominator population.

multiplier

Scale for rates (default = 1,000).

Value

A tibble with directly standardised rates and 95% confidence intervals

A tibble with directly standardised rates and 95% confidence intervals.

Examples

example_data <- data.frame(
  variable = c("A", "A", "B", "B"),
  ageband = c("0-4", "5-9", "0-4", "5-9"),
  observed = c(10, 20, 15, 25),
  population = c(1000, 1200, 1100, 1300)
)

direct_age_standardise(
  data = example_data,
  var = "variable",
  ageband = "ageband",
  observed = "observed",
  population = "population"
)

example_data <- data.frame(
  variable = c("A", "A", "B", "B"),
  ageband = c("0-4", "5-9", "0-4", "5-9"),
  observed = c(10, 20, 15, 25),
  population = c(1000, 1200, 1100, 1300)
)

direct_age_standardise(
  data = example_data,
  var = "variable",
  ageband = "ageband",
  observed = "observed",
  population = "population"
)


Direct Deprivation Standardisation with Confidence Intervals

Description

Computes directly deprivation-standardised rates with 95% confidence intervals using a standard national deprivation profile with equal population in each deprivation decile and Byar’s method.

Usage

direct_dep_standardise(
  data,
  var,
  dep_decile,
  observed,
  population,
  multiplier = 1000
)

Arguments

data

Data frame containing observed counts and population denominators

var

One or more grouping variables (quoted or unquoted)

dep_decile

Column specifying deprivation deciles (1–10)

observed

Column with observed counts

population

Column with denominator population

multiplier

Scale for rates (default = 1,000)

Value

A tibble with deprivation-standardised rates and 95% confidence intervals

Examples

example_data <- data.frame(
  group = c("A", "A", "B", "B"),
  dep_decile = factor(c(1, 2, 1, 2)),
  observed = c(10, 20, 15, 25),
  population = c(1000, 1200, 1100, 1300)
)

direct_dep_standardise(
  data = example_data,
  var = "group",
  dep_decile = "dep_decile",
  observed = "observed",
  population = "population"
)


European Standard Population 2013 (abridged)

Description

A dataset containing abridged ESP 2013 standard population counts for use in age standardisation.

Usage

ref_population

Format

A data frame with 19 rows and 2 variables:

AgeBand

Age group (character, e.g. "0-4", "5-9")

StdPopulation

Standard population count for that age band

Source

Eurostat ESP 2013


Standard Age and Deprivation Reference Population

Description

A reference population derived from the 2013 European Standard Population, assigning equal weight to each deprivation decile within each age band. This reference population can be used for direct age and deprivation standardisation.

Usage

std_age_dep

Format

A data frame with age- and deprivation-specific standard population weights:

AgeBand

Age band from the European Standard Population

DepDecile

Deprivation decile

StdPopulation

Standard population weight

Source

Derived from the 2013 European Standard Population using an equal 10% distribution across deprivation deciles.


Standard Age and Sex Reference Population

Description

A reference population derived from the European Standard Population, assigning equal weight to females and males within each age band. This 50:50 distribution can be used for direct age and sex standardisation.

Usage

std_age_sex

Format

A data frame with age and sex-specific standard population weights:

AgeBand

Age band from the European Standard Population

Sex

Sex category

StdPopulation

Standard population weight

Source

Derived from the European Standard Population using a 50:50 female/male distribution.


Standard Deprivation Decile Population

Description

Reference population weights for deprivation decile standardisation. Assumes an equal 10 percent population distribution across deprivation deciles.

Usage

std_dep_decile

Format

A data frame with 10 rows and 2 variables:

dep_decile

Deprivation decile

std_population

Standard population weight

Source

Internal package dataset


Standard Sex Reference Population

Description

A reference population assigning equal weight to females and males. This 50:50 distribution can be used for direct sex standardisation.

Usage

std_sex

Format

A data frame with 2 rows and 2 variables:

Sex

Sex category

StdPopulation

Standard population weight

Source

Reference distribution defined for the epistandardiser package.