Title: Risk Assessments for Ecosystems or Ecosystem Components
Version: 0.1.1
Description: Implementation of a modular framework for ecosystem risk assessments, combining existing risk assessment approaches tailored to semi-quantitative and quantitative analyses.
License: CC BY 4.0
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.2
URL: https://github.com/HeleneGutte/ecorisk
BugReports: https://github.com/HeleneGutte/ecorisk/issues
Imports: colorspace, forecast, geomtextpath, ggnewscale, ggplot2, ggpubr, gridExtra, mgcv, rlang, stats, tibble
Depends: R (≥ 4.1.0)
Suggests: dplyr, kableExtra, knitr, rmarkdown, stringr, testthat (≥ 3.0.0), tidyr
VignetteBuilder: knitr
Config/testthat/edition: 3
Collate: 'aggregate_risk.R' 'calc_exposure.R' 'calc_sensitivity.R' 'create_template_exposure.R' 'create_template_sensitivity.R' 'data.R' 'model_exposure.R' 'model_sensitivity.R' 'plot_heatmap.R' 'plot_radar.R' 'risk.R' 'status.R' 'vulnerability.R'
NeedsCompilation: no
Packaged: 2025-05-22 08:49:22 UTC; helene
Author: Helene Gutte ORCID iD [aut, cre, cph], Saskia A. Otto ORCID iD [aut]
Maintainer: Helene Gutte <helenegutte96@gmail.com>
Repository: CRAN
Date/Publication: 2025-05-27 08:10:10 UTC

Compute High-Complexity Multi-Risk Scores and (Eco)system Risk

Description

The function aggregate_risk uses the output of the risk function or the vulnerability function. The risk or vulnerability scores are aggregated in three ways:

  1. as multi-pressure risk per state indicator, representing the overall effect on one indicator

  2. as multi- state indicator risk per pressure, representing the overall effect each pressure has on all state indicators

  3. as ecosystem risk, the combined multi-pressure risks of all indicators.

Usage

aggregate_risk(risk_results, method = "mean")

Arguments

risk_results

Risk score for each state indicator ~ pressure ~ type combination, derived from the function risk or vulnerability.

method

Character indicating the method for aggregating the pressures and state indicators to multiple risk scores and the ecosystem risk score. The use can choose between (arithmetic) mean, median, sum, maximum and minimum. Default is the arithmetic mean.

Details

The returned lists are required in the plotting functions plot_radar and plot_heatmap. The aggregated scores are calculated for each type and pathway combination individually and across all types and pathways. If only one type and/or one pathway has been evaluated beforehand, the results will be the same for the different combinations.

Value

The function returns a list containing three sublists, first the multi-state indicator risk list, containing the risks and uncertainties aggregated per pressure, type and pathway. Second the multi-pressure risk list, where risks and uncertainties are aggregated per state indicator and type and pathway. The third list contains the ecosystem risks, which aggregates the multi-pressure risk and uncertainty scores per type and pathway.

See Also

vulnerability, risk, plot_radar, plot_heatmap

Examples

### Demo with example output from the risk() function based on expert scores
# (where direct and direct/indirect effects were evaluated)

# Calculate mean risks scores per indicator/pressure/ecosystem:
mean_risk <- aggregate_risk(
  risk_results = ex_output_risk_expert,
  method = "mean" # default
)
mean_risk
# Calculate median risks scores:
aggregate_risk(
  risk_results = ex_output_risk_expert,
  method = "median"
)
# Calculate maximum risks scores:
aggregate_risk(
  risk_results = ex_output_risk_expert,
  method = "maximum"
)


### Demo with example output from the risk() function based on modelled
#   scores (where only direct/indirect effects were evaluated)

# Calculate mean risks scores:
aggregate_risk(risk_results = ex_output_risk_model)


### Demo with combined expert-based and model-based pathways

combined_risk <- rbind(ex_output_risk_expert, ex_output_risk_model)
aggr_risk <- aggregate_risk(risk_results = combined_risk)
aggr_risk

aggr_risk$multi_indicator_risk |>
  dplyr::filter(type == "combined", pathway == "combined")
aggr_risk$multi_pressure_risk |>
  dplyr::filter(type == "combined", pathway == "combined")
aggr_risk$ecosystem_risk |>
  dplyr::filter(type == "combined", pathway == "combined")


### Demo with vulnerability scores using example output data from
#   vulnerability() based on modelled scores

aggregate_risk(risk_results = ex_output_vulnerability_model)

Calculate Overall Exposure Scores from Component-Specific Expert Ratings

Description

Calculate exposure scores from individual exposure components. Additionally calculate associated uncertainty scores.

Usage

calc_exposure(
  pressures,
  components,
  probabilities = NULL,
  uncertainty = NULL,
  method = "mean"
)

Arguments

pressures

A character vector or column of a data frame containing the names of the pressures.

components

A numeric vector or data frame containing the numeric values per exposure component for each pressure. Has to be in the same order as the pressure vector or come from the same data frame.

probabilities

Optionally: a numeric vector containing the probabilities of each pressure (values have to be between 0 and 1); default is NULL. Has to be in the same order as the pressure vector.

uncertainty

a numeric vector or data frame containing the associated uncertainty per component; default is NULL. Has to be in the same order as the pressure vector.

method

a character string specifying the aggregation method. Available are mean (default), median, maximum, and minimum.

Details

Often exposure components include the magnitude of change compared to baseline conditions, the frequency of this change, a future trend and a spatial scale. These components are scored within the ecorisk framework for each pressure by experts on a scale from 1 (low impact) to 5 (high impact). To express their uncertainty during the process, experts can score the associated uncertainty generally for all components of one pressure or for each component individually. The uncertainty is scored in the ecorisk framework on a scale from 1 (low uncertainty) to 3 (high uncertainty). Using exposure and sensitivity scorings vulnerability is calculated. Guidance for the scoring process can be found here: create_template_exposure or in the vignette or in Gutte et al., 2025.

Value

Returns a data frame containing the pressure name, the aggregated exposure score and associated uncertainty scores. The results serve as input to the vulnerability function. In case no uncertainty values were provided, NAs will be returned as uncertainty scores.

See Also

create_template_exposure, create_template_sensitivity, calc_sensitivity, vulnerability

Examples

### Example using demo data with five pressures, four components and their individual
# uncertainties (probabilities are assumed to be 1):
ex_expert_exposure

calc_exposure(
  pressures = ex_expert_exposure$pressure,
  components = ex_expert_exposure[ ,2:5],
  uncertainty = ex_expert_exposure[ ,6:9]
 )


### Example for two hazardous risks with only two components ('magnitude' and
#   'spatial'), one general uncertainty score, and associated probabilities:
hazard <- c("heat waves", "hurricanes")

# Create scoring table using the template function:
exp_tbl <- create_template_exposure(
  pressures = hazard,
  n_components = 2,
  mode_uncertainty = "general",
  probability = TRUE
)

names(exp_tbl)[2:3] <- c("magnitude", "spatial")
# Assign component-specific scores and probabilities:
exp_tbl$magnitude <- c(5,4)
exp_tbl$spatial <- c(5,3)
exp_tbl$uncertainty <- c(2,3)
exp_tbl$probability <- c(0.8,0.3)

# Calculate exposure score:
calc_exposure(
  pressures = exp_tbl$pressure,
  components = exp_tbl[ ,c("magnitude", "spatial")],
  probabilities = exp_tbl$probability,
  uncertainty = exp_tbl$uncertainty
 )

Calculate Overall Sensitivity and Adaptive Capacity Scores from Trait-Specific Expert Ratings

Description

The function calc_sensitivity calculates aggregated sensitivity and adaptive capacity scores. Additionally it prepares the scoring data for the further usage in the vulnerability function. The scores for sensitivity and adaptive capacity can be trait-based or general (one score per state indicator and pressure combination).

Usage

calc_sensitivity(
  indicators,
  pressures,
  type = "direct",
  sensitivity_traits,
  adaptive_capacities = NULL,
  uncertainty_sens = NULL,
  uncertainty_ac = NULL,
  method = "mean"
)

Arguments

indicators

A character vector or column of a data frame containing the names of the state indicators.

pressures

A character vector or column of a data frame containing the names of the pressures.

type

A character vector or column of a data frame specifying the effect type. Effects could be direct or indirect or a combination of both. Default is direct.

sensitivity_traits

A data frame containing the numeric sensitivity values per species trait or as a general value.

adaptive_capacities

A data frame (or single vector) containing the numeric values for the adaptive capacity. Either per trait or as one general value. When values are given per trait, they have to be in the same order as the values for the sensitivity. The default is NULL.

