Package {bodycon}


Title: Estimation of Animal Body Condition Indices
Version: 0.2.1
Description: Calculates animal body condition indices from measurements of body size and mass. Methods include residual-based ordinary least squares (OLS), the scaled mass index (SMI) using standardised major axis (SMA) regression, and SMI using robust SMA regression. Visualisation tools support comparison of indices and assessment of the suitability of these approaches. See Krebs and Singleton (1993) <doi:10.1071/ZO9930317>, Peig and Green (2009) <doi:10.1111/j.1600-0706.2009.17643.x>, and Warton et al. (2012) <doi:10.1111/j.2041-210X.2011.00153.x>.
License: MIT + file LICENSE
URL: https://rbglabs.github.io/bodycon/, https://github.com/RBGLabs/bodycon
BugReports: https://github.com/RBGLabs/bodycon/issues
Encoding: UTF-8
Imports: dplyr, ggnewscale, ggplot2, rlang, scales, smatr, stats, tibble
Suggests: knitr, readr, rmarkdown, testthat (≥ 3.0.0), usethis, vdiffr
VignetteBuilder: knitr
Depends: R (≥ 4.1.0)
LazyData: true
Config/testthat/edition: 3
Config/roxygen2/version: 8.1.0
NeedsCompilation: no
Packaged: 2026-11-03 19:34:52 UTC; jriley
Author: Julia Riley ORCID iD [aut, cre, cph], Fonti Kar ORCID iD [aut, cph]
Maintainer: Julia Riley <jriley@mta.ca>
Repository: CRAN
Date/Publication: 2026-11-25 11:50:10 UTC

bodycon: Estimation of Animal Body Condition Indices

Description

Calculates animal body condition indices from measurements of body size and mass. Methods include residual-based ordinary least squares (OLS), the scaled mass index (SMI) using standardised major axis (SMA) regression, and SMI using robust SMA regression. Visualisation tools support comparison of indices and assessment of the suitability of these approaches. See Krebs and Singleton (1993) doi:10.1071/ZO9930317, Peig and Green (2009) doi:10.1111/j.1600-0706.2009.17643.x, and Warton et al. (2012) doi:10.1111/j.2041-210X.2011.00153.x.

Author(s)

Maintainer: Julia Riley jriley@mta.ca (ORCID) [copyright holder]

Authors:

See Also

Useful links:


Animal Body Condition Index Estimation

Description

This function calculates body condition indices using three established approaches: residuals from an ordinary least squares regression (OLS), the scaled mass index (SMI) using classical standardized major axis (SMA) regression, and the SMI using robust SMA regression.

First, calculating body condition indices from the residuals of an OLS regression is a traditional approach in ecology as outlined by Krebs and Singleton (1993). There is discussion about whether it is the most robust approach (Schulte-Hostedde et al., 2005; Peig and Green, 2009), how its appropriateness may vary by taxon (Jakob et al., 1996; Băncilă et al., 2010; Labocha and Hayes, 2012), and whether it fits the assumptions of certain statistical tests (García-Berthou, 2001).

The SMI method described by Peig and Green (2009) uses an allometric, log-transformed relationship and the scaling exponent estimated from a standardized major axis regression to scale individual mass to a common reference body size. The robust SMI method uses the same SMI framework but estimates the scaling exponent using robust standardized major axis regression, reducing the influence of potential outliers on the fitted allometric relationship.

Usage

bci(
  data,
  body_size,
  weight,
  id = NULL,
  method = c("resid_ols", "smi", "smi_rob"),
  relation = NULL
)

Arguments

data

tibble/dataframe containing a standard body size variable and the corresponding weight for each individual of one animal species

body_size

name of standard body size variable (e.g., snout-vent-length of reptiles, tarsus length of birds, length from the snout to the base of the tail for mammals, etc.)

weight

name of weight variable (e.g., mass of the animal)

id

