Package 'anthrocheckr'

Title: Anthropometric Measurement Standardisation Tests
Description: Ensuring the precision and accuracy of measurements is critical when collecting anthropometric data. Anthropometrists are usually tested for precision and accuracy of measurement through standardisation tests performed prior to anthropometric data collection. This package provides functions to calculate inter- and intra-observer technical error of measurement (TEM) to assess precision of measurements.
Authors: Ernest Guevarra [aut, cre]
Maintainer: Ernest Guevarra <[email protected]>
License: GPL-3
Version: 0.1.0.9000
Built: 2024-12-18 09:24:03 UTC
Source: https://github.com/nutriverse/anthrocheckr

Help Index


Calculate the coefficient of reliability (R).

Description

Calculate the coefficient of reliability (R).

Usage

calculate_coeff_r(total_tem, sd)

Arguments

total_tem

A numeric value for total TEM

sd

A numeric vector for standard deviation of measurements

Value

A numeric vector of coefficient of reliability values per observer

Examples

# Calculate intra-observer TEM
intra <- calculate_tem_cohort(df = smartStd,
                              m1 = "muac1",
                              m2 = "muac2",
                              index = "observer",
                              n = 11)

# Get inter-observer TEM
muacDF1 <- subset(smartStd,
                  select = c(-muac2, -weight1, -weight2, -height1, -height2))
muacDF2 <- subset(smartStd,
                  select = c(-muac1, -weight1, -weight2, -height1, -height2))

# Spread the dataset to wide format
library(tidyr)
muacDF1 <- tidyr::spread(muacDF1, key = "observer", value = "muac1")
muacDF2 <- tidyr::spread(muacDF2, key = "observer", value = "muac2")
muacDF <- merge(muacDF1, muacDF2, by = "subject")
inter <- calculate_team_tem(n = 10, k = 22, m = muacDF[ , 2:23])

total_tem <- calculate_total_tem(intra = intra, inter = inter)

# Calculate sd
stdev <- calculate_sd(
  measures = subset(smartStdLong, measure_type == "muac")$measure_value,
  index = subset(smartStdLong, measure_type == "muac")$observer
)

calculate_coeff_r(total_tem = total_tem, sd = stdev)

Calculate the mean, sd and maximum difference value of measurements/observations

Description

Get the mean, sd and maximum difference value of the measurements/observations made by a single observer across multiple subjects

Usage

calculate_mean(measures, index = NULL)

calculate_sd(measures, index = NULL)

calculate_max(measures, index = NULL)

Arguments

measures

A vector of measurements/observations made by a single observer across multiple subjects

index

A character vector with length equal to 'measures' specifying the factors to be used to group the measurements/values into before applying the summary function. For a single observer, this will tend to be the type of measurement made if 'measures' is a vector of measurements/observations of different types e.g., weight and height. This is *optional* and is set to NULL by default. This would indicate that the summary metrics will be made for the values in 'measures' without any grouping.

Value

A numeric value for the summary measure of measurements/observations if 'index' is NULL. A named numeric vector for the summary measure of measurements/observations grouped by the factor specified by 'index'

Examples

## Get the mean of weight measurements by observer 0 (supervisor) from the
## smartStd dataset
x <- smartStd[smartStd$observer == 0, ]
calculate_mean(c(x$weight1, x$weight2))

## Get the mean weight, height and muac measurements by observer 0 from the
## smartStdLong dataset
x <- smartStdLong[smartStdLong$observer == 0, ]
calculate_mean(x$measure_value, x$measure_type)

## Get the sd of weight measurements by observer 0 (supervisor) from the
## smartStd dataset
x <- smartStd[smartStd$observer == 0, ]
calculate_sd(c(x$weight1, x$weight2))

## Get the sd of weight, height and muac measurements by observer 0 from the
## smartStdLong dataset
x <- smartStdLong[smartStdLong$observer == 0, ]
calculate_sd(x$measure_value, x$measure_type)

## Get the max difference of weight measurements by observer 0 (supervisor)
## from the smartStd dataset
x <- smartStd[smartStd$observer == 0, ]
calculate_max(abs(x$weight1 - x$weight2))

## Get the max difference of weight, height and muac measurements by observer
## 0 from the smartStd dataset
x <- smartStd[smartStd$observer == 0, ]
calculate_max(c(abs(x$weight1 - x$weight2),
                abs(x$height1 - x$height2),
                abs(x$muac1 - x$muac2)),
              c(rep("weight", 10), rep("height", 10), rep("muac", 10)))

Calculate relative TEM of measurements by multiple observers.

Description

Calculate relative TEM of measurements by multiple observers.

Usage

calculate_relative_tem(tem, mean_value)

Arguments

tem

A numeric vector or data frame of technical error of measurements produced from applying [calculate_tem_cohort()].

mean_value

A numeric vector or data frame of mean of measurements produced from applying [calculate_mean()].