uncertainty_sens

A data frame (or a vector) containing the numeric uncertainty values associated with the sensitivity; default is NULL.

uncertainty_ac

A data frame (or a vector) containing the numeric uncertainty values associated with the adaptive capacity; default is NULL.

method

A character string specifying the method of the aggregation of the traits. Available are median, minimum, maximum and mean, the mean is default.

Details

The function calculates per state indicator and pressure combination one aggregated sensitivity and adaptive capacity score, the aggregation method can be determined with the parameter method. The assessment of adaptive capacity is optionally, if no scores for adaptive capacity are provided the function calculates an aggregated sensitivity score and prepares only the sensitivity scores for the vulnerability function. Guidance for the scoring process can be found here: create_template_sensitivity or in the vignette or in Gutte et al., 2025. Using exposure and sensitivity scorings, vulnerability is calculated.

Value

a data frame containing the indicator, pressure and effect type, the aggregated sensitivity and adaptive capacity as well as their associated uncertainty scores. Additionally, the trait specific sensitivity and adaptive capacity scores are stored and used later as input for the vulnerability function.

See Also

create_template_exposure, create_template_sensitivity, calc_exposure, vulnerability

Examples

### Example using demo data with four indicators and five pressures with
#   scores for direct as well as combined direct-indirect effects based on
#   the template function create_template_sensitivity(). For two
#   indicators, sensitivity, adaptive capacity, and their uncertainties are
#   provided as general scores, while for the other two, they are based on
#   individual traits.
ex_expert_sensitivity

# Calculate only mean sensitivity scores:
calc_sensitivity(
  indicators = ex_expert_sensitivity$indicator,
  pressures = ex_expert_sensitivity$pressure,
  sensitivity_traits = ex_expert_sensitivity[ ,4:8],
  adaptive_capacities = NULL,   # (default)
  uncertainty_sens  = NULL,     # (default)
  uncertainty_ac = NULL,        # (default)
  method = "mean"               # (default)
 )

# Calculate mean scores for sensitivity, adaptive capacity and
# associated uncertainties:
calc_sensitivity(
  indicators = ex_expert_sensitivity$indicator,
  pressures = ex_expert_sensitivity$pressure,
  type = ex_expert_sensitivity$type,
  sensitivity_traits = ex_expert_sensitivity[ ,4:8],
  adaptive_capacities = ex_expert_sensitivity[ ,9:13],
  uncertainty_sens  = ex_expert_sensitivity[ ,14:18],
  uncertainty_ac = ex_expert_sensitivity[ ,19:23]
 )


### Example for one indicator and three pressures to evaluate direct
#   effects where sensitivity is scored for four individual traits:
ind <- "herring"
press <- c("fishing", "temperature increase", "salinity decrease")

# Create scoring table using the template function:
sens_ac_tbl <- create_template_sensitivity(
  indicators = ind,
  pressures = press,
  type = "direct",                      # (default)
  n_sensitivity_traits = 4,
  adaptive_capacity = TRUE,             # (default)
  mode_adaptive_capacity = "general",   # (default)
  uncertainty = TRUE,                   # (default)
  mode_uncertainty = "general"          # (default)
)

# Rename trait columns:
trait_cols <- paste0("sens_",
  c("feeding", "behaviour", "reproduction", "habitat"))
names(sens_ac_tbl)[4:7] <- trait_cols
# Give trait-specific sensitivity scores:
sens_ac_tbl$sens_feeding <- c(0,0,0)
sens_ac_tbl$sens_behaviour <- c(-1,0,-4)
sens_ac_tbl$sens_reproduction <- c(-2,-2,-5)
sens_ac_tbl$sens_habitat <- c(-3,-2,0)

# Give general adaptive capacity and uncertainty scores:
sens_ac_tbl$ac_general <- c(0,0,-1)
sens_ac_tbl$uncertainty_sens <- c(1,1,1)
sens_ac_tbl$uncertainty_ac <- c(1,1,2)

sens_ac_tbl

# Calculate median sensitivity scores (adaptive capacities and
# uncertainties cannot be aggregated further):
calc_sensitivity(
  indicators = sens_ac_tbl$indicator,
  pressures = sens_ac_tbl$pressure,
  sensitivity_traits = sens_ac_tbl[, trait_cols],
  adaptive_capacities = sens_ac_tbl$ac_general,
  uncertainty_sens  = sens_ac_tbl$uncertainty_sens,
  uncertainty_ac = sens_ac_tbl$uncertainty_ac,
  method = "median"
)

Create a Template for Expert-Based Exposure Scoring

Description

The function create_template_exposure generates a template for a semi-quantitative, expert-based scoring of individual exposure components. This template is designed for use within the ecorisk workflow. The user can define the number of exposure components (e.g., magnitude, frequency, trend, and spatial scale) to be included in the scoring process and whether uncertainty should be assessed.

Usage

create_template_exposure(
  pressures,
  n_components = 4,
  uncertainty = TRUE,
  mode_uncertainty = "general",
  probability = FALSE
)

Arguments

pressures

A character vector specifying the names of the pressures to be assessed.

n_components

A positive integer or integer indicating the number of exposure components to be included in the assessment table. Within the ecorisk framework four components are usually scored:magnitude, frequency, trend and spatial scale. The default includes therefore four components.

uncertainty

logical; should uncertainty be assessed? Default is TRUE.

mode_uncertainty

character; if uncertainty is assessed, it can be scored for each exposure component and pressure individually ("component") or as a general uncertainty score for each pressure ("general", default). The default assigns one general uncertainty score per pressure.

probability

logical; for hazardous risks that may have a lower probability of occurring within the assessed future time period, probabilities between 0 and 1 can be assigned to each pressure and considered in the calc_exposure function.

Details

By default, the function creates a template with four exposure components and a general uncertainty scoring column. Within the ecorisk framework, exposure components should be scored on a scale from 1 to 5 (low to high impact), while uncertainty should be scored from 1 to 3 (low to high uncertainty).

The returned data frame can be exported as a CSV or Excel file. Components can be renamed and additional components can be added if necessary. The completed file can then be analyzed using the calc_exposure function.

The default scoring system is as follows:

Value

The function returns a data frame containing the names of the pressures and the specified number of exposure components. If uncertainty is assessed, the data frame also includes either one general uncertainty column or one uncertainty column per component, depending on the selected uncertainty assessment mode.

See Also

create_template_sensitivity, calc_exposure, calc_exposure

Examples

### Create a full template for three pressures, including all four components
#   and a general uncertainty column:
press <- c("fishing", "temperature increase", "salinity decrease")

exp_tbl <- create_template_exposure(pressures = press)
# --> Export table and re-import after completion or fill in directly in R.

# Rename exposure components
names(exp_tbl)[2:5] <- c("magnitude", "frequency", "trend", "spatial")

# Assign individual scores between 1 (low) and 5 (high impact):
exp_tbl$magnitude <- c(1,5,4)
exp_tbl$frequency <- c(1,5,3)
exp_tbl$trend <- c(1,4,2)
exp_tbl$spatial <- c(1,5,5)

# Assign uncertainty scores from 1 (low) to 3 (high uncertainty):
exp_tbl$uncertainty <- c(1,1,3)


### Create a template for two more hazardous risks with only two components
#   ('magnitude' and 'spatial'), including component-specific uncertainties,
#   and a probability column:
hazard <- c("heat waves", "hurricanes")

exp_tbl <- create_template_exposure(
  pressures = hazard,
  n_components = 2,
  mode_uncertainty = "component",
  probability = TRUE
)

# Rename components and uncertainties
names(exp_tbl)[2:5] <- c("magnitude", "spatial", "uncertainty_magnitude",
                         "uncertainty_spatial")
exp_tbl$magnitude <- c(5,4)
exp_tbl$spatial <- c(5,3)
exp_tbl$uncertainty_magnitude <- c(1,1)
exp_tbl$uncertainty_spatial <- c(3,3)

# Assign probabilities of their occurrence within the assessed future period:
exp_tbl$probability <- c(0.8,0.3)


Create a Template for Expert-Based Sensitivity and Adaptive Capacity Scoring

Description

The function crt_sensitivity creates a template for semi-quantitative, expert-based sensitivity and, optionally, adaptive capacity scoring. The template allows for assessing sensitivity and adaptive capacity using either a general score for each state indicator-pressure combination or a trait-based approach using life history traits. The latter is particularly useful when state indicators represent individual species and detailed biological information is available.

Usage