a unique identifier for the animals included in your dataset. If included, a tibble with these unique identifiers and the estimates is returned and, if not, the estimate alone is returned. Default is NULL.

method

method used to estimate body condition. Options are residuals from an OLS regression ("resid_ols"), the scaled mass index using classical SMA regression ("smi"), or the scaled mass index using robust SMA regression ("smi_rob"). One or more methods can be supplied.

relation

an argument to specify whether or not the relationship between weight and body size variables are assumed to be allometric ("allometric") or linear ("linear"). If allometric, both variables are log-transformed. Default is ⁠"allometric⁠. Biologically speaking, most animals exhibit a allometric relationship between their weight and body size measurements, this is the method that is appropriate.

Value

a tibble of body condition indices for each individual estimates using the method specified

References

Băncilă RI, Hartel T, Plăiaşu R, Smets J, Cogălniceanu D (2010). "Comparing three body condition indices in amphibians: a case study of yellow-bellied toad Bombina variegata." Amphibia-Reptilia, 31(4), 558–562.

García-Berthou E (2001). "On the misuse of residuals in ecology: testing regression residuals vs. the analysis of covariance." Journal of Animal Ecology, 70, 708–711.

Jakob EM, Marshall SD, Uetz GW (1996). "Estimating fitness: a comparison of body condition indices." Oikos, 77, 61–67.

Krebs CJ, Singleton GR (1993). "Indexes of condition for small mammals." Australian Journal of Zoology, 41, 317–323.

Labocha MK, Hayes JP (2012). "Morphometric indices of body condition in birds: a review." Journal of Ornithology, 153, 1–22.

Peig J, Green AJ (2009). "New perspectives for estimating body condition from mass/length data: the scaled mass index as an alternative method." Oikos, 118(12), 1883–1891.

Schulte-Hostedde AI, Zinner B, Millar JS, Hickling GJ (2005). "Restitution of mass-size residuals: validating body condition indices." Ecology, 86(1), 155–163.

Examples

# In these examples we will make use of the `gartersnake` dataset in this R package.
# This dataset contains the mass (in grams) and snout-vent length 
# (in mm) of 46 Maritime Gartersnakes.
# To estimate body condition indices for the gartersnakes this dataset, one could:

# BCI that is the residuals from an OLS regression
gartersnake  |>
  bci(svl_mm, mass_g, method = "resid_ols")
  
# BCI using the scaled mass index
gartersnake  |>
  bci(svl_mm, mass_g, method = "smi")
  
# BCI using the scaled mass index with robust SMA
gartersnake  |>
  bci(svl_mm, mass_g, method = "smi_rob")
  
# BCI with all three methods
gartersnake |>
  bci(svl_mm, mass_g, method = c("resid_ols", "smi", "smi_rob"))
  

Body Condition Index Estimation using Residuals from an OLS Regression

Description

This function calculates body condition indices from the residuals of an ordinary least squares regression (OLS). This is a traditional approach in ecology as outlined by Krebs and Singleton (1993). There is discussion about whether it is the most robust approach (Schulte-Hostedde et al., 2005; Peig and Green, 2009), how its appropriateness may vary by taxon (Jakob et al., 1996; Băncilă et al., 2010; Labocha and Hayes, 2012), and whether it fits the assumptions of certain statistical tests (García-Berthou, 2001).

Usage

bci_resid_ols(data, body_size, weight, id = NULL, relation = c("allometric"))

Arguments

data

tibble/dataframe containing a standard body size variable and the corresponding weight for each individual of one animal species

body_size

name of standard body size variable (e.g., snout-vent-length of reptiles, tarsus length of birds, length from the snout to the base of the tail for mammals, etc.)

weight

name of weight variable (e.g., mass of the animal)

id

a unique identifier for the animals included in your dataset. If included, a tibble with these unique identifiers and the estimates is returned and, if not, the estimate alone is returned. Default is NULL.