Value

A vector or data frame of calculated relative TEM per observer and per measurement type.

Examples

## Calculate relative TEM for weight using the smartStd dataset
  tem <- calculate_tem_cohort(df = smartStd,
                              m1 = "weight1",
                              m2 = "weight2",
                              index = "observer",
                              n = 10)

  x <- smartStdLong[smartStdLong$measure_type == "weight", ]

  mean_value <- calculate_mean(
    measures = x$measure_value, index = x[ , "observer"]
  )

  rel_tem <- calculate_relative_tem(
    tem = tem$tem, mean_value = mean_value$mean
  )
  
  rel_tem

Calculate technical error of measurement (TEM) for two or more observers

Description

Function to calculate technical error of measurement (TEM) when there are more than two observers involved.

Usage

calculate_team_tem(n, k, m)

Arguments

n

A numeric value specifying number of subjects

k

A numeric value specifying number of observers

m

A data frame of of measurements with number of columns equal to 'k' and number of rows equal to 'n'

Value

A numeric value of the technical error of measurement (TEM). Unit of TEM is the same as the unit of the measurements compared.

Examples

# calculate team TEM from stature dataset
calculate_team_tem(n = 10, k = 4, m = stature[ , c("m1", "m2", "m3", "m4")])

Calculate technical error of measurement (TEM)

Description

Function to calculate **technical error of measurement (TEM)** based on formula created by *Ulijaszek and Kerr (1999)* as an indicator of measurement precision as described by *Mueller and Mortorell (1998)*. This function is specific for intra-observer TEM for two measurements, and for inter-observer TEM involving two measurers.

Usage

calculate_tem(d, n)

Arguments

d

Numeric vector of difference between two measurements made by same measurer or between two measurers.

n

Numeric value of number of individuals measured.

Value

A numeric value of the technical error of measurement (TEM). Unit of TEM is the same as the unit of the measurements compared.

Examples

## Apply calculate_tem to smartStd dataset to get TEM for weight for
## supervisor
x <- smartStd[smartStd$observer == 0, ]
difference <- x$weight1 - x$weight2
tem <- calculate_tem(d = difference, n = length(difference))
tem

Calculate intra-observer TEM for each observer

Description

Function to calculate *intra-observer TEM* for each observer using input dataset containing multiple types of multiple measurements from multiple observers.

Usage

calculate_tem_cohort(df, m1, m2, index = NULL, n)

Arguments

df

A data.frame containing data on multiple measurements made by multiple observers on multiple subjects

m1

A character value for variable in 'df' containing initial round measurements made by multiple observers

m2

A character value for variable in 'df' containing subsequent round measurements made by multiple observers

index

A character value or vector specifying the variable name/s in 'df' containing the factors to be used to group the results into. If multiple observers, at least two variable names should be provided as observer identifiers. Any other variable in 'df' that should be used as grouping factor should be included. This is *optional* and is set to NULL by default. This would indicate that the summary metrics will be made for the values in 'measures' without any grouping

n

Number of subjects measured

Value

A data frame of calculated TEM per observer and per measurement type.

Examples

# Get the TEM per observer for MUAC measurements in the smartStd dataset
calculate_tem_cohort(df = smartStd,
                     m1 = "muac1", m2 = "muac2",
                     index = "observer", n = 10)

Calculate the Total TEM given individual intra-observer TEM.

Description

Calculate the Total TEM given individual intra-observer TEM.

Usage

calculate_total_tem(intra, inter)

Arguments

intra

A numeric vector or data frame of individual intra-observer TEM.

inter

A numeric value of inter-observer TEM.

Value

A numeric value of total TEM

Examples

# Calculate intra-observer TEM
intra <- calculate_tem_cohort(df = smartStd,
                              m1 = "muac1",
                              m2 = "muac2",
                              index = "observer",
                              n = 11)

# Get inter-observer TEM
muacDF1 <- subset(smartStd,
                  select = c(-muac2, -weight1, -weight2, -height1, -height2))
muacDF2 <- subset(smartStd,
                  select = c(-muac1, -weight1, -weight2, -height1, -height2))

# Spread the dataset to wide format
library(tidyr)
muacDF1 <- tidyr::spread(muacDF1, key = "observer", value = "muac1")
muacDF2 <- tidyr::spread(muacDF2, key = "observer", value = "muac2")
muacDF <- merge(muacDF1, muacDF2, by = "subject")
inter <- calculate_team_tem(n = 10, k = 22, m = muacDF[ , 2:23])

total_tem <- calculate_total_tem(intra = intra, inter = inter)

Calculate bias of a measurement

Description

Calculate the bias of a measurement against a gold standard. Two gold standards are used in this function: 1) measurements made by a supervisor or a known expert; and, 2) median of all measurements made by the observers.

Usage

estimate_bias(msur, msup, mall)

Arguments

msur

A numeric value or vector of mean measurements from observers