create_template_sensitivity(
  indicators,
  pressures,
  type = "direct",
  n_sensitivity_traits = 1,
  adaptive_capacity = TRUE,
  mode_adaptive_capacity = "general",
  uncertainty = TRUE,
  mode_uncertainty = "general"
)

Arguments

indicators

A character vector specifying the names of the state indicators to assess.

pressures

A character vector specifying the names of the pressures to assess.

type

A character vector defining the type(s) of influence, such as "direct", "indirect" or "direct_indirect". The default is "direct".

n_sensitivity_traits

A positive integer specifying the number of traits used to assess sensitivity. The default is 1, meaning that one general sensitivity score per state indicator-pressure-type combination is provided.

adaptive_capacity

logical; should adaptive capacity be assessed? Default is TRUE.

mode_adaptive_capacity

A character vector specifying whether adaptive capacity should be assessed for each trait individually ("trait") or as a general score ("general", default). Note: This parameter is only relevant when n_sensitivity_traits > 1.

uncertainty

logical; should uncertainty be assessed? Default is TRUE. Note: Uncertainty is only added for components included in the assessment. If adaptive capacity (adaptive_capacity = FALSE) is not included, no uncertainty scoring will be applied to it.

mode_uncertainty

A character vector specifying whether uncertainty should be assessed for each trait individually ("trait") or as a general score ("general").

Details

For each state indicator-pressure combination, different types of influence can be assessed. The type of influence describes whether the pressure acts directly, indirectly, or as a combination of both, which is important for identifying impact pathways and potential management measures.

Within the ecorisk framework, it is recommended to use negative scores (-1 to -5) to indicate negative impacts (low to high severity) and positive scores (1 to 5) for positive effects of a pressure on an indicator. If an indicator is not sensitive to a pressure, the score should be 0. Adaptive capacity is scored from -1 (no adaptive capacity) to 1 (high adaptive capacity).

To improve the reliability of the scoring, uncertainty should also be assessed. Uncertainty can be scored for each trait individually or as a general score and should be rated on a scale from 1 to 3 (low to high uncertainty).

The returned data frame can be exported as a CSV or Excel file. Column names can be modified as needed. The completed file can be analyzed using the calc_sensitivity function.

Depending on the settings, the data frame will include:

Within this data frame, trait-based and general scoring can be mixed. It is therefore recommended to set n_sensitivity_traits to the maximum number of traits to be assessed for any state indicator. The calc_sensitivity function automatically distinguishes between general and trait-based scoring.

Value

A data frame where each row represents a state indicator-pressure-type combination, containing the specified sensitivity traits, adaptive capacity, and uncertainty columns (if selected).

See Also

create_template_exposure, calc_exposure, calc_sensitivity

Examples

### Create a table for two state indicators and two pressures to evaluate direct
#   effects (default). Return a general sensitivity and adaptive capacity
#   column as well as uncertainty columns for both components:
ind <- c("seabirds", "seals")
press <- c("plastic pollution", "temperature increase")

sens_ac_tbl <- create_template_sensitivity(
  indicators = ind,
  pressures = press
)
# --> Export table and re-import after completion or fill in directly in R.

# Assign sensitivity scores from -5 (strong negative response to pressure)
# to +5 (strong positive response) (0 = no sensitivity):
sens_ac_tbl$sens_general <- c(-5,3,-4,4)

# Assign adaptive capacity scores from -1 (none) to +1 (good adaptive capacity):
sens_ac_tbl$ac_general <- c(-1,1,-1,1)

# Assign uncertainty scores from 1 (low) to 3 (high uncertainty):
sens_ac_tbl$uncertainty_sens <- c(1,2,1,1)
sens_ac_tbl$uncertainty_ac <- c(3,2,3,2)


### Create a table for four indicators and three pressures to evaluate both direct
#   and indirect effects. Return columns for five trait-specific sensitivities
#   and their respective uncertainties, but no adaptive capacity:
ind <- c("cod", "herring", "seabirds", "seals")
press <- c("fishing", "temperature increase", "salinity decrease")
sens_ac_tbl <- create_template_sensitivity(
  indicators = ind,
  pressures = press,
  type = c("direct", "direct_indirect"),
  n_sensitivity_traits = 5,
  adaptive_capacity = FALSE,
  uncertainty = TRUE,
  mode_uncertainty = "trait"
)
sens_ac_tbl
# --> You might want to rename the generic trait columns with specific traits.
# --> Export table as e.g. CSV-file and re-import again after completion.

### Create a mixed table for two indicators and two pressures, where for one
#   indicator sensitivity is scored overall and for one sensitivity is scored
#   by individual traits:
ind <- c("phytoplankton", "herring")
press <- c("temperature", "salinity")

sens_ac_tbl <- create_template_sensitivity(
  indicators = ind,
  pressures = press,
  n_sensitivity_traits = 4,
  adaptive_capacity = FALSE,
  uncertainty = TRUE,
  mode_uncertainty = "general"
)
# Rename trait columns:
names(sens_ac_tbl)[4:7] <- paste0("sens_",
  c("feeding", "behaviour", "reproduction", "general"))

# Give overall sensitivity score for phytoplankton
# (keep NAs for herring):
sens_ac_tbl$sens_general[1:2] <- c(-3,0)

# Give trait-specific sensitivity scores for herring
# (keep NAs for phytoplankton):
sens_ac_tbl$sens_feeding[3:4] <- c(0,0)
sens_ac_tbl$sens_behaviour[3:4] <- c(-1,0)
sens_ac_tbl$sens_reproduction[3:4] <- c(-2,-2)

# Give overall uncertainty score:
sens_ac_tbl$uncertainty_sens <- c(1,2,1,1)

Expert-based exposure scores for five pressures

Description

This Baltic Sea demo dataset contains expert-assigned scores for five environmental and anthropogenic pressures, detailing individual exposure components and their associated uncertainties. The dataset was initialized using the template function create_template_exposure.

Usage

ex_expert_exposure

Format

A data frame with 5 observations and 9 variables (values randomly assigned).

pressure

Environmental or anthropogenic pressure.

magnitude

Score for the magnitude pressure change.

frequency

Score for the frequency or duration of pressure effect.

trend

Score for the future trend of pressure.

spatial

Score for the spatial extent of pressure change.

uncertainty_magnitude

Uncertainty of magnitude score.

uncertainty_frequency

Uncertainty of frequency score.

uncertainty_trend

Uncertainty of trend score.

uncertainty_spatial

Uncertainty of spatial extent score.

Details

Exposure scores range from 1 (low) to 5 (high), while uncertainties range from 1 (low) to 3 (high). This dataset can be used as input for the function calc_exposure.


Expert-based sensitivity and adaptive capacity scores for four indicators and five pressures

Description

This demo dataset includes sensitivity and adaptive capacity scores for four Baltic Sea indicators and five pressures, initialized using create_template_sensitivity. Depending on the indicator, a general score or trait-specific scores were assigned. This dataset serves as input for calc_sensitivity.

Usage

ex_expert_sensitivity

Format

A data frame with 40 observations and 23 variables.

indicator

Name of assessed indicator.

pressure

Name of assessed pressure.

type

Effect type (direct, indirect, or direct + indirect).

sens_feeding

Sensitivity score for the feeding trait (-5 to 5).

sens_behaviour

Sensitivity score for the behaviour trait (-5 to 5).

sens_reproduction

Sensitivity score for the reproduction trait (-5 to 5).

sens_habitat

Sensitivity score for the habitat trait (-5 to 5)

sens_general

General sensitivity score (where trait-based scoring is not possible, -5 to 5).

ac_feeding

Adaptive capacity score for the feeding trait (-1 to 1).

ac_behaviour

Adaptive capacity score for the behaviour trait (-1 to 1).

ac_reproduction

Adaptive capacity score for the reproduction trait (-1 to 1).

ac_habitat

Adaptive capacity score for the habitat trait (-1 to 1).

ac_general

General adaptive capacity score (where trait-based scoring is not possible, -1 to 1).

uncertainty_sens_feeding

Uncertainty of sensitivity score for feeding trait (1 to 3).

uncertainty_sens_behaviour

Uncertainty of sensitivity score for behaviour trait (1 to 3).

uncertainty_sens_reproduction

Uncertainty of sensitivity score for reproduction trait (1 to 3).

uncertainty_sens_habitat

Uncertainty of sensitivity score for habitat trait (1 to 3).

uncertainty_sens_general

Uncertainty of general sensitivity score (1 to 3).

uncertainty_ac_feeding

Uncertainty of adaptive capacity score for feeding trait (1 to 3).

uncertainty_ac_behaviour

