Calculates indicator-level bootstrap confidence intervals. It
is called internally by add_ci() (indicator level) or when ci_type is
supplied to a *_ts() function; it is not meant to be called directly.
Usage
calc_ci(x, indicator, ...)
# Default S3 method
calc_ci(x, indicator, ...)
# S3 method for class 'total_occ'
calc_ci(x, indicator, num_bootstrap = 1000, ci_type = "perc", ...)
# S3 method for class 'occ_density'
calc_ci(x, indicator, num_bootstrap = 1000, ci_type = "perc", ...)
# S3 method for class 'spec_richness_density'
calc_ci(x, indicator, num_bootstrap = 1000, ci_type = "perc", ...)
# S3 method for class 'newness'
calc_ci(x, indicator, num_bootstrap = 1000, ci_type = "perc", ...)
# S3 method for class 'williams_evenness'
calc_ci(x, ...)
# S3 method for class 'pielou_evenness'
calc_ci(x, ...)
# S3 method for class 'ab_rarity'
calc_ci(x, indicator, num_bootstrap = 1000, ci_type = "perc", ...)
# S3 method for class 'area_rarity'
calc_ci(x, indicator, num_bootstrap = 1000, ci_type = "perc", ...)
# S3 method for class 'spec_occ'
calc_ci(x, indicator, num_bootstrap = 1000, ci_type = "perc", ...)
# S3 method for class 'spec_range'
calc_ci(x, indicator, num_bootstrap = 1000, ci_type = "perc", ...)
# S3 method for class 'hill0'
calc_ci(x, indicator, num_bootstrap = 1000, ...)
# S3 method for class 'hill1'
calc_ci(x, indicator, num_bootstrap = 1000, ...)
# S3 method for class 'hill2'
calc_ci(x, indicator, num_bootstrap = 1000, ...)Arguments
- x
A data cube object
- indicator
An indicator calculated over time, in the form of a data frame. *Note: this should NOT be an 'indicator_ts' object as it is meant to be called by the 'compute_indicator_workflow' function.
- ...
Additional arguments passed to specific calc_ci functions and on to
boot::boot.ci()(e.g.,conf,h,hinv), or to the iNEXT-based calculation for Hill numbers (e.g.,conf).- num_bootstrap
(Optional) Set the number of bootstraps to calculate for generating confidence intervals. (Default: 1000)
- ci_type
(Optional) Type of bootstrap interval passed to
boot::boot.ci(). (Default: "perc")
Value
A data frame containing indicator values with calculated lower (ll) and upper (ul) confidence bounds.
Methods (by class)
calc_ci(total_occ): Calculate confidence intervals for total occurrencescalc_ci(occ_density): Calculate confidence intervals for occurrence densitycalc_ci(spec_richness_density): Calculate confidence intervals for species richness densitycalc_ci(newness): Calculate confidence intervals for newnesscalc_ci(williams_evenness): Calculate confidence intervals for Williams' evennesscalc_ci(pielou_evenness): Calculate confidence intervals for Pielou's evennesscalc_ci(ab_rarity): Calculate confidence intervals for abundance-based raritycalc_ci(area_rarity): Calculate confidence intervals for area-based raritycalc_ci(spec_occ): Calculate confidence intervals for species occurrencescalc_ci(spec_range): Calculate confidence intervals for species rangecalc_ci(hill0): Calculate confidence intervals for Hill0 (Richness)calc_ci(hill1): Calculate confidence intervals for Hill1 (Shannon)calc_ci(hill2): Calculate confidence intervals for Hill2 (Simpson)
Examples
# \donttest{
# calc_ci() is called automatically when confidence intervals are requested
# during indicator calculation (or by add_ci(bootstrap_level = "indicator"))
occ_ts <- total_occ_ts(example_cube_1, first_year = 2000,
ci_type = "perc", num_bootstrap = 100)
head(occ_ts$data)
#> # A tibble: 6 × 9
#> year diversity_val int_type ll ul est_boot se_boot bias_boot conf
#> <dbl> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2000 2166 perc 1866. 2632. 2189. 186. 23.3 0.95
#> 2 2001 2831 perc 2579. 3098. 2820. 137. -10.9 0.95
#> 3 2002 3366 perc 2988. 3880. 3364. 225. -2.31 0.95
#> 4 2003 3114 perc 2629. 3722. 3120. 258. 6.15 0.95
#> 5 2004 2934 perc 2534. 3487. 2997. 227. 63.0 0.95
#> 6 2005 4733 perc 3994. 5378. 4770. 329. 36.6 0.95
# }
