Type: Package
Title: Implementation of Spirometry Equations
Version: 0.5
Date: 2024-06-23
Author: Theodore Lytras
Maintainer: Theodore Lytras <thlytras@gmail.com>
Description: Implementation of various spirometry equations in R, currently the GLI-2012 (Global Lung Initiative; Quanjer et al. 2012 <doi:10.1183/09031936.00080312>), the race-neutral GLI global 2022 (Global Lung Initiative; Bowerman et al. 2023 <doi:10.1164/rccm.202205-0963OC>), the NHANES3 (National Health and Nutrition Examination Survey; Hankinson et al. 1999 <doi:10.1164/ajrccm.159.1.9712108>) and the JRS 2014 (Japanese Respiratory Society; Kubota et al. 2014 <doi:10.1016/j.resinv.2014.03.003>) equations. Also the GLI-2017 diffusing capacity equations <doi:10.1183/13993003.00010-2017> are implemented. Contains user-friendly functions to calculate predicted and LLN (Lower Limit of Normal) values for different spirometric parameters such as FEV1 (Forced Expiratory Volume in 1 second), FVC (Forced Vital Capacity), etc, and to convert absolute spirometry measurements to percent (%) predicted and z-scores.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
Encoding: UTF-8
RoxygenNote: 7.3.1
Depends: R (≥ 2.10)
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2024-06-23 21:34:33 UTC; bones
Repository: CRAN
Date/Publication: 2024-06-23 22:30:03 UTC

rspiro: Brief overview of the package

Description