Uncertainty of adaptive capacity score for behaviour trait (1 to 3).

uncertainty_ac_reproduction

Uncertainty of adaptive capacity score for reproduction trait (1 to 3).

uncertainty_ac_habitat

Uncertainty of adaptive capacity score for habitat trait (1 to 3).

uncertainty_ac_general

Uncertainty of general adaptive capacity score (1 to 3).


Expert-based status scores for four indicators

Description

This demo dataset contains the status scores of four Baltic Sea indicators based on expert knowledge. The format is the same as the output table from the status function that evaluates the status based on time series.

Usage

ex_expert_status

Format

A data frame with 4 observations and 3 variables.

indicator

Name of the assessed indicator.

status

Current status of each indicator, either 'good' or 'undesired'.

score

Score for each status (+1 or -1), will be combined with the vulnerability to derive risk.


Example output from the aggregate_risk() function based on expert scores

Description

This is an expert-based example output from the aggregate_risk function applied to the ex_output_risk_expert demo data.

Usage

ex_output_aggregate_risk_expert

Format

A list of three data frames.

multi_indicator_risk

A data frame with 30 rows and 5 columns, containing the multi-indicator risk and uncertainty of each pressure per type and pathway.

multi_pressure_risk

A data frame with 24 rows and 5 columns, containing the multi-pressure risk and uncertainty on each indicator per type and pathway.

ecosystem_risk

A data frame with 6 rows and 4 columns, containing the aggregated ecosystem risk and uncertainty per type and pathway.


Example output from the aggregate_risk() function based on modelled scores

Description

This dataset provides example output from the aggregate_risk function, applied to the ex_output_risk_model demo data, following the modelling pathway.

Usage

ex_output_aggregate_risk_model

Format

A list of three data frames.

multi_indicator_risk

A data frame with 32 rows and 5 variables, containing the multi-indicator risk and uncertainty of each pressure per type and pathway.

multi_pressure_risk

A data frame with 8 rows and 5 variables, containing the multi-pressure risk and uncertainty on each indicator per type and pathway.

ecosystem_risk

A data frame with 4 rows and 4 variables, containing the aggregated ecosystem risk and uncertainty per type and pathway.


Example output from the calc_exposure() function

Description

This dataset provides an expert-based example output from the calc_exposure function applied to ex_expert_exposure demo data.

Usage

ex_output_calc_exposure

Format

A data frame with 5 observations and 3 variables.

pressure

Name of the assessed pressure.

exposure

Calculated combined score of all exposure components.

uncertainty

Calculated combined score of associated uncertainties.


Example output from the calc_sensitivity() function

Description

This is an expert-based example output from the calc_sensitivity function applied to the ex_expert_sensitivity demo data.

Usage

ex_output_calc_sensitivity

Format

A data frame with 40 observations and 18 variables.

indicator

Name of the assessed indicator.

pressure

Name of the assessed pressure.

type

Effect type (direct, indirect, or direct + indirect).

pathway

Pathway with which sensitivity has been assessed (expert- or model-based).

sensitivity

Combined sensitivity score.

adaptive_capacity

Combined adaptive capacity score.

uncertainty_sens

Combined score of the associated sensitivity uncertainties.

uncertainty_ac

Combined score of the associated adaptive capacity uncertainties.

sens_original.sens_feeding

Original sensitivity score for the feeding trait.

sens_original.sens_behaviour

Original sensitivity score for the behaviour trait.

sens_original.sens_reproduction

Original sensitivity score for the reproduction trait.

sens_original.sens_habitat

Original sensitivity score for the habitat trait.

sens_original.sens_general

Original general sensitivity score.

ac_original.ac_feeding

Original adaptive capacity score for the feeding trait.

ac_original.ac_behaviour

Original adaptive capacity score for the behaviour trait.

ac_original.ac_reproduction

Original adaptive capacity score for the reproduction trait.

ac_original.ac_habitat

Original adaptive capacity score for the habitat trait.

ac_original.ac_general

Original general adaptive capacity score.


Example output from the model_exposure() function based on time series

Description

This dataset provides example output from the model_exposure function, with component-specific exposure scores derived from the pressure time series in pressure_ts_baltic. These scores are combined into an overall exposure score, with associated uncertainties derived from two model types.

Usage

ex_output_model_exposure

Format

A data frame with 8 observations and 10 variables.

pressure

Names of the assessed pressure.

exposure

Combined exposure score (1 to 5).

uncertainty

Uncertainty score from exposure modelling (1 to 3).

comp_magnitude

Score for the magnitude or degree of change (1 to 5).

comp_frequency

Score for the frequency or duration of change (1 to 5).

comp_trend

Score for the current trend of change (1 to 5).

comp_direction

Direction of the trend slope (increase or decrease).

comp_spatial

Score for spatial extent of the pressure (default: 3; user-defined: 1 to 5).

uncertainty_arima

Uncertainty score based on an ARIMA model.

uncertainty_gam

Uncertainty score based on a GAM model.

mean_baseline

Mean of the baseline conditions, used for magnitude scoring.

mean_current

Mean of the current conditions, used for magnitude and frequency scoring.

standard_deviation_baseline

Standard deviations of the baseline conditions. Used for scoring of magnitude and frequency.

slope_linear_model

Slope of the linear model used for scoring the future trend and to determine the direction.

p_value_linear_model

P-value of the linear model, used to score the future trend.


Example output from the model_sensitivity() function based on time series

Description

This dataset provides example output from the model_sensitivity function, with sensitivity scores and associated uncertainties for each indicator-pressure combination. Scores are based on time series data from pressure_ts_baltic and indicator_ts_baltic.

Usage

ex_output_model_sensitivity

Format

A data frame with 16 observations and 12 variables.

indicator

Names of the assessed indicator.

pressure

Names of the assessed pressure.

type

Type of effect (always direct + indirect for modelling pathway).

pathway

Pathway used to assess sensitivity.

sensitivity

Overall sensitivity score (-5 to 5).

adaptive_capacity

Adaptive capacity score (default is 0).

uncertainty_sens

Uncertainty score associated with sensitivity assessment (1 to 3).

uncertainty_ac

Uncertainty score associated with adaptive capacity (1 to 3).

r_sq

R-squared values from the GAM model, used for scoring.

p_value

P-values from the GAM model, determining statistical significance.

edf

Effective degrees of freedom from the GAM model, used to adjust scores based on non-linearity risk.

uncertainty_gam

Uncertainty score for sensitivity based on predicted values from a GAM.

uncertainty_arima

Uncertainty score for sensitivity based on predicted values from an ARIMA using the pressure variable as external predictor.


Example output from the risk() function based on expert scores

Description

This is an expert-based example output from the risk function applied to the ex_output_vulnerability_expert and ex_expert_status demo datasets.

Usage

ex_output_risk_expert

Format

A data frame with 40 observations and 8 variables.

indicator

Name of the assessed indicator.

pressure

Name of the assessed pressure.

type

Effect type (direct, indirect, or direct + indirect).

pathway

Pathway used for the exposure and sensitivity assessment.

vulnerability

Vulnerability score.

status

Qualitative descriptor of the current status of the indicator.

risk

Risk score.

uncertainty

Uncertainty score, associated with the vulnerability component scoring.


Example output from the aggregate_risk() function based on modelled scores

Description

This dataset provides example output from the risk function, applied to the ex_output_vulnerability_model and ex_output_status demo datasets, following the modelling pathway.

Usage

ex_output_risk_model

Format

A data frame with 16 observations and 8 variables.

indicator

Name of the assessed indicator.

pressure

Name of the assessed pressure.

type

Type of effect (always direct + indirect for modelling pathway).

pathway

Pathway used for the exposure and sensitivity assessment.

vulnerability

Vulnerability score.

status

Qualitative descriptor of the current status of the indicator.

risk

Risk score.

uncertainty

Uncertainty score associated with the vulnerability component scoring.


Example output from the status() function

Description

This dataset provides example output from the status function, applied to four Baltic Sea indicator time series provided in indicator_ts_baltic.

Usage

ex_output_status

Format

A data frame with 2 rows and 3 variables.

indicator

Name of the assessed indicator.

status

Qualitative description of the current status compared to the threshold.

score

Score used in the risk function to calculate risk from vulnerability and status.


Example output from the vulnerability() function based on expert scores

Description

This dataset contains an expert-based example output from the vulnerability function applied to ex_output_calc_exposure and ex_output_calc_sensitivity demo datasets.

Usage

ex_output_vulnerability_expert

Format

A data frame with 40 observations and 6 variables.

indicator

Name of the assessed indicator.

pressure