msup

A numeric value or vector of mean measurements from supervisor

mall

A numeric value or vector of the median of measurements from observers

Value

A numeric value or vector signifying bias

Examples

x <- subset(smartStdLong, measure_type == "height")

y <- calculate_mean(measures = x$measure_value, index = x$observer)

z <- calculate_mean(x$measure_value)

estimate_bias(
  msur = y$mean[y$index != 0],
  msup = y$mean[y$index == 0],
  mall = z
)

Dataset from a standardisation exercise done in Liberia in preparation for a coverage survey.

Description

Dataset from a standardisation exercise done in Liberia in preparation for a coverage survey.

Usage

liberiaStdData

Format

A data frame with 7 columns and 744 rows:

| **Variable** | **Description** | | :— | :— | | *eid* | Enumerator ID | | *cid* | Child ID | | *round* | Standardisation test round | | *weight* | Weight measurement | | *height* | Height measurement | | *muac* | Mid-upper arm circumference measurement | | *oedema* | Bilateral pitting oedema |

Examples

liberiaStdData

Run the anthrocheckr Shiny app

Description

Run the anthrocheckr Shiny app

Usage

run_anthrocheckr()

Examples

if (interactive()) run_anthrocheckr()

Standardisation test data - sample 1

Description

Example dataset from the Standardized Monitoring and Assessment of Relief and Transitions (SMART) capacity building toolbox found at <http://smartmethodology.org/survey-planning-tools/smart-capacity-building-toolbox/>. The dataset has been restructured into a less wide format compared to the original wide format.

Usage

smartStd

Format

A data frame with 8 columns and 110 rows:

| **Variable** | **Description** | | :— | :— | | *subject* | Unique identifier of subjects who were measured | | *observer* | Unique identifier for those who performed the measurements | | *weight1* | First weight measurement. Units in kilograms | | *weight2* | Second weight measurement. Units in kilograms | | *height1* | First height measurement. Units in centimetres | | *height2* | Second height measurement. Units in centimetres | | *muac1* | First mid-upper arm circumference measurement. Units in millimetres | | *muac* | Second mid-upper arm circumference measurement. Units in millimetres |

Source

Standardized Monitoring and Assessment of Relief and Transitions (SMART) capacity building toolbox found at <http://smartmethodology.org/survey-planning-tools/smart-capacity-building-toolbox/>.

Examples

smartStd

Standardisation test data - sample 2

Description

Example dataset from the Standardized Monitoring and Assessment of Relief and Transitions (SMART) capacity building toolbox found at <http://smartmethodology.org/survey-planning-tools/smart-capacity-building-toolbox/>. This dataset is the same as the smartStd dataset but has been restructured into a long format (as per tidyverse specifications) compared to original format.

Usage

smartStdLong

Format

A data frame with 5 columns and 660 rows:

subject

Subject unique identifier

observer

Observer unique identifier

measure_type

Type of measurement. Can be height, weight, or muac

measure_round

Measurement round. Can be 1 or 2 for first and second round of measurement respectively

measure_value

Measurement

Source

Standardized Monitoring and Assessment of Relief and Transitions (SMART) capacity building toolbox found at <http://smartmethodology.org/survey-planning-tools/smart-capacity-building-toolbox/>.

Examples

smartStdLong

Standardisation test data - sample 3

Description

Example dataset from the Standardized Monitoring and Assessment of Relief and Transitions (SMART) capacity building toolbox found at <http://smartmethodology.org/survey-planning-tools/smart-capacity-building-toolbox/>. This dataset is the same as the smartStd dataset but has been kept in the original wide format.

Usage

smartWide

Format

A data frame with 67 columns and 10 rows

Source

Standardized Monitoring and Assessment of Relief and Transitions (SMART) capacity building toolbox found at <http://smartmethodology.org/survey-planning-tools/smart-capacity-building-toolbox/>.

Examples

smartWide

Example dataset from *Ulijaszek and Kerr (1999)* containing repeat measurements of stature 'm' carried out by four observers on ten subjects.

Description

Example dataset from *Ulijaszek and Kerr (1999)* containing repeat measurements of stature 'm' carried out by four observers on ten subjects.

Usage

stature

Format

A data frame with 8 columns and 10 rows:

| **Variable** | **Description** | | :— | :— | | *subject* | Subject unique identification number | | *m1* | Stature measurements of first observer | | *m2* | Stature measurements of second observer | | *m3* | Stature measurements of third observer | | *m4* | Stature measurements of fourth observer | | *f1* | Results of the first function in the group TEM equation | | *f2* | Results of the second function in the group TEM equation | | *diff* | Difference between 'f2' and 'f2' ('f2' - 'f1') |

Source

Ulijaszek SJ, Kerr DA. Anthropometric measurement error and the assessment of nutritional status. Br J Nutr. 2007;82: 165–13. doi:10.1017/S0007114599001348

Examples

stature