R package rspiro implements multiple spirometry equations: currently the GLI-2012 (Quanjer), GLI global 2022, JRS-2014, NHANES III (Hankinson), as well as the GLI-2017 diffusing capacity equations (Stanojevic et al). More may be added later. It offers a convenient interface to calculate predicted or LLN (Lower Limit of Normal) values given demographic data, or to convert absolute values to percent ( predicted or z-scores.

Details

To ensure a consistent interface, package functions are named with a prefix indicating the functionality and a suffix indicating the spirometric equations used, for example LLN_GLI calculates Lower Limits of Normal using the GLI-2012 equations. The suffix is currently one of 'GLI', 'GLIgl', 'JRS', 'NHANES3' or 'GLIdiff'. The prefix is one of 'LLN_', 'pred_', 'pctpred_' or 'zscore_'.

Functions prefixed 'LLN_' or 'pred_' accept as input demographic information (age, gender, height, ethnicity) and calculate the Lower Limit of Normal and the predicted value, respectively, for a given spirometry parameter (FEV1, FVC, etc). Functions prefixed 'pctpred_' or 'zscore_' accept absolute spirometry values (plus demographics) and convert those to percent ( z-scores, respectively. Please note the difference between 'pred_' and 'pctpred_' above.

For detailed information, refer to the respective function documentations.

The development version of rspiro is available on GitHub https://github.com/thlytras/rspiro. To report problems and bugs, or to request a feature, please go there and open an issue. Alternatively, send an email to Theodore Lytras thlytras@gmail.com.

Author(s)

Theodore Lytras thlytras@gmail.com.


Calculate LLN of spirometry parameters using GLI-2012 equations

Description

This function calculates LLNs (Lower Limits of Normal) for the various spirometry parameters, using the GLI-2012 equations. It accepts as input age, height, gender and ethnicity.

Usage

LLN_GLI(age, height, gender = 1, ethnicity = 1, param = "FEV1")

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

ethnicity

Ethnicity (1 = Caucasian, 2 = African-American, 3 = NE Asian, 4 = SE Asian, 5 = Other/mixed). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "FEV1", "FVC", "FEV1FVC", "FEF2575", "FEF75", "FEV075", "FEV075FVC"

Details

Arguments age, height, gender and ethnicity are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

If param has length one, the function returns a numeric vector. If param has length >1, it returns a data.frame with length(param) columns.

Examples

# Find LLN of FEV1 and FVC for Caucasian women aged 20 to 70 and with a height of 1.70 meters.
LLN_GLI(20:70, 1.7, 2, param=c("FEV1","FVC"))


Calculate LLN of diffusing capacity parameters using GLI (2017) equations

Description

This function calculates LLNs (Lower Limits of Normal) for TLCO (transfer factor of the lung for carbon monoxide), KCO (transfer coefficient of the lung for carbon monoxide) and VA (alveolar volume) using the GLI (2017) equations. It accepts as input age, height, gender.

Usage

LLN_GLIdiff(age, height, gender = 1, param = "TLCO", SI = TRUE)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "TLCO", "KCO" or "VA"

SI

(default TRUE) Use SI (mmol/min/kPa) or traditional (ml/min/mmHg) units?

Details

Arguments age, height and gender are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

If param has length one, the function returns a numeric vector. If param has length >1, it returns a data.frame with length(param) columns.

Examples

# Find LLN of TLCO and VA for women aged 20 to 70 and with a height of 1.70 meters.
LLN_GLIdiff(20:70, 1.7, 2, param=c("TLCO","VA"))


Calculate LLN of spirometry parameters using GLI global (2022) equations

Description

This function calculates LLNs (Lower Limits of Normal) for the various spirometry parameters, using the GLI global (2022) equations. It accepts as input age, height, gender.

Usage

LLN_GLIgl(age, height, gender = 1, param = "FEV1")

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "FEV1", "FVC", "FEV1FVC"

Details

Arguments age, height and gender are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

If param has length one, the function returns a numeric vector. If param has length >1, it returns a data.frame with length(param) columns.

Examples

# Find LLN of FEV1 and FVC for women aged 20 to 70 and with a height of 1.70 meters.
LLN_GLIgl(20:70, 1.7, 2, param=c("FEV1","FVC"))


Calculate LLN of spirometry parameters using JRS (2014) equations

Description

This function calculates LLNs (Lower Limits of Normal) for the various spirometry parameters, using the JRS (Japanese Respiratory Society 2014) equations. It accepts as input age, height, gender.

Usage

LLN_JRS(age, height, gender = 1, param = "FEV1")

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "FEV1", "FVC", "VC", "FEV1FVC"

Details

Arguments age, height and gender are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

If param has length one, the function returns a numeric vector. If param has length >1, it returns a data.frame with length(param) columns.

Examples

# Find LLN of FEV1 and FVC for Japanese women aged 20 to 70 and with a height of 1.70 meters.
LLN_JRS(20:70, 1.7, 2, param=c("FEV1","FVC"))


Calculate predicted values of spirometry parameters using NHANES III equations

Description

This function calculates LLNs (Lower Limits of Normal) for the various spirometry parameters, using the NHANES III equations. It accepts as input age, height, gender and ethnicity.

Usage

LLN_NHANES3(age, height, gender = 1, ethnicity = 1, param = "FEV1")

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

ethnicity

Ethnicity (1 = Caucasian, 2 = African-American, 3 = Mexican-American). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "FEV1", "FVC", "FEV1FVC", "PEF", "FEF2575", "FEV6", "FEV1FEV6"

Details

Arguments age, height, gender and ethnicity are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

If param has length one, the function returns a numeric vector. If param has length >1, it returns a data.frame with length(param) columns.

Examples

# Find LLN of FEV1 and FVC for Caucasian women aged 20 to 70 and with a height of 1.70 meters.
LLN_NHANES3(20:70, 1.7, 2, param=c("FEV1","FVC"))


Calculate L,M,S of GLI-2012

Description

This function calculates the L,M,S splines using GLI-2012 equations. The output of this function is used in calculating the LLN and predicted spirometry parameters. Checking of the input is also performed here.

Usage

getLMS(age, height, gender = 1, ethnicity = 1, param = "FEV1")

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

ethnicity

Ethnicity (1 = Caucasian, 2 = African-American, 3 = NE Asian, 4 = SE Asian, 5 = Other/mixed). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "FEV1", "FVC", "FEV1FVC", "FEF2575", "FEF75", "FEV075", "FEV075FVC"

Details

This is for internal use only.

Arguments age, height, gender and ethnicity are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

A data.frame with L, M and S, for every patient and every parameter requested


Calculate L,M,S of GLI diffusing capacity (2017) equations

Description

This function calculates the L,M,S using the GLI diffusing capacity (2017, corrected 2020) equations (Stanojevic et al, Eur Respir J 2017). The output of this function is used in calculating LLN and predicted values for TLCO (transfer factor of the lung for carbon monoxide), KCO (transfer coefficient of the lung for carbon monoxide) and VA (alveolar volume). Checking of the input is also performed here.

Usage

getLMS_GLIdiff(age, height, gender = 1, param = "TLCO", SI = TRUE)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "TLCO", "KCO" or "VA"

SI

(default TRUE) Use SI (mmol/min/kPa) or traditional (ml/min/mmHg) units?

Details

This is for internal use only.

Arguments age, height and gender are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

A data.frame with L, M and S, for every patient and every parameter requested


Calculate L,M,S of race-neutral GLI global (2022) equations

Description

This function calculates the L,M,S using the race-neutral GLI global (2022) equations (Bowerman et al, AJRCCM 2023). The output of this function is used in calculating the LLN and predicted spirometry parameters. Checking of the input is also performed here.

Usage

getLMS_GLIgl(age, height, gender = 1, param = "FEV1")

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "FEV1", "FVC", "FEV1FVC"

Details

This is for internal use only.

Arguments age, height and gender are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

A data.frame with L, M and S, for every patient and every parameter requested


Calculate L,M,S of JRS (Japanese Respiratory Society 2014) equations

Description

This function calculates the L,M,S using the JRS (2014) equations (Kubota et al, Respir Investig 2014). The output of this function is used in calculating the LLN and predicted spirometry parameters. Checking of the input is also performed here.

Usage

getLMS_JRS(age, height, gender = 1, param = "FEV1")

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "FEV1", "FVC", "FEV1FVC"

Details

This is for internal use only.

Arguments age, height and gender are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

A data.frame with L, M and S, for every patient and every parameter requested


Convert spirometric values to % predicted using GLI-2012 equations

Description

This function takes absolute spirometry measurements (FEV1, FVC, etc) in lt plus demographic data (age, height, gender and ethnicity) and converts them to percent (%) predicted based on the GLI-2012 equations.

Usage

pctpred_GLI(
  age,
  height,
  gender = 1,
  ethnicity = 1,
  FEV1 = NULL,
  FVC = NULL,
  FEV1FVC = NULL,
  FEF2575 = NULL,
  FEF75 = NULL,
  FEV075 = NULL,
  FEV075FVC = NULL
)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

ethnicity

Ethnicity (1 = Caucasian, 2 = African-American, 3 = NE Asian, 4 = SE Asian, 5 = Other/mixed). Default is 1.

FEV1

Forced Expiratory Volume in 1 second (lt)

FVC

Forced Vital Capacity (lt)

FEV1FVC

FEV1 / FVC ratio

FEF2575

Forced Expiratory Flow between 25% and 75% of FVC (lt/s)

FEF75

Forced Expiratory Flow at 75% of FVC (lt/s)

FEV075

Forced Expiratory Volume in 0.75 sec (lt)

FEV075FVC

FEV0.75 / FVC ratio

Details

At least one of the spirometric measurement arguments must be set (i.e. be non-NULL). Arguments age, height, gender and ethnicity must be vectors of length equal to the length of the spirometric measurement vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Value

If only one spirometry argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one parameter supplied (FEV1)
pctpred_GLI(age=seq(25,40,5), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), FEV1=c(3.5, 4, 3.6, 3.9))


Convert diffusing capacity values to % predicted using GLI (2017) equations

Description

This function takes absolute diffusing capacity measurements (TLCO, KCO and VA) plus demographic data (age, height, gender) and converts them to percent (%) predicted based on the GLI (2017) equations.

Usage

pctpred_GLIdiff(
  age,
  height,
  gender = 1,
  TLCO = NULL,
  KCO = NULL,
  VA = NULL,
  SI = TRUE
)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

TLCO

Transfer factor of the lung for carbon monoxide (in mmol/min/kPa if SI=TRUE or ml/min/mmHg if SI=FALSE)

KCO

Transfer coefficient of the lung for carbon monoxide (in mmol/min/kPa/lt if SI=TRUE or ml/min/mmHg/lt if SI=FALSE)

VA

Alveolar volume (in lt)

SI

(default TRUE) Use SI (mmol/min/kPa) or traditional (ml/min/mmHg) units?

Details

At least one of the diffusing capacity measurement arguments must be set (i.e. be non-NULL). Arguments age, height and gender must be vectors of length equal to the length of the diffusing capacity measurement vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Value

If only one diffusing capacity argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one parameter supplied (TLCO)
pctpred_GLIdiff(age=seq(25,40,5), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), TLCO=c(7.8, 8.8, 7.5, 8.5))


