% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/full_estimation_table.R
\name{full_estimation_table}
\alias{full_estimation_table}
\title{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{
\item{level_vec}{Vector of taxonomic levels over which to iterate estimation}

\item{measurement_table}{A table with the numerical measurements and biomass
used to compute allometric lms}

\item{what}{Should size (what = "size_col") or biomass (what = "biomass_col") be
estimated?}

\item{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}

\item{traits}{Should the table be computed by traits or not? Default FALSE}

\item{trait_columns}{List of traits to match, should be column names in measurement_table}

\item{id_col}{Name of the column holding a unique identifier per species/taxon,
used only when \code{traits = TRUE}. Default "species".}

\item{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}

\item{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.}

\item{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.
}
\description{
Returns size and biomass estimates for every taxon in measurement table
}
\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 <-
  dplyr::bind_rows(communities, 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")
}