relation

an argument to specify whether or not the relationship between weight and body size variables are assumed to be allometric ("allometric") or linear ("linear"). If allometric, both variables are log-transformed. Default is "allometric". Biologically speaking, most animals exhibit an allometric relationship between their weight and body size measurements.

Value

A tibble containing residual-based body condition indices from the specified OLS relationship.

References

Băncilă RI, Hartel T, Plăiaşu R, Smets J, Cogălniceanu D (2010). "Comparing three body condition indices in amphibians: a case study of yellow-bellied toad Bombina variegata." Amphibia-Reptilia, 31(4), 558–562.

García-Berthou E (2001). "On the misuse of residuals in ecology: testing regression residuals vs. the analysis of covariance." Journal of Animal Ecology, 70, 708–711.

Jakob EM, Marshall SD, Uetz GW (1996). "Estimating fitness: a comparison of body condition indices." Oikos, 77, 61–67.

Krebs CJ, Singleton GR (1993). "Indexes of condition for small mammals." Australian Journal of Zoology, 41, 317–323.

Labocha MK, Hayes JP (2012). "Morphometric indices of body condition in birds: a review." Journal of Ornithology, 153, 1–22.

Peig J, Green AJ (2009). "New perspectives for estimating body condition from mass/length data: the scaled mass index as an alternative method." Oikos, 118(12), 1883–1891.

Schulte-Hostedde AI, Zinner B, Millar JS, Hickling GJ (2005). "Restitution of mass-size residuals: validating body condition indices." Ecology, 86(1), 155–163.

Examples

# In this examples we will make use of the `gartersnake` dataset in this R package.
# This dataset contains the mass (in grams) and snout-vent length 
# (in mm) of 46 Maritime Gartersnakes.
# To estimate body condition indices (using residuals from an OLS) for the gartersnakes
# in this dataset, one could:

gartersnake |>
   bci_resid_ols(svl_mm, mass_g)


Scaled Mass Index

Description

This function calculates body condition indices using the scaled mass index (SMI method) as described by Peig and Green (2009). Specifically, this method uses standardized major axis regression in its estimation of the body condition indices. Yet, this method is sensitive to the presence of outliers (i.e., data points that may distort the expected relationship between body length and weight), and so SMI estimation using robust regression (see function bci_smi_rob) may be more appropriate in cases where outliers are present.

Usage

bci_smi(data, body_size, weight, id = NULL)

Arguments

data

tibble/dataframe containing a standard body size variable and the corresponding weight for each individual of one animal species

body_size

name of standard body size variable (e.g., snout-vent-length of reptiles, tarsus length of birds, length from the snout to the base of the tail for mammals, etc.)

weight

name of weight variable (e.g., mass of the animal)

id

a unique identifier for the animals included in your dataset. If included, a tibble with these unique identifiers and the estimates is returned and, if not, the estimate alone is returned. Default is NULL.

Value

a tibble containing SMI estimates calculated using the classical SMA scaling exponent.

References

Peig J, Green AJ (2009). "New perspectives for estimating body condition from mass/length data: the scaled mass index as an alternative method." Oikos, 118(12), 1883–1891.

Examples

# In this examples we will make use of the `gartersnake` dataset in this R package.
# This dataset contains the mass (in grams) and snout-vent length 
# (in mm) of 46 Maritime Gartersnakes.
# To estimate body condition indices using the scaled mass index
# for the gartersnakes this dataset, one could:

gartersnake  |>
  bci_smi(svl_mm, mass_g)


Scaled Mass Index using Robust Standardized Major Axis Regression

Description

This function calculates body condition indices using the scaled mass index (SMI method) as described by Peig and Green (2009), with the with the scaling exponent estimated using robust standardized major axis (SMA) regression. This method is less sensitive to the presence of outliers (i.e., data points that may distort the expected relationship between body length and weight).

Usage