Convert spirometric values to % predicted using GLI global (2022) equations

Description

This function takes absolute spirometry measurements (FEV1, FVC or FEV1FVC) in lt plus demographic data (age, height, gender) and converts them to percent (%) predicted based on the GLI global (2022) equations.

Usage

pctpred_GLIgl(age, height, gender = 1, FEV1 = NULL, FVC = NULL, FEV1FVC = NULL)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

FEV1

Forced Expiratory Volume in 1 second (lt)

FVC

Forced Vital Capacity (lt)

FEV1FVC

FEV1 / FVC ratio

Details

At least one of the spirometric measurement arguments must be set (i.e. be non-NULL). Arguments age, height and gender must be vectors of length equal to the length of the spirometric measurement vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Value

If only one spirometry argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one parameter supplied (FEV1)
pctpred_GLIgl(age=seq(25,40,5), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), FEV1=c(3.5, 4, 3.6, 3.9))


Convert spirometric values to % predicted using JRS (2014) equations

Description

This function takes absolute spirometry measurements (FEV1, FVC, VC or FEV1FVC) in lt plus demographic data (age, height, gender) and converts them to percent (%) predicted based on the JRS (Japanese Respiratory Society 2014) equations.

Usage

pctpred_JRS(
  age,
  height,
  gender = 1,
  FEV1 = NULL,
  FVC = NULL,
  VC = NULL,
  FEV1FVC = NULL
)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

