Function to fit parametric distributions for each species-by-trait combination at the finest scale of the user-supplied hierarchy. This function returns a tibble containing the fitted parameters.
trait_fit_distributions(filled_traits, distribution_type = "normal")
output from the trait_fill function.
the type of statistical distribution to use. Character or named list. Currently accepts "normal","lognormal", and "beta".
a tibble containing fitted distribution parameters for each trait in each species for each plot.
The distributions can either be a single distribution type which is
used for all traits, or traits can be assigned specific distributions types
by supplying the function with a named vector of traits, e.g.
c(height = "normal", mass = "lognormal"))
.
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
data(community)
data(trait)
filled_traits <- trait_fill(
comm = community |>
filter(PlotID %in% c("A", "B")),
traits = trait,
scale_hierarchy = c("Site", "PlotID"),
taxon_col = "Taxon", value_col = "Value",
trait_col = "Trait", abundance_col = "Cover"
)
fitted_distributions <- trait_fit_distributions(
filled_traits = filled_traits,
distribution_type = "normal"
)