bci_smi_rob(data, body_size, weight, id = NULL)

Arguments

data

tibble/dataframe containing a standard body size variable and the corresponding weight for each individual of one animal species

body_size

name of standard body size variable (e.g., snout-vent-length of reptiles, tarsus length of birds, length from the snout to the base of the tail for mammals, etc.)

weight

name of weight variable (e.g., mass of the animal)

id

a unique identifier for the animals included in your dataset. If included, a tibble with these unique identifiers and the estimates is returned and, if not, the estimate alone is returned. Default is NULL.

Value

a tibble containing SMI estimates calculated using the robust SMA scaling exponent.

References

Peig J, Green AJ (2009). "New perspectives for estimating body condition from mass/length data: the scaled mass index as an alternative method." Oikos, 118(12), 1883–1891.

Examples

# In this examples we will make use of the `gartersnake` dataset in this R package.
# This dataset contains the mass (in grams) and snout-vent length 
# (in mm) of 46 Maritime Gartersnakes.
# To estimate body condition indices (using the scaled mass index with a robust regression)
# for the gartersnakes from this dataset, one could:

gartersnake |>
  bci_smi_rob(svl_mm, mass_g)


Maritime Gartersnake Size and Mass Data from the Maritimes

Description

This is a subset of data collected by Issac Acker during his Honours thesis at Mount Allison University on snakes in Nova Scotia and New Brunswick. It includes morphometric data for 46 Maritime Gartersnakes. The paper associated with this data is: Acker I, Baxter-Gilbert J, Riley JL. 2025. Assessing the presence of Ophidiomyces ophiodiicola on snakes in New Brunswick and Nova Scotia. Herpetological Conservation & Biology, 20(3): 624-638. URL: https://www.herpconbio.org/Volume_20/Issue_3/Acker_etal_2025.pdf

Usage

gartersnake

Format

gartersnake

A data frame with 46 rows and 6 columns:

id_num

A unique identifier for each individual snake measured.

age_class

Either J for juvenile or A for adult, depending on the age of the snake.

sex

Either F for female, M for male, or NA if the snake was not sexually mature yet (i.e., a juvenile).

mass_g

Mass, in grams, of the snake.

svl_mm

Snout-vent length (SVL) in mm of the snake. SVL is the distance from the snake's snout to the anterior edge of their cloaca.

total_length_mm

Total length in mm of the snake.

Source

https://www.herpconbio.org/Volume_20/Issue_3/Acker_etal_2025.pdf


Visualise and Compare Body Condition Index Methods

Description

Visualize and compare body condition index (BCI) estimation methods by plotting raw, observed body size–weight data alongside reference relationships implied by the selected BCI method(s). The function applies the same body condition index methods used by bci() to provide a consistent visual comparison of the resulting relationships.

Usage

plot_bci(
  data,
  body_size,
  weight,
  method = c("resid_ols", "smi", "smi_rob"),
  relation = "allometric",
  group = NULL,
  group_colours = NULL,
  method_colours = NULL,
  x_lab = "Body Size",
  y_lab = "Weight",
  group_lab = "Group",
  method_lab = "Method",
  legend = TRUE,
  return_predictions = FALSE
)

Arguments

data

tibble/dataframe containing a standard body size variable and the corresponding weight for each individual of one animal species

body_size

name of standard body size variable (e.g., snout-vent-length of reptiles, tarsus length of birds, length from the snout to the base of the tail for mammals, etc.)

weight

name of weight variable (e.g., mass of the animal)

method

method used to estimate body condition, either residuals from an OLS regression ("resid_ols"), the scaled mass index using classical standardized major axis (SMA) regression ("smi"), or the scaled mass index using robust SMA regression ("smi_rob"). One or more methods can be supplied.

relation

an argument to specify whether or not the relationship between weight and body size variables are assumed to be allometric ("allometric") or linear ("linear"). If allometric, both variables are log-transformed. Default is "allometric". Biologically speaking, most animals exhibit an allometric relationship between their weight and body size measurements.