FEV1

Forced Expiratory Volume in 1 second (lt)

FVC

Forced Vital Capacity (lt)

VC

Vital Capacity (lt)

FEV1FVC

FEV1 / FVC ratio

Details

At least one of the spirometric measurement arguments must be set (i.e. be non-NULL). Arguments age, height and gender must be vectors of length equal to the length of the spirometric measurement vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Value

If only one spirometry argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one parameter supplied (FEV1)
pctpred_JRS(age=seq(25,40,5), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), FEV1=c(3.5, 4, 3.6, 3.9))


Convert spirometric values to % predicted using NHANES III equations

Description

This function takes absolute spirometry measurements (FEV1, FVC, etc) in lt plus demographic data (age, height, gender and ethnicity) and converts them to percent (%) predicted based on the NHANES III equations.

Usage

pctpred_NHANES3(
  age,
  height,
  gender = 1,
  ethnicity = 1,
  FEV1 = NULL,
  FVC = NULL,
  FEV1FVC = NULL,
  PEF = NULL,
  FEF2575 = NULL,
  FEV6 = NULL,
  FEV1FEV6 = NULL
)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

ethnicity

Ethnicity (1 = Caucasian, 2 = African-American, 3 = Mexican-American). Default is 1.

FEV1

Forced Expiratory Volume in 1 second (lt)

FVC

Forced Vital Capacity (lt)

FEV1FVC

FEV1 / FVC ratio

PEF

Peak Expiratory Flow (lt)

FEF2575

Forced Expiratory Flow between 25% and 75% of FVC (lt/s)

FEV6

Forced Expiratory Volume in 6 seconds (lt)

FEV1FEV6

FEV1 / FEV6 ratio

Details

At least one of the spirometric measurement arguments must be set (i.e. be non-NULL). Arguments age, height, gender and ethnicity must be vectors of length equal to the length of the spirometric measurement vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Value

If only one spirometry argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one parameter supplied (FEV1)
pctpred_NHANES3(age=seq(25,40,5), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), FEV1=c(3.5, 4, 3.6, 3.9))


Calculate predicted values of spirometry parameters using GLI-2012 equations

Description

This function calculates the mean normal (predicted) values for the various spirometry parameters, using the GLI-2012 equations. It accepts as input age, height, gender and ethnicity.

Usage

pred_GLI(age, height, gender = 1, ethnicity = 1, param = "FEV1")

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

ethnicity