Name of the assessed pressure.

type

Effect type (direct, indirect, or direct + indirect).

pathway

Pathway used for the exposure and sensitivity assessment.

vulnerability

Vulnerability score.

uncertainty

Uncertainty associated with the vulnerability score.


Example output from the vulnerability() function based on modelled scores

Description

This dataset provides example output from the vulnerability function, applied to the ex_output_model_exposure and ex_output_model_sensitivity demo datasets, following the modelling pathway.

Usage

ex_output_vulnerability_model

Format

A data frame with 16 observations and 6 variables.

indicator

Names of the assessed indicator.

pressure

Names of the assessed pressure.

type

Type of effect (always direct + indirect for modelling pathway).

pathway

Pathway used for the exposure and sensitivity assessment.

vulnerability

Vulnerability score for each pressure-indicator-type combination.

uncertainty

Uncertainty associated with the vulnerability score.


Baltic Sea indicator time series

Description

Time series of two marine indicators covering the period 1984–2016 in the Eastern Baltic Sea (data altered from original time series). This dataset serves as a demo input in the model_sensitivity and model_exposure functions.

Usage

indicator_ts_baltic

Format

A data frame with 33 observations and 3 variables.

year

Time variable.

zooplankton_mean_size

Mean size of zooplankton (in wet weight micrograms).

eastern_baltic_cod

Mean spawning stock biomass of eastern Baltic cod (units unspecified).


Model Overall Exposure Scores Using Time Series Data

Description

This function statistically evaluates the exposure to a pressure, based on time series data. The scoring is based on the paper of Gaichas et al., 2014: A risk-based approach to evaluating northeast US fish community vulnerability to climate change. The exposure scoring is split into four components: magnitude (or degree of change), frequency of change, the future trend of the pressure, and spatial scale. Uncertainty of the exposure assessment is evaluated using general additive models (GAM) and an autoregressive integrated moving average model (ARIMA).

Usage

model_exposure(
  pressure_time_series,
  base_years = NULL,
  base_years_by_press = NULL,
  current_years = NULL,
  current_years_by_press = NULL,
  trend = "return",
  spatial = 3
)

Arguments

pressure_time_series

A data frame (not a tibble object) with time series of pressures to be evaluated. First column MUST be the time column.

base_years

A vector with two numerics, specifying the time period for the baseline. The first one start is the starting year for all pressures and the second one end is the end of the baseline for all pressures. The default is NULL. One can specify pressure specific baseline periods using the base_years_by_press argument. If base_years and base_years_by_ind are NULL, then the first 5 years of the time series are used as baseline period.

base_years_by_press

A data frame, specifying the baseline years for each pressure individually, by setting the starting year (second column) and the end year (third column). The first column must contain the names of the pressure indicators used in pressure_time_series. The default is NULL. If base_years and base_years_by_press are NULL, then the first 5 years of the time series are used as baseline period.

current_years

A vector with two numerics, specifying the time period for the assessment period. The first one start is the starting year for all pressures and the second one end is the end of the assessment period for all pressures. The default is NULL. One can specify pressure specific assessment periods using the current_years_by_press argument. If current_years and current_years_by_press are NULL, then the last 5 years of the time series are used as assessment period.

current_years_by_press

A data frame, specifying the assessment period for each pressure individually, by setting the starting year (second column) and the end year (third column). The first column must contain the names of the pressure indicators used in pressure_time_series. The default is NULL. If current_years and current_years_by_press are NULL, then the last 5 years of the time series are used as assessment period.

trend

a character vector specifying whether a trend returning to the baseline conditions should be considered as good or a trend further leaving the baseline conditions. Possible inputs are return or leave.Default is not specified is return, meaning a return to the baseline is desired.

spatial

a vector with scores for the spatial scale of each pressure. The default is 3 for each pressure, meaning that 40 - 60% of the entire assessment area is affected. Scores should be on a scale from 1 - 5, depending on the percent of area that is affected by the pressure:

  • 1: < 20%,

  • 2: 20 - 40%,

  • 3: 40 - 60%,

  • 4: 60 - 80%,

  • 5: > 80%.

Details

All components are scored on a scale from 1 - 5, low impact to high impact. The degree of change compares the mean of the current time period to the baseline time period, the score is based on standard deviations. The frequency evaluates in how much percent of the current time period the mean deviates more than one standard deviation from the baseline mean. The future trend scores if the pressure will in the future be in desired conditions or not. Usually this means the pressure returns to the baseline conditions. The overall exposure score is the mean of all four components. Uncertainty of exposure is evaluated using a general additive model and an autoregressive integrated moving average model (ARIMA). The models are fitted using the time series except the assessment period. The assessment period is then predicted. The function evaluates how many of the observed data points are within the predicted 95% confidence interval. If more than 66 % are within the 95% CI the uncertainty is 1 (low), if less than 33 % are within it, the uncertainty is set to 3 (high). Additionally the function compares the mean size of the predicted 95% confidence interval and compares it to the maximum range of the observed data points to account for very large confidence intervals, which would otherwise lead to too optimistic uncertainty scores. The lower uncertainty score is selected as final uncertainty score. The time periods of baseline and assessment period have to be carefully set to reflect ongoing dynamics. Especially for oscillating pressures time periods should be longer to assess the overall trend and not the oscillation itself.

Value

a data frame containing the pressure names, the aggregated exposure score and scores for magnitude, frequency, future trend and spatial scale of the pressures, the final uncertainty score and uncertainty scores of the ARIMA and the GAM. If default settings are used, the following data frame will be returned:

pressure

Name of the assessed pressure.

exposure

Exposure score, mean of the four assessed exposure components.

uncertainty

Uncertainty score associated with the exposure assessment.

comp_magnitude

Score for the magnitude of change.

comp_frequency

Score for the frequency of a significant deviation from baseline conditions.

comp_trend

Score for the future trend of the pressure.

comp_direction

Direction of the development of the pressure in the assessment period.

comp_spatial

Score for the spatial scale, either set by the user or automatically set to 3.

uncertainty_arima

Uncertainty score based on the ARIMA model.

uncertainty_gam

Uncertainty based on the GAM.

mean_baseline

Mean of the baseline conditions, used for magnitude scoring.

mean_current

Mean of the current conditions, used for magnitude and frequency scoring.

standard_deviation_baseline

Standard deviations of the baseline conditions. Used for scoring of magnitude and frequency.

slope_linear_model

Slope of the linear model used for scoring the future trend and to determine the direction.

p_value_linear_model

P-value of the linear model, used to score the future trend.

See Also

model_sensitivity, vulnerability

Examples

### Example with 3 pressure time series in the demo data 'pressure_ts_baltic'
#   where the first 11 years represent the general baseline period and the last
#   7 years of the time series the current assessment period:
sub_ts <- pressure_ts_baltic[ ,c("year", "surf_temp_sum", 
  "surf_sal_sum", "bot_oxy_ann")]
model_exposure(
  pressure_time_series = sub_ts ,
  base_years = c(start = 1984, end = 1994),
  current_years = c(start = 2010, end = 2016)
)

### Example with 2 pressure time series and pressure-specific periods
sub_ts <- pressure_ts_baltic[ ,c("year", "nitrogen", "phosphorous")]
model_exposure(
  pressure_time_series = sub_ts,
  base_years_by_press = data.frame(
    press = c("nitrogen", "phosphorous"),
    start = c(1984, 1990), end = c(1994, 2000)),
  current_years_by_press = data.frame(
      press = c("nitrogen", "phosphorous"),
      start = c(2010, 2012), end = c(2016, 2016))
)

Model Overall Sensitivity Scores Using Time Series Data

Description

The function model_sensitivity() uses time series of a state indicator and a pressure variable to assess the state indicators sensitivity towards the pressure. The relationship between pressure and state indicator is determined using a generalized additive model (GAM). Uncertainty is evaluated with a GAM and an ARIMA model.

Usage

model_sensitivity(
  indicator_time_series,
  pressure_time_series,
  current_years = NULL,
  current_years_by_ind_press = NULL
)

Arguments

indicator_time_series

a data frame containing only the state indicator time series. First column MUST be the time column.

pressure_time_series

a data frame containing only the pressure variables. First column MUST be the time column.

current_years

A vector with two numerics, specifying the time period for the assessment period. The first one start is the starting year for all pressure-indicator pairs and the second one end is the end of the assessment period for all pressure-indicator pairs. The default is NULL. One can specify pair specific assessment periods using the current_years_by_ind_press argument. If current_years and current_years_by_ind_press are NULL, then the last 5 years of the time series are used as assessment period.

