full_estimation_table: Returns size and biomass estimates for every taxon in...

View source: R/full_estimation_table.R

full_estimation_tableR Documentation

Returns size and biomass estimates for every taxon in measurement table

Description

Returns size and biomass estimates for every taxon in measurement table

Usage

full_estimation_table(
  level_vec,
  measurement_table,
  what,
  model = "lm",
  traits = FALSE,
  trait_columns = c(),
  id_col = "species",
  r_square_cutoff_upper = 0.95,
  r_square_cutoff_lower = 0,
  p_val_cutoff = 0.05
)

Arguments

level_vec

Vector of taxonomic levels over which to iterate estimation

measurement_table

A table with the numerical measurements and biomass used to compute allometric lms

what

Should size (what = "size_col") or biomass (what = "biomass_col") be estimated?

model

What kind of model should be computed, "lm" (default) for a linear model on the log10-log10 scale, or "poisson" for a Poisson glm with a log link

traits

Should the table be computed by traits or not? Default FALSE

trait_columns

List of traits to match, should be column names in measurement_table

id_col

Name of the column holding a unique identifier per species/taxon, used only when traits = TRUE. Default "species".

r_square_cutoff_upper

Upper cutoff for R2 in allometric models, models with values above it will not be used in estimation. Default is 0.95 to avoid overfit models

r_square_cutoff_lower

Lower cutoff for R2 in allometric models, models with values below it will not be used in estimation. Default is 0.

p_val_cutoff

Upper cutoff for p-value of allometric models, models with p_value above it will not be used in estimation. Default is 0.05.

Value

Tibble with size estimates or allometric models used in estimation.

Examples

# Reference measurements for one family, renamed to the columns the package expects
measurements <-
  bromeliad_inverts_measurements() %>%
  dplyr::filter(family == "Culicidae") %>%
  dplyr::rename(size_col = body_size_mm,
                biomass_col = body_mass_mg,
                biomass_type = mass_type) %>%
  dplyr::mutate(size_col = as.character(size_col),
                biomass_col = as.numeric(biomass_col))

# Taxa to estimate, with no measurement of their own
communities <-
  trini_communities() %>%
  dplyr::filter(family == "Culicidae") %>%
  dplyr::rename(abundance = n) %>%
  dplyr::mutate(size_col = "unknown",
                biomass_col = NA,
                biomass_type = "dry")

# The two together are what the package works on
dats <-
  combine_measurements(dats = communities, measurements = measurements)
level_vec <-
  c("species", "genus", "family")

measurement_table <-
  make_measurement_table(dats = dats, level_vec = level_vec)

# Every size estimate the data allows
full_estimation_table(level_vec = level_vec,
                      measurement_table = measurement_table,
                      what = "size_col")

# Every allometric model the data allows, on dry biomass
full_estimation_table(level_vec = level_vec,
                      measurement_table = dry_wet(measurement_table,
                                                  biomass_type = "dry"),
                      what = "biomass_col")

hellometry documentation built on Nov. 11, 2026, 5:06 p.m.