Ethnicity (1 = Caucasian, 2 = African-American, 3 = NE Asian, 4 = SE Asian, 5 = Other/mixed). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "FEV1", "FVC", "FEV1FVC", "FEF2575", "FEF75", "FEV075", "FEV075FVC"

Details

Arguments age, height, gender and ethnicity are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

If param has length one, the function returns a numeric vector. If param has length >1, it returns a data.frame with length(param) columns.

Examples

# Find predicted FEV1 and FVC for Caucasian women aged 20 to 70 and with a height of 1.70 meters.
pred_GLI(20:70, 1.7, 2, param=c("FEV1","FVC"))


Calculate predicted values of diffusing capacity using GLI (2017) equations

Description

This function calculates the mean normal (predicted) values for TLCO (transfer factor of the lung for carbon monoxide), KCO (transfer coefficient of the lung for carbon monoxide) and VA (alveolar volume) using the GLI (2017) equations. It accepts as input age, height and gender.

Usage

pred_GLIdiff(age, height, gender = 1, param = "TLCO", SI = TRUE)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "TLCO", "KCO" or "VA"

SI

(default TRUE) Use SI (mmol/min/kPa) or traditional (ml/min/mmHg) units?

Details

Arguments age, height and gender are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

If param has length one, the function returns a numeric vector. If param has length >1, it returns a data.frame with length(param) columns.

Examples

# Find predicted TLCO and VA for women aged 20 to 70 and with a height of 1.70 meters.
pred_GLIdiff(20:70, 1.7, 2, param=c("TLCO","VA"))


Calculate predicted values of spirometry parameters using GLI global (2022) equations

Description

This function calculates the mean normal (predicted) values for the various spirometry parameters, using the GLI global (2022) equations. It accepts as input age, height and gender.

Usage

pred_GLIgl(age, height, gender = 1, param = "FEV1")

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "FEV1", "FVC", "FEV1FVC"

Details

Arguments age, height and gender are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

If param has length one, the function returns a numeric vector. If param has length >1, it returns a data.frame with length(param) columns.

Examples

# Find predicted FEV1 and FVC for women aged 20 to 70 and with a height of 1.70 meters.
pred_GLIgl(20:70, 1.7, 2, param=c("FEV1","FVC"))


Calculate predicted values of spirometry parameters using JRS (2014) equations

Description

This function calculates the mean normal (predicted) values for the various spirometry parameters, using the JRS (Japanese Respiratory Society 2014) equations. It accepts as input age, height and gender.

Usage

pred_JRS(age, height, gender = 1, param = "FEV1")

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "FEV1", "FVC", "VC", "FEV1FVC"

Details

Arguments age, height and gender are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

If param has length one, the function returns a numeric vector. If param has length >1, it returns a data.frame with length(param) columns.

Examples

# Find predicted FEV1 and FVC for women aged 20 to 70 and with a height of 1.70 meters.
pred_JRS(20:70, 1.7, 2, param=c("FEV1","FVC"))


Calculate predicted values of spirometry parameters using NHANES III equations

Description

This function calculates the mean normal (predicted) values for the various spirometry parameters, using the NHANES III equations. It accepts as input age, height, gender and ethnicity.

Usage

pred_NHANES3(age, height, gender = 1, ethnicity = 1, param = "FEV1")

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

ethnicity

Ethnicity (1 = Caucasian, 2 = African-American, 3 = Mexican-American). Default is 1.

param

A character vector, containing one of more of the following parameters (case insensitive): "FEV1", "FVC", "FEV1FVC", "PEF", "FEF2575", "FEV6", "FEV1FEV6"

Details

Arguments age, height, gender and ethnicity are vectors of equal length, or of length one, in which case the value is recycled; if the four vectors are not of equal length, the function stops with an error.

Value

If param has length one, the function returns a numeric vector. If param has length >1, it returns a data.frame with length(param) columns.

Examples

# Find predicted FEV1 and FVC for Caucasian women aged 20 to 70 and with a height of 1.70 meters.
pred_NHANES3(20:70, 1.7, 2, param=c("FEV1","FVC"))


Convert z-scores back to raw spirometric values using GLI-2012 equations

Description

This function takes z-scores based on the GLI-2012 equations, plus demographic data (age, height, gender and ethnicity), and converts them back into absolute spirometry measurements (FEV1, FVC, etc) in lt.