current_years_by_ind_press

a data frame specifying for each indicator-pressure pair the starting (third column) and end year (fourth column) where the current conditions are best reflected. The default is NULL. If current_years and current_years_by_ind_press are NULL, then the last 5 years of the time series are used as assessment period.

Details

In case the relationship of one state indicator - pressure pair is not significant the sensitivity score is 0, and thus also vulnerability and risk will be 0. For a significant relationship the score will be set based on the R-squared value from 1 (R-squared < 0.2) to 5 (R-squared >= 0.8). Additionally, the function evaluates the edf score of the GAM which indicates the degree of non-linearity in the relationship. Since highly non-linear relationships are harder to predict, the risk of reaching an undesired state increases and the sensitivity score for nonlinear relationships will be increased by 1 (if it was not 5 already). The direction of an effect (negative influence or positive influence of the pressure) is evaluated with the slope of a linear model representing the assessment period. If the slope of the linear model is negative, the direction of effect is considered negative as well, and vice versa for the positive effect. The function assesses uncertainty associated with the scoring based on a general additive model and an autoregressive integrated moving average model (ARIMA). The ARIMA model uses the pressure variable as additional external predictor. The models are fitted using the time series except the assessment period. The assessment period is then predicted. The function evaluates how many of the observed data points are within the predicted 95% confidence interval. If more than 66 % are within the 95% CI the uncertainty is 1 (low), if less than 33 % are within it, the uncertainty is set to 3 (high). Additionally the function compares the mean size of the predicted 95% confidence interval and compares it to the maximum range of the observed data points to account for very large confidence intervals, which would otherwise lead to too optimistic uncertainty scores. The lower uncertainty score is selected as final uncertainty score.

The function also creates columns to give the opportunity to assess adaptive capacity and its associated uncertainty for each state indicator-pressure pair. The scores for adaptive capacity and its associated uncertainty must be specified before the next function vulnerability is applied (see examples). If adaptive capacity and its uncertainty are not further specified, this will influence the further application of the ecorisk framework.

Value

a data frame containing indicator, pressure, type of effect, the sensitivity score and the associated uncertainty. Positive sensitivity scores are associated with a positive influence of the pressure on the indicator and vice versa. Additionally the R-squared, p-values, edf scores and the mean confidence interval percentage, which are the basis of the scoring, are provided. The type of effect is automatically set todirect_indirect as the model cannot distinguish between direct and indirect effects. If default settings are used, the following data frame will be returned:

indicator

Name of the assessed state indicator.

pressure

Name of the assessed pressure.

type

Type of the assessed effect.

pathway

The pathway that has been used to derive the sensitivity scores.

sensitivity

Sensitivity score for the assessed state indicator- pressure pair.

adaptive_capacity

Adaptive capacity score for the assessed state indicator-pressure pair, is automatically set to 0 and can be changed afterwards.

uncertainty_sens

uncertainty score associated with the sensitivity scoring.

uncertainty_ac

uncertainty score for adaptive capacity scoring. Automatically set to NA, can be changed afterwards.

r_sq

R-squared value of the GAM, used for the sensitivity scoring.

p_value

P-value of the GAM, used to identify significant relationships. Unsignificant relationships get a sensitivity score of 0.

edf

Estimated degrees of freedom, used to assess non-linearity of the relationship between state indicator and pressure.

uncertainty_gam

Uncertainty score for sensitivity based on predicted values from a GAM.

uncertainty_arima

Uncertainty score for sensitivity based on predicted values from an ARIMA using the pressure variable as external predictor.

See Also

model_exposure, vulnerability

Examples

### Example with the 2 indicators and 8 pressure time series in the Baltic Sea demo data
#   where the last 7 years of the time series represent the current assessment period:
model_sensitivity(
  indicator_time_series = indicator_ts_baltic,
  pressure_time_series = pressure_ts_baltic,
  current_years = c(start = 2010, end = 2016)
)

### Example with the demo data but indicator-pressure-specific assessment periods:
sens_tbl <- model_sensitivity(
  indicator_time_series = indicator_ts_baltic,
  pressure_time_series = pressure_ts_baltic,
  current_years_by_ind_press = data.frame(
    ind = rep(names(indicator_ts_baltic)[-1], each = 8),
    press = rep(names(pressure_ts_baltic)[-1], 2),
    start = c(rep(2010, 8), rep(2008, 8)),
    end = c(rep(2016, 8), rep(2015, 8))
  )
)
# add the associated uncertainty (from 1 to 3, default is NA)
sens_tbl$adaptive_capacity <- c(0,0,1,1,1,1,-1,-1, -1,-1,1,1,1,1,1,-1)
sens_tbl$uncertainty_ac <- c(2,2,1,1,1,1,2,1, 3,3,1,1,2,2,3,1)
sens_tbl

Generate a Heatmap Overview of Individual Risk Scores, Aggregated Risk Scores, and Overall Ecosystem Risk

Description

The function plot_heatmap() creates for each effect type an aggregated plot with a heatmap of the risk scores of each state indicator - pressure combination. The aggregated multi pressure and multi state indicator scores are shown to the left and below the heatmap. In the bottom left corner the ecosystem risk is displayed. Uncertainty can be plotted as frame of the heatmap tiles on a gray scale.

Usage

plot_heatmap(
  risk_scores,
  aggregated_scores,
  order_ind = NULL,
  order_press = NULL,
  pathway = "combined",
  uncertainty = TRUE,
  output_2_pathway_indicators = NULL,
  title = NULL,
  risk_scale_steps = 1,
  text_size_axis_text = NULL,
  text_size_axis_title = NULL
)

Arguments

risk_scores

output from the risk function.

aggregated_scores

output from the aggregate_risk function.

order_ind

character value defining the order of state indicators shown on the y-axis from top to bottom. If NULL (default), order is alphabetic.

order_press

character value defining the order of pressures shown on the x-axis from left to right. If NULL (default), order is alphabetic.

pathway

a character string specifying the pathway which should be used for the multi pressure and multi indicator scores. Default is "combined".

uncertainty

logical, determines whether uncertainty should be plotted or not, if uncertainty scores are provided by the risk scores. Default is TRUE.

output_2_pathway_indicators

Optionally. An integer value specifying whether for those state indicators that have been assessed with both pathways two plots should generated, one for each pathway (2), or only one plot, where the risk scores are averaged from both pathways (1). The default is NULL.

title

a string specifying the title of the heatmap. If NULL (default), the type of the output data frame from the risk function is displayed.

risk_scale_steps

integer value representing the step size for the risk scale in the legend. Can only take the value 1 (default), 2 and 5.

text_size_axis_text

integer value specifying text size of axis text. If NULL (default), ggplot2 default settings are used.

text_size_axis_title

integer value specifying text size of axis title. If NULL (default), ggplot2 default settings are used.

Value

a list of ggplot objects, one for each type of effect.

See Also

risk, aggregate_risk to generate result tables/output that serve here as input.

Examples

### Demo with output data from the risk() and aggregate_risk() functions
#   based on expert scores.

# Using default settings for the overall risk scores and associated uncertainty
# scores (i.e. in this case, combined across both types)
p_heat <- plot_heatmap(
  risk_scores = ex_output_risk_expert,
  aggregated_scores = ex_output_aggregate_risk_expert
)
# For each type in both input datasets, a heatmap is generated
p_heat[[1]] # display direct effects
p_heat[[2]] # display direct/indirect effects

# Hide uncertainty results and order indicators and pressures manually

  p_heat_mod <- plot_heatmap(
    risk_scores = ex_output_risk_expert,
    aggregated_scores = ex_output_aggregate_risk_expert,
    order_ind = c("phytoplankton", "herring", "cod", "seabirds"),
    order_press = c("temperature", "salinity", "oxygen", "nutrient",
      "fishing"),
    uncertainty = FALSE
  )
  p_heat_mod[[1]]



### Demo with combined expert-based and model-based pathways

combined_risk <- rbind(ex_output_risk_expert, ex_output_risk_model)
aggr_risk <- aggregate_risk(risk_results = combined_risk)

# Default settings (combined type and pathway)
p_heat_comb <- plot_heatmap(
  risk_scores = combined_risk,
  aggregated_scores = aggr_risk
)
p_heat_comb[[1]]


### Demo with two indicators assessed with both pathways
risk_model <- ex_output_risk_model[c(1, 3, 5, 7, 8, 9, 12, 14:16), ]
risk_model$pressure <- c(
 "nutrient", "temperature", "salinity", "oxygen", "fishing",   # for zooplankton
 "nutrient", "temperature", "salinity", "oxygen", "fishing")   # for cod

