Summarizes the mean and confidence interval for each trait moment.

trait_summarise_boot_moments(
  bootstrap_moments,
  parametric = TRUE,
  sd_mult = 1,
  ci = 0.95
)

Arguments

bootstrap_moments

trait moments from trait_np_bootstrap or trait_parametric_bootstrap

parametric

logical; default is TRUE. Should Confidence Intervals be calculated parametrically (using the mean and SD) or nonparametrically (using quantiles).

sd_mult

Number of standard deviations around each moment, defaults to one

ci

Desired confidence level for use when parametric is false. Defaults to 0.95.

Value

tibble with the grouping variables and the mean of each moment (+/- sd_mult * SD)

Examples

library(dplyr)
data(community)
data(trait)

# Filter community data to make example faster
community <- community |>
  filter(PlotID %in% c("A", "B"))

filled_traits <- trait_fill(
  comm = community,
  traits = trait,
  scale_hierarchy = c("Site", "PlotID"),
  taxon_col = "Taxon", value_col = "Value",
  trait_col = "Trait", abundance_col = "Cover"
)

# Note that more replicates and a greater sample size are advisable
# Here we set them low to make the example run quickly
boot_traits <- trait_np_bootstrap(filled_traits,
  nrep = 20,
  sample_size = 100
)

trait_summarise_boot_moments(boot_traits)
#> # A tibble: 12 × 17
#> # Groups:   global, Site, PlotID [4]
#>    global Site  PlotID Trait           n   mean ci_low_mean ci_high_mean     var
#>    <chr>  <chr> <chr>  <chr>       <int>  <dbl>       <dbl>        <dbl>   <dbl>
#>  1 global 1     A      Leaf_Thick…    20 0.217       0.211        0.222  3.67e-3
#>  2 global 1     A      Plant_Heig…    20 1.65        1.38         1.93   3.88e+0
#>  3 global 1     A      Wet_Mass_g     20 0.0106      0.0100       0.0113 4.87e-5
#>  4 global 1     B      Leaf_Thick…    20 0.204       0.199        0.209  1.70e-3
#>  5 global 1     B      Plant_Heig…    20 1.62        1.38         1.85   3.23e+0
#>  6 global 1     B      Wet_Mass_g     20 0.0122      0.0115       0.0128 4.42e-5
#>  7 global 2     A      Leaf_Thick…    20 0.212       0.206        0.218  4.16e-3
#>  8 global 2     A      Plant_Heig…    20 1.81        1.65         1.96   2.75e+0
#>  9 global 2     A      Wet_Mass_g     20 0.0257      0.0237       0.0276 2.97e-4
#> 10 global 2     B      Leaf_Thick…    20 0.196       0.190        0.201  2.91e-3
#> 11 global 2     B      Plant_Heig…    20 2.75        2.55         2.95   6.49e+0
#> 12 global 2     B      Wet_Mass_g     20 0.0209      0.0195       0.0223 2.17e-4
#> # ℹ 8 more variables: ci_low_var <dbl>, ci_high_var <dbl>, skew <dbl>,
#> #   ci_low_skew <dbl>, ci_high_skew <dbl>, kurt <dbl>, ci_low_kurt <dbl>,
#> #   ci_high_kurt <dbl>