Usage

raw_GLI(
  age,
  height,
  gender = 1,
  ethnicity = 1,
  FEV1 = NULL,
  FVC = NULL,
  FEV1FVC = NULL,
  FEF2575 = NULL,
  FEF75 = NULL,
  FEV075 = NULL,
  FEV075FVC = NULL
)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

ethnicity

Ethnicity (1 = Caucasian, 2 = African-American, 3 = NE Asian, 4 = SE Asian, 5 = Other/mixed). Default is 1.

FEV1

Forced Expiratory Volume in 1 second (z-score)

FVC

Forced Vital Capacity (z-score)

FEV1FVC

FEV1 / FVC (as z-score)

FEF2575

Forced Expiratory Flow between 25% and 75% of FVC (z-score)

FEF75

Forced Expiratory Flow at 75% of FVC (z-score)

FEV075

Forced Expiratory Volume in 0.75 sec (z-score)

FEV075FVC

FEV0.75 / FVC (as z-score)

Details

At least one of the spirometric z-score arguments must be set (i.e. be non-NULL). Arguments age, height, gender and ethnicity must be vectors of length equal to the length of the z-score vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Value

If only one spirometry z-score argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one z-score parameter supplied (FEV1)
raw_GLI(age=seq(25,40,5), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), FEV1=c(-1.2, -1.9, 0, 0.5))


Convert z-scores back to raw diffusing capacity values using GLI (2017) equations

Description

This function takes z-scores based on the GLI (2017) equations, plus demographic data (age, height and gender), and converts them back into absolute diffusing capacity measurements (TLCO, KCO and VA).

Usage

raw_GLIdiff(
  age,
  height,
  gender = 1,
  TLCO = NULL,
  KCO = NULL,
  VA = NULL,
  SI = TRUE
)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

TLCO

Transfer factor of the lung for carbon monoxide (z-score)

KCO

Transfer coefficient of the lung for carbon monoxide (z-score)

VA

Alveolar volume (z-score)

SI

(default TRUE) Use SI (mmol/min/kPa) or traditional (ml/min/mmHg) units?

Details

At least one of the diffusing capacity z-score arguments must be set (i.e. be non-NULL). Arguments age, height and gender must be vectors of length equal to the length of the z-score vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Value

If only one diffusing capacity z-score argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one z-score parameter supplied (TLCO)
raw_GLIdiff(age=seq(25,40,5), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), TLCO=c(-1.2, -1.9, 0, 0.5))


Convert z-scores back to raw spirometric values using GLI global (2022) equations

Description

This function takes z-scores based on the GLI global (2022) equations, plus demographic data (age, height and gender), and converts them back into absolute spirometry measurements (FEV1, FVC, or FEV1FVC) in lt.

Usage

raw_GLIgl(age, height, gender = 1, FEV1 = NULL, FVC = NULL, FEV1FVC = NULL)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

FEV1

Forced Expiratory Volume in 1 second (z-score)

FVC

Forced Vital Capacity (z-score)

FEV1FVC

FEV1 / FVC (as z-score)

Details

At least one of the spirometric z-score arguments must be set (i.e. be non-NULL). Arguments age, height and gender must be vectors of length equal to the length of the z-score vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Value

If only one spirometry z-score argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one z-score parameter supplied (FEV1)
raw_GLIgl(age=seq(25,40,5), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), FEV1=c(-1.2, -1.9, 0, 0.5))


Convert z-scores back to raw spirometric values using JRS (2014) equations

Description

This function takes z-scores based on the JRS (Japanese Respiratory Society 2014) equations, plus demographic data (age, height and gender), and converts them back into absolute spirometry measurements (FEV1, FVC, VC, or FEV1FVC) in lt.

Usage

raw_JRS(
  age,
  height,
  gender = 1,
  FEV1 = NULL,
  FVC = NULL,
  VC = NULL,
  FEV1FVC = NULL
)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

FEV1

Forced Expiratory Volume in 1 second (z-score)

FVC

Forced Vital Capacity (z-score)

VC

Vital Capacity (z-score)

FEV1FVC

FEV1 / FVC (as z-score)

Details