dummy_model <- risk_model |>
 dplyr::mutate(indicator = dplyr::case_when(
   indicator == "zooplankton_mean_size" ~ "phytoplankton",
   .default = "cod"
 ))

risk_comb <- rbind(ex_output_risk_expert, dummy_model)
aggr_risk_comb <- aggregate_risk(risk_results = risk_comb)

# show results from both types and pathways individually and order the state
# indicators manually
p_heat_2_paths <- plot_heatmap(risk_scores = risk_comb,
                       aggregated_scores = aggr_risk_comb,
                       output_2_pathway_indicators = 2,
                       order_ind = c("phytoplankton", "herring", "cod", "seabirds"))
p_heat_2_paths

# show one plot per type and average across the pathways
p_heat_mean_path <- plot_heatmap(risk_scores = risk_comb,
                       aggregated_scores = aggr_risk_comb,
                       output_2_pathway_indicators = 1,
                       order_ind = c("phytoplankton", "herring", "cod", "seabirds"))
p_heat_mean_path

Generate Radar Charts Displaying Pressure-Specific and Overall Risks for Each State Indicator

Description

The plot_radar()function creates per indicator a ggplot object. The plot shows the risks of all types and effect directions. The associated uncertainty can optionally be displayed. In the middle the plot displays the multi pressure score of a chosen effect type.

Usage

plot_radar(
  risk_scores,
  aggregated_scores,
  type = "combined",
  pathway = "combined"
)

Arguments

risk_scores

output from the risk function.

aggregated_scores

output from the aggregate_risk function.

type

character string, type used for the multi-pressure score, can be any type that has been evaluated. The default is combined.

pathway

character string specifying the multi-pressure score, should be plotted for each pathway individual individual or as a combined score combined. The default is combined.

Value

a list of ggplot2 objects one for each indicator, the order depends on the order in the risk_score data set. Each plot shows the risks for one state indicator for each pressure and type of assessment. In the center of the plot the multi-pressure score (either in blue or in red) and the associated aggregated uncertainty (in black) is shown. If one indicator has been assessed with both pathways, one plot is generated for each of the pathways. The uncertainty of each individual risk is shown as a ring around the risks in grey.

See Also

risk, aggregate_risk to generate result tables/output that serve here as input

Examples

### Demo with output data from the risk() and aggregate_risk() functions
#   based on expert scores

# Using default settings for the indicator-specific overall risk score (coloured value)
# and associated uncertainty score (black value) (i.e., combined across both types)
p_radar <- plot_radar(
  risk_scores = ex_output_risk_expert,
  aggregated_scores = ex_output_aggregate_risk_expert
)
p_radar[[1]] # display radar chart for first indicator

# Show overall risk score based on direct effects only
p_radar_direct <- plot_radar(
  risk_scores = ex_output_risk_expert,
  aggregated_scores = ex_output_aggregate_risk_expert,
  type = "direct"
)
p_radar_direct[[1]]


### Demo with combined expert-based and model-based pathways

combined_risk <- rbind(ex_output_risk_expert, ex_output_risk_model)
aggr_risk <- aggregate_risk(risk_results = combined_risk)

# Default settings (combined type and pathway)
p_radar_comb <- plot_radar(
  risk_scores = combined_risk,
  aggregated_scores = aggr_risk
)
p_radar_comb[[1]]

# Show overall risk score based on direct/indirect effects only for both
# pathways combined
p_radar_comb_dindi <- plot_radar(
  risk_scores = ex_output_risk_expert,
  aggregated_scores = ex_output_aggregate_risk_expert,
  type = "direct_indirect"
)
p_radar_comb_dindi[[1]]

Baltic Sea pressure time series

Description

Time series of eight environmental and anthropogenic pressures potentially affecting the zooplankton mean size or cod spawning stock biomass in the Eastern Baltic Sea. The time series cover the period 1984–2016 (data altered from original time series). This dataset serves as a demo input in the model_exposure and model_sensitivity functions.

Usage

pressure_ts_baltic

Format

A data frame with 33 observations and 9 variables.

year

Time variable.

nitrogen

Mean total nitrogen input into the Baltic Sea per year.

phosphorous

Mean total phosphorus input into the Baltic Sea per year.

surf_temp_sum

Mean sea surface temperature in summer in the Baltic Sea per year (in °C).

bot_temp_ann

Mean sea bottom temperature in the Baltic Sea per year (in °C).

surf_sal_sum

Mean sea surface salinity in summer in the Baltic Sea per year.

bot_sal_ann

Mean sea bottom salinity in the Baltic Sea per year.

bot_oxy_ann

Mean bottom oxygen concentration in the Baltic Sea per year (in mg/m^3).

fishing_cod

Mean eastern Baltic cod fishing pressure per year.


North Sea pressure time series

Description

Time series of three environmental and anthropogenic pressures in the North Sea covering the period 1970–2020 (data altered from original time series). This dataset serves as internal test data.

Usage

pressure_ts_northsea

Format

A data frame with 33 observations and 9 variables.

year

Time variable.

bot_temp

Mean sea bottom temperature in the Baltic Sea per year (in °C).

bot_sal

Mean sea bottom salinity in the Baltic Sea per year.

fishing_cod

Mean eastern Baltic cod fishing pressure per year.


Calculate Risk Scores Using Expert-Based or Model-Derived Vulnerability and Status Scores

Description

The risk function calculates risk scores using the output from of the status and the vulnerability functions. For each state indicator-pressure combination the function adds the status score to the vulnerability score to derive the risk score.

Usage

risk(vulnerability_results, status_results)

Arguments

vulnerability_results

A data frame with the output from the vulnerability function.

status_results

A data frame with status scores for each state indicator. The first column MUST contain the indicator names. The second and third column have to be named status and score.

Details

Final risk scores are in a range from -10 (severe risk for the state indicator due to the assessed pressure) to +10 (good opportunities for the state indicator due to the assessed pressure). The risk scores are specific for each combination of state indicator and pressure and do NOT take into account cumulative effects. The risk scores can be aggregated in an additive manner with the aggregate_risk function.

Value

a data frame containing the exposure, sensitivity, adaptive capacity, vulnerability, and risk scores as well as their associated uncertainty for each pressure - state indicator - type combination.

See Also

vulnerability, status, aggregate_risk

Examples

# Using demo output data from the vulnerability() and status() functions:
risk(
  vulnerability_results = ex_output_vulnerability_model,
  status_results = ex_output_status
)


  ### Demo Expert-Based Pathway
  # - using the example scoring datasets 'ex_expert_exposure',
  #   'ex_expert_sensitivity' and 'ex_expert_status'

  # Calculate (mean) exposure score:
  exp_expert <- calc_exposure(
    pressures = ex_expert_exposure$pressure,
    components = ex_expert_exposure[ ,2:5],
    uncertainty = ex_expert_exposure[ ,6:9],
    method = "mean" # default
  )
  # Calculate (mean) sensitivity (and adaptive capacity) score:
  sens_ac_expert <- calc_sensitivity(
    indicators = ex_expert_sensitivity$indicator,
    pressures = ex_expert_sensitivity$pressure,
    type = ex_expert_sensitivity$type,
    sensitivity_traits = ex_expert_sensitivity[ ,4:8],
    adaptive_capacities = ex_expert_sensitivity[ ,9:13],
    uncertainty_sens = ex_expert_sensitivity[ ,14:18],
    uncertainty_ac = ex_expert_sensitivity[ ,19:23],
    method = "mean" # default
  )
  # Calculate (mean) vulnerability score:
  vuln_expert <- vulnerability(
    exposure_results = exp_expert,
    sensitivity_results = sens_ac_expert,
    method_vulnerability = "mean", # default
    method_uncertainty = "mean" # default
  )
  # Calculate risk score:
  risk(
    vulnerability_results = vuln_expert,
    status_results = ex_expert_status
  )


  ### Demo Model-Based Pathway
  # - using the demo time series 'pressure_ts_baltic' and 'indicator_ts_baltic'

  # Model exposure score:
  exp_model <- model_exposure(
    pressure_time_series = pressure_ts_baltic,
    base_years = c(start = 1984, end = 1994),
    current_years = c(start = 2010, end = 2016)
  )

  # Model sensitivity score:
  sens_ac_model <- model_sensitivity(
    indicator_time_series = indicator_ts_baltic,
    pressure_time_series = pressure_ts_baltic,
    current_years = c(start = 2010, end = 2016)
  )
  # Add manually adaptive capacity scores (otherwise zero):
  sens_ac_model$adaptive_capacity <- c(rep(1, 8), rep(-1, 8))

  # Calculate (mean) vulnerability score:
  vuln_model <- vulnerability(
    exposure_results = exp_model,
    sensitivity_results = sens_ac_model
  )
  # Calculate status score:
  status_model <- status(
    indicator_time_series = indicator_ts_baltic,
    base_years = c(start = 1984, end = 2010),
    current_years = c(start = 2011, end = 2016)
  )
  # Calculate risk score:
  risk(
    vulnerability_results = vuln_model,
    status_results = status_model
  )



