Package 'impIndicator'

Title: Impact Indicators of Alien Taxa
Description: The negative impact of alien species is recognised as a major threat to biodiversity. However, in the absence of evidence-based impact indicators that follow the Findable, Accessible, Interoperable, and Reusable (FAIR) Data Principles with standardised workflows, the impacts of alien species are not systematically estimated over time, a major gap for policy. We develop the impIndicator R package, using an open-source workflow for computing impact indicators of alien species, by combining occurrence data from the Global Biodiversity Information Facility (GBIF) with Environmental Impact Classification for Alien Taxa (EICAT) assessments.
Authors: Mukhtar Muhammed Yahaya [aut, cre] (ORCID: <https://orcid.org/0009-0008-9200-0863>, affiliation: Stellenbosch University (SU)), Sabrina Kumschick [aut, ctb] (ORCID: <https://orcid.org/0000-0001-8034-5831>, affiliation: Stellenbosch University (SU)), Sandra MacFadyen [aut, ctb] (ORCID: <https://orcid.org/0000-0002-5316-440X>, affiliation: Stellenbosch University (SU)), Pietro Landi [aut, ctb] (ORCID: <https://orcid.org/0000-0002-6373-2992>, affiliation: Stellenbosch University (SU)), Cang Hui [aut, ctb] (ORCID: <https://orcid.org/0000-0002-3660-8160>, affiliation: Stellenbosch University (SU)), Ward Langeraert [ctb] (ORCID: <https://orcid.org/0000-0002-5900-8109>, affiliation: Research Institute for Nature and Forest (INBO)), Stellenbosch University (SU) [cph], European Union's Horizon Europe Research and Innovation Programme (ID No 101059592) [fnd]
Maintainer: Mukhtar Muhammed Yahaya <[email protected]>
License: MIT + file LICENSE
Version: 0.6.1
Built: 2026-06-03 13:36:57 UTC
Source: https://github.com/b-cubed-eu/impIndicator

Help Index


Overall impact indicator

Description

Combines occurrences cube and impact data using the given method (e.g., mean cumulative) to compute the impact indicator of all species over a given region

Usage

compute_regional_indicator(
  cube,
  impact_data = NULL,
  method = NULL,
  trans = 1,
  ci_type = c("perc", "bca", "norm", "basic", "none"),
  confidence_level = 0.95,
  boot_args = list(samples = 1000, seed = NA),
  ci_args = list(no_bias = TRUE),
  col_category = NULL,
  col_species = NULL,
  col_mechanism = NULL,
  region = NULL
)

Arguments

cube

A data cube object (class 'processed_cube' or 'sim_cube', processed from b3gbi::process_cube()) or a dataframe (cf. ⁠$data⁠ slot of 'processed_cube' or 'sim_cube') or an impact cube (class 'impact_cube' from create_impact_cube_data)

impact_data

A dataframe of species impact which contains columns of impact_category, scientific_name and impact_mechanism.

method

A method of computing the indicator. The method used in the aggregation of within and across species in a site proposed by Boulesnane-Genguant et al. (submitted). The method can be one of

  • "precaut": The "precautionary" method assigns a species the maximum impact across all records of the species and then compute the maximum impact across species in each site

  • "precaut_cum": The "⁠precautionary cumulative⁠" method assigns a species the maximum impact across all records of the species then compute the summation of all impacts in each site. The precautionary cumulative method provides the highest impact score possible for each species but considers the number of co-occurring species in each site.

  • "mean":The "mean" method assigns species the mean impact of all the species impact and then computes the mean of all species in each site. The mean provides the expected impact within individual species and across all species in each site.

  • "mean_cum": The "⁠mean cumulative⁠" assigns a species the mean impact of all the species impact and then computes the summation of all impact scores in each site. The mean cumulative provides the expected impact score within individual species but adds co-occurring species’ impact scores in each site.

  • "cum": The "cumulative" assigns a species the summation of the maximum impact per mechanism and then computes the summation of all species’ impacts per site. The cumulative method provides a comprehensive view of the overall impact while considering the impact and mechanisms of multiple species.

trans

Numeric: 1 (default), 2 or 3. The method of transformation to convert the EICAT categories c("MC", "MN", "MO", "MR", "MV") to numerical values:

  • 1: converts the categories to c(0, 1, 2, 3, 4)

  • 2: converts the categories to to c(1, 2, 3, 4, 5)

  • 3: converts the categories to to c(1, 10, 100, 1000, 10000)

ci_type

A character vector specifying the type of confidence intervals to compute. Options include:

  • perc: Percentile intervals (default).

  • bca: Bias-corrected and accelerated intervals.

  • norm: Normal approximation intervals.

  • basic: Basic bootstrap intervals.

  • none: No confidence intervals calculated.

confidence_level

The confidence level for the calculated intervals. Default is 0.95 (95 % confidence level).

boot_args

(Optional) Named list of additional arguments passed to dubicube::bootstrap_cube(). Default: list(samples = 1000, seed = NA).

ci_args

(Optional) Named list of additional arguments passed to dubicube::calculate_bootstrap_ci(). Default: list(no_bias = TRUE).

col_category

The name of the column containing the impact categories. The first two letters each categories must be an EICAT short names (e.g "MC - Minimal concern").

col_species

The name of the column containing species names.

col_mechanism

The name of the column containing mechanisms of impact.

region

The shape file of the specific region to calculate the indicator on. If NULL (default), the indicator is calculated for all cells in the cube.

Value

A list of class impact_indicator, with the following components:

  • method: method used in computing the indicator

  • num_cells: number of cells (sites) in the indicator

  • num_species: number of species in the indicator

  • names_species: names of species in the indicator

  • site_impact: a dataframe containing total species impact per year

See Also

Other Indicator function: compute_site_indicator(), compute_species_indicator()

Examples

acacia_cube <- taxa_cube(
  taxa = taxa_Acacia,
  region = southAfrica_sf,
  res = 0.25,
  first_year = 2010
)
impact_value <- compute_regional_indicator(
  cube = acacia_cube,
  impact_data = eicat_acacia,
  method = "mean_cum",
  trans = 1,
  ci_type = "none"
)

Site impact indicator

Description

Combines occurrences cube and impact data using the given method (e.g., mean cumulative) to compute the impact indicator per site.

Usage

compute_site_indicator(
  cube,
  impact_data = NULL,
  method = NULL,
  trans = 1,
  col_category = NULL,
  col_species = NULL,
  col_mechanism = NULL,
  region = NULL
)

Arguments

cube

A data cube object (class 'processed_cube' or 'sim_cube', processed from b3gbi::process_cube()) or a dataframe (cf. ⁠$data⁠ slot of 'processed_cube' or 'sim_cube') or an impact cube (class 'impact_cube' from create_impact_cube_data)

impact_data

A dataframe of species impact which contains columns of impact_category, scientific_name and impact_mechanism.

method

A method of computing the indicator. The method used in the aggregation of within and across species in a site proposed by Boulesnane-Genguant et al. (submitted). The method can be one of

  • "precaut": The "precautionary" method assigns a species the maximum impact across all records of the species and then compute the maximum impact across species in each site

  • "precaut_cum": The "⁠precautionary cumulative⁠" method assigns a species the maximum impact across all records of the species then compute the summation of all impacts in each site. The precautionary cumulative method provides the highest impact score possible for each species but considers the number of co-occurring species in each site.

  • "mean":The "mean" method assigns species the mean impact of all the species impact and then computes the mean of all species in each site. The mean provides the expected impact within individual species and across all species in each site.

  • "mean_cum": The "⁠mean cumulative⁠" assigns a species the mean impact of all the species impact and then computes the summation of all impact scores in each site. The mean cumulative provides the expected impact score within individual species but adds co-occurring species’ impact scores in each site.

  • "cum": The "cumulative" assigns a species the summation of the maximum impact per mechanism and then computes the summation of all species’ impacts per site. The cumulative method provides a comprehensive view of the overall impact while considering the impact and mechanisms of multiple species.

trans

Numeric: 1 (default), 2 or 3. The method of transformation to convert the EICAT categories c("MC", "MN", "MO", "MR", "MV") to numerical values:

  • 1: converts the categories to c(0, 1, 2, 3, 4)

  • 2: converts the categories to to c(1, 2, 3, 4, 5)

  • 3: converts the categories to to c(1, 10, 100, 1000, 10000)

col_category

The name of the column containing the impact categories. The first two letters each categories must be an EICAT short names (e.g "MC - Minimal concern").

col_species

The name of the column containing species names.

col_mechanism

The name of the column containing mechanisms of impact.

region

The shape file of the specific region to calculate the indicator on. If NULL (default), the indicator is calculated for all cells in the cube.

Value

A list of class site_impact, with the following components:

  • method: method used in computing the indicator

  • num_cells: number of cells (sites) in the indicator

  • num_species: number of species in the indicator

  • site_impact: a dataframe containing impact per sites

See Also

Other Indicator function: compute_regional_indicator(), compute_species_indicator()

Examples

# define cube for taxa
acacia_cube <- taxa_cube(
  taxa = taxa_Acacia,
  region = southAfrica_sf,
  res = 0.25,
  first_year = 2010
)

siteImpact <- compute_site_indicator(
  cube = acacia_cube,
  impact_data = eicat_acacia,
  method = "mean_cum",
  trans = 1
)

Compute species impact indicator

Description

Combines occurrences cube and impact data using the given method (e.g., mean, max) to compute the impact indicator per species. Optionally computes bootstrap confidence intervals for the indicator grouped by year and species.

Interval calculation is currently not implemented!

Usage

compute_species_indicator(
  cube,
  impact_data = NULL,
  method = NULL,
  trans = 1,
  ci_type = "none",
  confidence_level = 0.95,
  boot_args = list(samples = 1000, seed = NA),
  ci_args = list(no_bias = TRUE),
  col_category = NULL,
  col_species = NULL,
  col_mechanism = NULL,
  region = NULL
)

Arguments

cube

A data cube object (class 'processed_cube' or 'sim_cube', processed from b3gbi::process_cube()) or a dataframe (cf. ⁠$data⁠ slot of 'processed_cube' or 'sim_cube') or an impact cube (class 'impact_cube' from create_impact_cube_data()).

impact_data

A dataframe of species impact which contains columns of impact_category, scientific_name and impact_mechanism. Ignored if cube is already an 'impact_cube'.

method

A method of computing the indicator. The method used in the aggregation of within-species impact. The method can be:

  • "max": The maximum method assigns a species the maximum impact across all records of the species. It is best for precautionary approaches. However, it can overestimate the impact of a species if the highest impact requires rare or specific conditions.

  • "mean": Assigns a species the mean impact across all its impact records. This method computes the expected impact of the species and is adequate when many impact records are available.

  • "max_mech": Assigns a species the summation of the maximum impact per mechanism. This assumes species with multiple mechanisms of impact have higher potential to cause impact.

trans

Numeric: 1 (default), 2 or 3. The method of transformation to convert the EICAT categories c("MC", "MN", "MO", "MR", "MV") to numerical values:

  • 1: converts the categories to c(0, 1, 2, 3, 4)

  • 2: converts the categories to c(1, 2, 3, 4, 5)

  • 3: converts the categories to c(1, 10, 100, 1000, 10000)

ci_type

A character string specifying the type of confidence intervals to compute. Options include:

  • "perc": Percentile intervals (default).

  • "bca": Bias-corrected and accelerated intervals.

  • "norm": Normal approximation intervals.

  • "basic": Basic bootstrap intervals.

  • "none": No confidence intervals calculated.

confidence_level

The confidence level for the calculated intervals. Default is 0.95 (95% confidence level).

boot_args

(Optional) Named list of additional arguments passed to dubicube::bootstrap_cube(). Default: list(samples = 1000, seed = NA).

ci_args

(Optional) Named list of additional arguments passed to dubicube::calculate_bootstrap_ci(). Default: list(no_bias = TRUE).

col_category

The name of the column containing the impact categories. The first two letters of each category must be an EICAT short name (e.g., "MC - Minimal concern").

col_species

The name of the column containing species names.

col_mechanism

The name of the column containing mechanisms of impact.

region

The shape file of the specific region to calculate the indicator on. If NULL (default), the indicator is calculated for all cells in the cube.

Value

A list of class 'species_impact', with the following components:

  • method: Method used in computing the indicator.

  • num_species: Number of species in the indicator.

  • names_species: Names of species in the indicator.

  • species_impact: A dataframe containing impact per species and year.

See Also

Other Indicator function: compute_regional_indicator(), compute_site_indicator()

Examples

acacia_cube <- taxa_cube(
  taxa = taxa_Acacia,
  region = southAfrica_sf,
  res = 0.25,
  first_year = 2010
)

# Without confidence intervals
speciesImpact <- compute_species_indicator(
  cube = acacia_cube,
  impact_data = eicat_acacia,
  method = "mean",
  trans = 1
)

Create impact cube data

Description

This function combines the occurrence cube data and impact data, named impact_cube_data.

Usage

create_impact_cube_data(
  cube_data,
  impact_data,
  trans = 1,
  col_category = NULL,
  col_species = NULL,
  col_mechanism = NULL,
  region = NULL
)

Arguments

cube_data

A dataframe of a cube ( $data slot) of class sim_cube or processed_cube from b3gbi::process_cube().

impact_data

The dataframe of species impact which contains columns of impact_category, scientific_name and impact_mechanism.

trans

Numeric: 1 (default), 2 or 3. The method of transformation to convert the EICAT categories c("MC", "MN", "MO", "MR", "MV") to numerical values:

  • 1: converts the categories to c(0, 1, 2, 3, 4)

  • 2: converts the categories to to c(1, 2, 3, 4, 5)

  • 3: converts the categories to to c(1, 10, 100, 1000, 10000)

col_category

The name of the column containing the impact categories. The first two letters each categories must be an EICAT short names (e.g "MC - Minimal concern").

col_species

The name of the column containing species names.

col_mechanism

The name of the column containing mechanisms of impact.

region

The shape file of the specific region to calculate the indicator on. If NULL (default), the indicator is calculated for all cells in the cube.

Value

A dataframe of containing impact data and occurrence cube. The class is impact_cube

Examples

library(b3gbi) # for processing cube
acacia_cube <- process_cube(cube_name = cube_acacia_SA,
                          grid_type = "eqdgc",
                          first_year = 2010,
                           last_year = 2024)

impact_cube <- create_impact_cube_data(
  cube_data = acacia_cube$data,
  impact_data = eicat_acacia,
)

GBIF Occurrence Cube of acacia in South Africa An example of occurrence cube of GBIF containing required column for impact indicator.

Description

GBIF Occurrence Cube of acacia in South Africa An example of occurrence cube of GBIF containing required column for impact indicator.

Usage

cube_acacia_SA

Format

A dataframe object containing 4,700 rows and 8 variables

year

The year the occurrence was recorded

eqdcellcode

The extended quarter degree cell code

speciesKey

The GBIF species identification number

species

The scientific name of species

occurrences

The number of observation in the cell

kingdom

The kingdom name of which the species belong

family

The family name of which the species belong

mincoordinateuncertaintyinmeters

minimum radius of the uncertainty circle around the geographic point

Source

GBIF.org (16 October 2025) GBIF Occurrence Download doi:10.15468/dl.zm3keb

See Also

Other Data: eicat_acacia, southAfrica_sf, taxa_Acacia

Examples

head(cube_acacia_SA, 10)

EICAT data of acacia taxa An example of EICAT data containing species name, impact category and mechanism.

Description

EICAT data of acacia taxa An example of EICAT data containing species name, impact category and mechanism.

Usage

eicat_acacia

Format

A dataframe object containing 138 observations and 3 variables

scientific_name

species scientific name

impact_category

EICAT impact category

impact_mechanism

mechanism of impact

Source

Jansen, C., Kumschick, S. A global impact assessment of Acacia species introduced to South Africa. Biol Invasions 24, 175–187 (2022). doi:10.1007/s10530-021-02642-0

See Also

Other Data: cube_acacia_SA, southAfrica_sf, taxa_Acacia

Examples

head(eicat_acacia, 10)

Impact categories

Description

Aggregate species impact categories from impact data. Species are often reported to have multiple impact categories specific to different study locations and mechanisms through which they exert the impact. To get an estimate of a likely impact category which could apply more broadly, this function aggregate the multiple impact scores per species into one impact score per species.

Usage

impact_cat(
  impact_data,
  species_list,
  trans = 1,
  col_category = NULL,
  col_species = NULL,
  col_mechanism = NULL
)

Arguments

impact_data

The dataframe of species impact which contains columns of impact_category, scientific_name and impact_mechanism.

species_list

The vector of species' list to aggregate their impact categories.

trans

Numeric: 1 (default), 2 or 3. The method of transformation to convert the EICAT categories c("MC", "MN", "MO", "MR", "MV") to numerical values:

  • 1: converts the categories to c(0, 1, 2, 3, 4)

  • 2: converts the categories to to c(1, 2, 3, 4, 5)

  • 3: converts the categories to to c(1, 10, 100, 1000, 10000)

col_category

The name of the column containing the impact categories. The first two letters each categories must be an EICAT short names (e.g "MC - Minimal concern").

col_species

The name of the column containing species names.

col_mechanism

The name of the column containing mechanisms of impact.

Value

The dataframe containing the aggregated species impact. max - maximum impact of a species. mean - mean impact of a species. max_mech - sum of maximum impact per categories of a species

See Also

Other Prepare data: taxa_cube()

Examples

# define species list
species_list <- c(
  "Acacia adunca",
  "Acacia baileyana",
  "Acacia binervata",
  "Acacia crassiuscula",
  "Acacia cultriformis",
  "Acacia cyclops",
  "Acacia dealbata",
  "Acacia decurrens",
  "Acacia elata"
)

agg_impact <- impact_cat(
  impact_data = eicat_acacia,
  species_list = species_list,
  trans = 1
)

Plot overall impact indicator

Description

Produces a ggplot2 object showing the temporal trend of the overall impact indicator.

Usage

## S3 method for class 'impact_indicator'
plot(
  x,
  trend = c("none", "line", "smooth"),
  point_args = list(),
  errorbar_args = list(),
  trend_args = list(),
  ribbon_args = list(),
  ...
)

Arguments

x

An object of class "impact_indicator" as returned by compute_regional_indicator().

trend

Character string indicating how the central trend should be displayed. One of:

"none"

No trend line is added.

"line"

A straight line connecting yearly values.

"smooth"

A loess-smoothed trend.

point_args

A named list of arguments passed to ggplot2::geom_point() to customise the appearance of the yearly impact estimates (e.g. size, colour, shape).

errorbar_args

A named list of arguments passed to ggplot2::geom_errorbar() to customise the uncertainty intervals, if lower (ll) and upper (ul) limits are available in x$impact.

trend_args

A named list of arguments passed to the trend layer (ggplot2::geom_line() or ggplot2::geom_smooth(), depending on trend) to customise its appearance (e.g. colour, linewidth, linetype, alpha).

ribbon_args

A named list of arguments passed to ggplot2::geom_ribbon() to customise the uncertainty ribbon, if lower (ll) and upper (ul) limits are available.

...

Currently not used.

Value

A ggplot object representing the overall impact indicator over time, with years on the x-axis and impact values on the y-axis.

See Also

Other Plot: plot.site_impact(), plot.species_impact()

Examples

## Not run: 
# create data_cube
acacia_cube <- taxa_cube(
  taxa = taxa_Acacia,
  region = southAfrica_sf,
  res = 0.25,
  first_year = 2010
)

# compute impact indicator
impact_value <- compute_regional_indicator(
  cube = acacia_cube,
  impact_data = eicat_acacia,
  method = "mean_cum",
  trans = 1
)

# default plot
plot(impact_value)

# customised plot
plot(
  impact_value,
  trend = "smooth",
  point_args = list(size = 3, colour = "darkred"),
  trend_args = list(colour = "black", linewidth = 1),
  ribbon_args = list(fill = "grey80", alpha = 0.3)
)

## End(Not run)

Plot site impact

Description

Produces the ggplot of site impact indicator

Usage

## S3 method for class 'site_impact'
plot(
  x,
  region = NULL,
  first_year = NULL,
  last_year = NULL,
  title_lab = "Site Impact map",
  text_size = 14,
  ...
)

Arguments

x

A dataframe of impact indicator. Must be a class of "site_impact"

region

sf or character. The shapefile of the region of study or a character which represent the name of a country. It is not compulsory but makes the plot more comprehensible.

first_year

The first year the impact map should include. Default starts from the first year included in x.

last_year

The last year the impact map should include. Default ends in the last year included in x.

title_lab

Title of the plot. Default is "Impact map"

text_size

The size of the text of the plot. Default is "14"

...

Additional arguments passed to geom_tile

Value

The ggplot of species yearly impact on the region.

See Also

Other Plot: plot.impact_indicator(), plot.species_impact()

Examples

# define cube for taxa
acacia_cube <- taxa_cube(
  taxa = taxa_Acacia,
  region = southAfrica_sf,
  res = 0.25,
  first_year = 2010
)

# compute site impact
siteImpact <- compute_site_indicator(
  cube = acacia_cube,
  impact_data = eicat_acacia,
  method = "mean_cum",
  trans = 1

)

# visualise site impact
plot(x = siteImpact, region = southAfrica_sf, first_year = 2021)

Plot species impact

Description

Produces a ggplot to show the trend of the species impact indicator.

Usage

## S3 method for class 'species_impact'
plot(
  x,
  alien_species = "all",
  linewidth = 1.5,
  title_lab = "Species impact indicator",
  y_lab = "Impact score",
  x_lab = "Year",
  text_size = 14,
  ...
)

Arguments

x

A dataframe of impact indicator. Must be a class of "species_impact"

alien_species

The character vector containing names of the alien species to be included in the plot. Default is "all" which plot all species in the data frame

linewidth

The width size of the line. Default is 1.5

title_lab

Title of the plot. Default is "Species impact"

y_lab

Label of the y-axis. Default is "impact score"

x_lab

Label of the x-axis. Default is "Year"

text_size

The size of the text of the plot. Default is "14"

...

Additional arguments passed to geom_line

Value

The ggplot object of the species impact, with the y- and x-axes representing the impact score and time respectively.

See Also

Other Plot: plot.impact_indicator(), plot.site_impact()

Examples

# create data cube
acacia_cube <- taxa_cube(
  taxa = taxa_Acacia,
  region = southAfrica_sf,
  res = 0.25,
  first_year = 2010
)

# compute species impact
speciesImpact <- compute_species_indicator(
  cube = acacia_cube,
  impact_data = eicat_acacia,
  method = "mean",
  trans = 1
)

# visualise species impact
plot(speciesImpact)

Prepare indicators for bootstrap and cross validation

Description

Create the parameter lists required to perform bootstrapping (dubicube::bootstrap_cube()), calculate confidence intervals (dubicube::calculate_bootstrap_ci()), and perform cross-validation (dubicube::cross_validate_cube()).

This function is primarily intended for internal use by indicator functions, but can also be used directly to construct parameter lists for manual calls to the underlying dubicube functions.

Default bootstrap and confidence interval arguments are internally defined and can be modified via boot_args and ci_args. User-supplied values override defaults.

Usage

prepare_indicators_bootstrap(
  impact_cube_data,
  indicator = c("overall", "site", "species"),
  indicator_method,
  grouping_var = "year",
  ci_type = "perc",
  confidence_level = 0.95,
  boot_args = list(samples = 1000, seed = NA),
  ci_args = list(no_bias = TRUE),
  out_var = "taxonKey"
)

Arguments

impact_cube_data

An impact cube object (class "impact_cube") created with create_impact_cube_data().

indicator

Character string specifying the impact indicator to be computed. Options are "overall", "site", and "species".

indicator_method

Character string specifying the method used to compute the impact indicator (see methods in compute_impact_indicator()).

grouping_var

A character vector specifying the grouping variable(s) for the bootstrap and confidence interval calculations. The function supplied to bootstrap_cube() must return one row per group. The specified variables must not be redundant (e.g., "time_point" and "year" should not both be used if one is simply an alternative encoding of the other).

ci_type

Character string specifying the type of confidence interval to compute. Options include:

  • "perc": Percentile interval (default)

  • "bca": Bias-corrected and accelerated interval

  • "norm": Normal approximation interval

  • "basic": Basic bootstrap interval

confidence_level

Numeric value specifying the confidence level for the intervals. Default is 0.95 (95% confidence level). This value is passed internally as conf to calculate_bootstrap_ci().

boot_args

Named list of additional arguments passed to dubicube::bootstrap_cube(). Defaults are:

samples

Number of bootstrap replicates (default 1000).

seed

Seed for reproducibility (default NA, meaning no call to set.seed()).

User-supplied values override these defaults. Arguments that are internally defined in this function (e.g., data_cube, fun, indicator_method, grouping_var, processed_cube, method) must not be supplied via boot_args.

ci_args

Named list of additional arguments passed to dubicube::calculate_bootstrap_ci(). Default is:

no_bias

Logical; if TRUE, intervals are centered around the original estimates (bias is ignored).

User-supplied values override defaults. The arguments grouping_var, type, and conf are controlled via grouping_var, ci_type, and confidence_level, respectively, and must not be supplied via ci_args.

out_var

Character string specifying the column used for leave-one-out cross-validation. Default is "taxonKey", which enables leave-one-species-out cross-validation.

Value

A named list with three components:

bootstrap_params

List of parameters for dubicube::bootstrap_cube().

ci_params

List of parameters for dubicube::calculate_bootstrap_ci().

cv_params

List of parameters for dubicube::cross_validate_cube().

Examples

## Not run: 
library(b3gbi)

acacia_cube <- process_cube(
  cube_name = cube_acacia_SA,
  grid_type = "eqdgc",
  first_year = 2010,
  last_year = 2024
)

impact_cube <- create_impact_cube_data(
  cube_data = acacia_cube,
  impact_data = eicat_acacia
)

params <- prepare_indicators_bootstrap(
  impact_cube_data = impact_cube,
  indicator = "overall",
  indicator_method = "mean_cum",
  boot_args = list(samples = 2000),
  ci_args = list(no_bias = FALSE)
)

# Bootstrap
bootstrap_results <- do.call(
  dubicube::bootstrap_cube,
  params$bootstrap_params
)

# Confidence intervals
ci_result <- do.call(
  dubicube::calculate_bootstrap_ci,
  c(bootstrap_results = list(bootstrap_results), params$ci_params)
)

# Cross-validation
cv_results <- do.call(
  dubicube::cross_validate_cube,
  params$cv_params
)

## End(Not run)

Print an impact_indicator object

Description

Provides a summary representation of an impact_indicator object, designed for user-friendly display in the console.

Usage

## S3 method for class 'impact_indicator'
print(x, n = 10, ...)

Arguments

x

An impact_indicator object.

n

(Optional) Integer specifying the number of rows of data to display.

...

Additional arguments.

Examples

## Not run: 
# create data_cube
acacia_cube <- taxa_cube(
  taxa = taxa_Acacia,
  region = southAfrica_sf,
  res = 0.25,
  first_year = 2010
)

# compute impact indicator
impact_value <- compute_regional_indicator(
  cube = acacia_cube,
  impact_data = eicat_acacia,
  method = "mean_cum",
  trans = 1
)

# print impact indicator
print(impact_value)

## End(Not run)

Print an site_impact object

Description

Provides a summary representation of an site_impact object, designed for user-friendly display in the console.

Usage

## S3 method for class 'site_impact'
print(x, n = 10, ...)

Arguments

x

An site_impact object.

n

(Optional) Integer specifying the number of rows of data to display.

...

Additional arguments.

Examples

# create data_cube
acacia_cube <- taxa_cube(
  taxa = taxa_Acacia,
  region = southAfrica_sf,
  res = 0.25,
  first_year = 2010
)

siteImpact <- compute_site_indicator(
  cube = acacia_cube,
  impact_data = eicat_acacia,
  method = "mean_cum",
  trans = 1
)

# print species impact
print(siteImpact)

Print an species_impact object

Description

Provides a summary representation of an species_impact object, designed for user-friendly display in the console.

Usage

## S3 method for class 'species_impact'
print(x, n = 10, ...)

Arguments

x

An species_impact object.

n

(Optional) Integer specifying the number of rows of data to display.

...

Additional arguments.

Examples

# create data_cube
acacia_cube <- taxa_cube(
  taxa = taxa_Acacia,
  region = southAfrica_sf,
  res = 0.25,
  first_year = 2010
)

# compute species impact
speciesImpact <- compute_species_indicator(
  cube = acacia_cube,
  impact_data = eicat_acacia,
  method = "mean",
  trans = 1
)

# print species impact
print(speciesImpact)

South African sf An example of region sf for impact indicator.

Description

South African sf An example of region sf for impact indicator.

Usage

southAfrica_sf

Format

A 'sf' object of South African map

geometry

geometry of polygon

See Also

Other Data: cube_acacia_SA, eicat_acacia, taxa_Acacia

Examples

sf::plot_sf(southAfrica_sf)

GBIF occurrences data of acacia in South Africa An example of occurrence data from GBIF containing required column for impact indicator.

Description

GBIF occurrences data of acacia in South Africa An example of occurrence data from GBIF containing required column for impact indicator.

Usage

taxa_Acacia

Format

A dataframe object containing 19,100 rows and 6 variables

decimalLatitude

geographic latitude in decimal

decimalLongitude

geographic longitude in decimal

species

scientific name of species

speciesKey

GBIF species identification number

coordinateUncertaintyInMeters

radius of the uncertainty circle around geographic point

year

year occurrence was recorded

Source

doi:10.15468/dl.b6gda5

See Also

Other Data: cube_acacia_SA, eicat_acacia, southAfrica_sf

Examples

head(taxa_Acacia, 10)

Build occurrences cube

Description

Prepare data cube to calculate species impact . The function taxa_cube can take in the scientific name of the taxa of interest as in character or GBIF occurrences data containing necessary columns. The GBIF occurrences is downloaded if scientific names is given.

Usage

taxa_cube(
  taxa,
  region,
  limit = 500,
  country = NULL,
  res = 0.25,
  first_year = NULL,
  last_year = NULL
)

Arguments

taxa

Character or dataframe. The character should be the scientific name of the focal taxa while the dataframe is the GBIF occurrences data which must contain columns "decimalLatitude", "decimalLongitude", "species", "speciesKey", "coordinateUncertaintyInMeters", "dateIdentified", and "year".

region

sf or character. The shapefile of the region of study or a character which represent the name of a country

limit

Number of records to return from GBIF download. Default is set to 500

country

Two-letter country code (ISO-3166-1) of the country for which the GBIF occurrences data should be downloaded.

res

The resolution of grid cells to be used. Default is 0.25

first_year

The year from which the occurrence should start from

last_year

The year at which the occurrence should end

Value

A data cube of sim_cubes

See Also

Other Prepare data: impact_cat()

Examples

acacia_cube <- taxa_cube(
  taxa = taxa_Acacia,
  region = southAfrica_sf,
  first_year = 2010
)