At least one of the spirometric z-score arguments must be set (i.e. be non-NULL). Arguments age, height and gender must be vectors of length equal to the length of the z-score vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Value

If only one spirometry z-score argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one z-score parameter supplied (FEV1)
raw_JRS(age=seq(25,40,5), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), FEV1=c(-1.2, -1.9, 0, 0.5))


Check input data for errors

Description

This function checks the supplied input for errors

Usage

rspiro_check_input(spiro_val, somat_val)

Arguments

spiro_val

List of spirometry measurements

somat_val

List of somatometric measurements

Value

Invisible. Stops if it finds an error.


Check somatometric input data

Description

This function checks the supplied somatometric input and returns a properly formatted data.frame

Usage

rspiro_check_somat(
  age,
  height,
  gender,
  ethnicity,
  NHANES = FALSE,
  JRS = FALSE,
  diff = FALSE
)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male)

ethnicity

Ethnicity (GLI: 1 = Caucasian, 2 = African-American, 3 = NE Asian, 4 = SE Asian, 5 = Other/mixed, NHANES: 1 = Caucasian, 2 = African-American, 3 = Mexican-American)

NHANES

Logical. Is input data for the NHANES III equations? Defaults to FALSE.

JRS

Logical. Is input data for the JRS equations? Defaults to FALSE.

diff

Logical. Is input data for the GLI diffusing capacity equations? Defaults to FALSE.

Value

Returns a data frame with these four columns plus a column 'agebound', which is age rounded to the lowest 0.25 of the year.


Convert spirometric values to z-scores using GLI-2012 equations

Description

This function takes absolute spirometry measurements (FEV1, FVC, etc) in lt plus demographic data (age, height, gender and ethnicity) and converts them to z-scores based on the GLI-2012 equations.

Usage

zscore_GLI(
  age,
  height,
  gender = 1,
  ethnicity = 1,
  FEV1 = NULL,
  FVC = NULL,
  FEV1FVC = NULL,
  FEF2575 = NULL,
  FEF75 = NULL,
  FEV075 = NULL,
  FEV075FVC = NULL
)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

ethnicity

Ethnicity (1 = Caucasian, 2 = African-American, 3 = NE Asian, 4 = SE Asian, 5 = Other/mixed). Default is 1.

FEV1

Forced Expiratory Volume in 1 second (lt)

FVC

Forced Vital Capacity (lt)

FEV1FVC

FEV1 / FVC

FEF2575

Forced Expiratory Flow between 25% and 75% of FVC (lt/s)

FEF75

Forced Expiratory Flow at 75% of FVC (lt/s)

FEV075

Forced Expiratory Volume in 0.75 sec (lt)

FEV075FVC

FEV0.75 / FVC

Details

At least one of the spirometric measurement arguments must be set (i.e. be non-NULL). Arguments age, height, gender and ethnicity must be vectors of length equal to the length of the spirometric measurement vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Value

If only one spirometry argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one parameter supplied (FEV1)
zscore_GLI(age=seq(25,40,4), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), ethnicity=rep(1,4), FEV1=c(3.5, 4, 3.6, 3.9))


Convert diffusing capacity values to z-scores using GLI (2017) equations

Description

This function takes absolute diffusing capacity measurements (TLCO, KCO and VA) plus demographic data (age, height and gender) and converts them to z-scores based on the GLI (2017) equations.

Usage

zscore_GLIdiff(
  age,
  height,
  gender = 1,
  TLCO = NULL,
  KCO = NULL,
  VA = NULL,
  SI = TRUE
)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

TLCO

Transfer factor of the lung for carbon monoxide (in mmol/min/kPa if SI=TRUE or ml/min/mmHg if SI=FALSE)

KCO

Transfer coefficient of the lung for carbon monoxide (in mmol/min/kPa/lt if SI=TRUE or ml/min/mmHg/lt if SI=FALSE)

VA

Alveolar volume (in lt)

SI

(default TRUE) Use SI (mmol/min/kPa) or traditional (ml/min/mmHg) units?

Details

At least one of the diffusing capacity measurement arguments must be set (i.e. be non-NULL). Arguments age, height and gender must be vectors of length equal to the length of the diffusing capacity measurement vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Value