Compute Status Scores from Time Series Data

Description

The status function assesses whether a state indicator is in a desired or undesired status during the assessment time period. For this the function compares the current conditions to the baseline conditions. The user specifies whether the mean of the current conditions should be within or outside of a specific deviation from the baseline mean.

Usage

status(
  indicator_time_series,
  base_years = NULL,
  base_years_by_ind = NULL,
  current_years = NULL,
  current_years_by_ind = NULL,
  range = "sd",
  sign = "+",
  condition = ">"
)

Arguments

indicator_time_series

A data frame with time series per state indicator. The first column MUST be the time column.

base_years

A vector with two numerics, specifying the time period for the baseline. The first one start is the starting year for all state indicators and the second one end is the end of the baseline for all state indicators. The default is NULL. One can specify indicator specific baseline periods using the base_years_by_ind argument. If base_years and base_years_by_ind are NULL, then the first 5 years of the time series are used as baseline period.

base_years_by_ind

A data frame, specifying the baseline years for each state indicator individually, by setting the starting year (second column) and the end year (third column). The first column must contain the names of the state indicators used in indicator_time_series. The default is NULL. If base_years and base_years_by_ind are NULL, then the first 5 years of the time series are used as baseline period.

current_years

A vector with two numerics, specifying the time period for the assessment period. The first one start is the starting year for all state indicators and the second one end is the end of the assessment period for all state indicators. The default is NULL. One can specify indicator specific assessment periods using the current_years_by_ind argument. If current_years and current_years_by_ind are NULL, then the last 5 years of the time series are used as baseline period.

current_years_by_ind

A data frame, specifying the assessment period years for each state indicator individually, by setting the starting year (second column) and the end year (third column). The first column must contain the names of the state indicators used in indicator_time_series. The default is NULL. If current_years and current_years_by_ind are NULL, then the last 5 years of the time series are used as assessment period.

range

A vector specifying the allowed deviance from the baseline mean. Can be sd, 2sd, 95percentile or an integer between 1 and 99 to evaluate the nth percentile. If the current mean should be compared to the baseline mean without any deviance, please set range = mean_only, leave the default for the sign parameter and specify the condition parameter if necessary. Default is sd.

sign

A character vector containing + or -, specifying whether the upper or the lower part of the deviance should be analyzed. Default is +.

condition

A character vector containing < or > specifying whether the current indicator should be above (>) or below (<) the preset threshold range to be in a desired status. The default is >.

Details

With range, sign and condition one defines good status for the state indicators. By default the function evaluates whether the current mean is above +1 standard deviation, if yes the status will be set to desired. If the state should be within a range of ± standard deviation and not below that, then the arguments sign and condition must be set to '-' and '>', this specifies that the current mean must be higher than the mean of the baseline period - 1 standard deviation to be considered as good status.

Value

a data frame containing the indicator name its status and the associated score, which will be added to the indicators vulnerability to derive the risk.

See Also

model_exposure, model_sensitivity, vulnerability, risk

Examples

### Demo with the internal dataset 'indicator_ts_baltic'

# Define a general baseline and current assessment period:
status(
 indicator_time_series = indicator_ts_baltic,
 base_years = c(start = 1984, end = 2010),
 current_years = c(start = 2011, end = 2016)
)

# Define indicator-specific baseline and current assessment periods:
status(
 indicator_time_series = indicator_ts_baltic,
 base_years_by_ind = data.frame(
   ind =c("zooplankton_mean_size", "eastern_baltic_cod"),
   start = c(1984, 1990), end = c(2010, 2010)
 ),
 current_years_by_ind = data.frame(
   ind =c("zooplankton_mean_size", "eastern_baltic_cod"),
   start = c(2011, 2012), end = c(2016, 2016)
 )
)

Calculate Vulnerability Scores Using Expert-Based or Model-Derived Overall Exposure and Sensitivity (Including Adaptive Capacity) Scores

Description

This function calculates the state indicator ~ pressures ~ type specific vulnerability, from exposure scores and sensitivity scores. The function can either be used with the output from calc_exposure or model_exposure and calc_sensitivity or model_sensitivity.

Usage

vulnerability(
  exposure_results,
  sensitivity_results,
  method_vulnerability = "mean",
  method_uncertainty = "mean"
)

Arguments

exposure_results

a data frame containing the output from calc_exposure or model_exposure.

sensitivity_results

a data frame containing the output from calc_sensitivity or model_sensitivity.

method_vulnerability

a character string specifying the method for aggregating the trait based vulnerabilities, available are mean (default), median, maximum, and minimum.

method_uncertainty

a character string specifying the method for the aggregation of the uncertainty scores from exposure and sensitivity. Available are mean (default), median, maximum, and minimum.

Details

For expert scores the following equation is applied

or in case of negative sensitivity values:

Trait based sensitivity and adaptive capacity scores will be assessed individually and then aggregated to one vulnerability score per state indicator and pressure combination. The aggregation method can be chosen with the method_vulnerability argument. For modelling scores sensitivity and exposure scores are summed up. If the exposure trend and the sensitivity score have the same direction, e.g. a decreasing trend in exposure and a negative sensitivity score, then the vulnerability effect is assigned as positive. If they have opposing directions, e.g. an increasing exposure, while sensitivity is negative, then the vulnerability is negative. Vulnerability scores can range only from -10 to 10, aligning with the ecorisk framework.

Value

a data frame containing state indicator, pressure, type and the vulnerability and associated uncertainty score.

See Also

calc_exposure, calc_sensitivity, model_exposure, model_sensitivity, status, risk

Examples

# Using demo output data from the calc_exposure() and calc_sensitivity()
# functions:
vulnerability(
  exposure_results = ex_output_calc_exposure,
  sensitivity_results = ex_output_calc_sensitivity
)


  ### Demo Expert-Based Pathway
  # - using the example scoring datasets 'ex_expert_exposure',
  #   and 'ex_expert_sensitivity'

  # Calculate (mean) exposure score:
  exp_expert <- calc_exposure(
    pressures = ex_expert_exposure$pressure,
    components = ex_expert_exposure[ ,2:5],
    uncertainty = ex_expert_exposure[ ,6:9],
    method = "mean" # default
  )
  # Calculate (mean) sensitivity (and adaptive capacity) score:
  sens_ac_expert <- calc_sensitivity(
    indicators = ex_expert_sensitivity$indicator,
    pressures = ex_expert_sensitivity$pressure,
    type = ex_expert_sensitivity$type,
    sensitivity_traits = ex_expert_sensitivity[ ,4:8],
    adaptive_capacities = ex_expert_sensitivity[ ,9:13],
    uncertainty_sens = ex_expert_sensitivity[ ,14:18],
    uncertainty_ac = ex_expert_sensitivity[ ,19:23],
    method = "mean"
  )
  # Calculate vulnerability using the mean (default):
  vulnerability(
    exposure_results = exp_expert,
    sensitivity_results = sens_ac_expert
  )
  # Calculate vulnerability using the median and maximum:
  vulnerability(
    exposure_results = exp_expert,
    sensitivity_results = sens_ac_expert,
    method_vulnerability = "median",
    method_uncertainty = "maximum"
  )


  ### Demo Model-Based Pathway
  # - using the demo time series 'pressure_ts_baltic' and 'indicator_ts_baltic'

  # Model exposure score:
  exp_model <- model_exposure(
    pressure_time_series = pressure_ts_baltic,
    base_years = c(start = 1984, end = 1994),
    current_years = c(start = 2010, end = 2016)
  )

  # Model sensitivity score:
  sens_ac_model <- model_sensitivity(
    indicator_time_series = indicator_ts_baltic,
    pressure_time_series = pressure_ts_baltic,
    current_years = c(start = 2010, end = 2016)
  )
  # Add manually adaptive capacity scores (otherwise zero):
  sens_ac_model$adaptive_capacity <- c(rep(1, 8), rep(-1, 8))

  # Calculate vulnerability using the mean (default):
  vulnerability(
    exposure_results = exp_model,
    sensitivity_results = sens_ac_model
  )