group

Optional column in data specifying grouping of raw points (e.g., sex, population). Default is NULL (all points treated as one group) and plotted in light grey.

group_colours

Optional named vector specifying colours for each group of raw points. Names must match the values in the group column. If NULL, default ggplot2 colours are used.

method_colours

Optional named vector specifying colours for the BCI methods. Names must match the method labels used in the plot: "OLS regression (linear)", "OLS regression (allometric)", "SMI", "SMI (robust)". Defaults are dark grey, yellow, and blue.

x_lab

Label for the x-axis. The default is "Body Size".

y_lab

Label for the y-axis. The default is "Weight".

group_lab

Label for the grouping variable, if provided, enclosed in quotations. The default is "Group".

method_lab

Label for the method of calculating body condition enclosed in quotations. The default is "Method".

legend

Logical indicating whether to display the legend. Default is TRUE.

return_predictions

Either TRUE or FALSE to indicate whether or not you would like the predictions calculated to plot the lines returned to you, or not. The default is FALSE.

Details

This function is intended for exploratory and comparative visualization of body condition estimation methods. When multiple BCI methods are shown, reference relationships are coloured by method, and points can optionally be split and coloured by a grouping variable.

Value

A ggplot object. If return_predictions = TRUE, a list containing the plot, the data used to generate the plot, and the predicted values used to draw the reference relationships is returned.

Examples

data("gartersnake")

# Basic plot with all methods
plot_bci(
  gartersnake,
  svl_mm,
  mass_g,
  method = c("resid_ols", "smi", "smi_rob")
 )

# Plot only BCI using the SMI method estimated with an robust regression
# and group your raw data by sex
plot_bci(
  gartersnake,
  svl_mm,
  mass_g,
  method = c("smi_rob"),
  group = sex
)

# Plot BCI using two SMI methods &
# have custom colours for groups and methods
plot_bci(
  gartersnake,
  svl_mm,
  mass_g,
  method = c("smi", "smi_rob"),
  group = sex,
  group_colours = c("M" = "darkorange2", "F" = "mediumpurple"),
  method_colours = c("OLS regression (allometric)" = "black", "SMI (robust)" = "navy")
)

# Plot BCI using the SMI method estimated with an robust regression
# and hide the legend
plot_bci(
  gartersnake,
  svl_mm,
  mass_g,
  method = c("smi"),
  legend = FALSE
)


Eastern Red-backed Salamander Size and Mass Data from New Brunswick

Description

This is a subset of data collected by Sara Leslie during her Honours thesis at Mount Allison University on salamanders in New Brunswick. It includes morphometric data for 128 Eastern Red-backed Salamanders sampled in an old growth forest. The paper associated with this data is: Leslie S, Edge C, Riley JL. 2025. Herbicide Application Improves Plethodontid Salamander Habitat Conditions in Regenerating Clear-cut Forests. Canadian Journal of Forest Research. 55: 1-12. doi:10.1139/cjfr-2024-0294

Usage

salamander

Format

salamander

A data frame with 128 rows and 8 columns:

salamander_ID

A unique identifier for each individual salamander measured.

sex

Either F for female, M for male, or J if the salamander was not sexually mature yet (i.e., a juvenile).

gravid

Either n for no or NA if not applicable. There are no occurences of y for yes, because all individuals that were gravid (carrying eggs) were removed from this dataset.

salamander_ID

A unique identifier for each individual salamander measured.

age

Either J for juvenile or A for adult, depending on the age of the salamander.

mass_g

Mass, in grams, of the salamander.

svl_mm

Snout-vent length (SVL) in mm of the salamander. SVL is the distance from the individual's snout to the anterior edge of their cloaca.

total_length_mm

Total length in mm of the salamander.

Source

doi:10.1139/cjfr-2024-0294