If only one diffusing capacity argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one parameter supplied (TLCO)
zscore_GLIdiff(age=seq(25,40,5), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), TLCO=c(7.8, 8.8, 7.5, 8.5))


Convert spirometric values to z-scores using GLI global (2022) equations

Description

This function takes absolute spirometry measurements (FEV1, FVC, FEV1/FVC) in lt plus demographic data (age, height and gender) and converts them to z-scores based on the GLI global (2022) equations.

Usage

zscore_GLIgl(age, height, gender = 1, FEV1 = NULL, FVC = NULL, FEV1FVC = NULL)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

FEV1

Forced Expiratory Volume in 1 second (lt)

FVC

Forced Vital Capacity (lt)

FEV1FVC

FEV1 / FVC

Details

At least one of the spirometric measurement arguments must be set (i.e. be non-NULL). Arguments age, height and gender must be vectors of length equal to the length of the spirometric measurement vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Value

If only one spirometry argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one parameter supplied (FEV1)
zscore_GLI(age=seq(25,40,4), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), FEV1=c(3.5, 4, 3.6, 3.9))


Convert spirometric values to z-scores using JRS (2014) equations

Description

This function takes absolute spirometry measurements (FEV1, FVC, VC, FEV1/FVC) in lt plus demographic data (age, height and gender) and converts them to z-scores based on the JRS (Japanese Respiratory Society 2014) equations.

Usage

zscore_JRS(
  age,
  height,
  gender = 1,
  FEV1 = NULL,
  FVC = NULL,
  VC = NULL,
  FEV1FVC = NULL
)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

FEV1

Forced Expiratory Volume in 1 second (lt)

FVC

Forced Vital Capacity (lt)

VC

Vital Capacity (lt)

FEV1FVC

FEV1 / FVC

Details

At least one of the spirometric measurement arguments must be set (i.e. be non-NULL). Arguments age, height, and gender must be vectors of length equal to the length of the spirometric measurement vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Value

If only one spirometry argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one parameter supplied (FEV1)
zscore_JRS(age=seq(25,40,4), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), FEV1=c(3.5, 4, 3.6, 3.9))


Convert spirometric values to z-scores using NHANES III equations

Description

This function takes absolute spirometry measurements (FEV1, FVC, etc) in lt plus demographic data (age, height, gender and ethnicity) and converts them to z-scores based on the NHANES III equations.

Usage

zscore_NHANES3(
  age,
  height,
  gender = 1,
  ethnicity = 1,
  FEV1 = NULL,
  FVC = NULL,
  FEV1FVC = NULL,
  PEF = NULL,
  FEF2575 = NULL,
  FEV6 = NULL,
  FEV1FEV6 = NULL
)

Arguments

age

Age in years

height

Height in meters

gender

Gender (1 = male, 2 = female) or a factor with two levels (first = male). Default is 1.

ethnicity

Ethnicity (1 = Caucasian, 2 = African-American, 3 = Mexican-American). Default is 1.

FEV1

Forced Expiratory Volume in 1 second (lt)

FVC

Forced Vital Capacity (lt)

FEV1FVC

FEV1 / FVC ratio

PEF

Peak Expiratory Flow (lt)

FEF2575

Forced Expiratory Flow between 25% and 75% of FVC (lt/s)

FEV6

Forced Expiratory Volume in 6 seconds (lt)

FEV1FEV6

FEV1 / FEV6 ratio

Details

At least one of the spirometric measurement arguments must be set (i.e. be non-NULL). Arguments age, height, gender and ethnicity must be vectors of length equal to the length of the spirometric measurement vector(s), or of length one, in which case their value is recycled. If any input vector is not of equal length, the function stops with an error.

Normal distributions are assumed for all parameters, even though per the NHANES III equations paper (Hankinson et al) this was observed only for FEV1, FVC, PEF and FEV6.

Value

If only one spirometry argument is supplied, the function returns a numeric vector. If more are supplied, the function returns a data.frame with the same number of columns.

Examples

# Random data, 4 patients, one parameter supplied (FEV1)
zscore_NHANES3(age=seq(25,40,4), height=c(1.8, 1.9, 1.75, 1.85),
      gender=c(2,1,2,1), ethnicity=rep(1,4), FEV1=c(3.5, 4, 3.6, 3.9))