CompositeTrend: CompositeTrend function

View source: R/CompositeTrend.r

CompositeTrendR Documentation

CompositeTrend function

Description

This function can be used to produce composite metrics of change (indicators), whilst propagating uncertainty in the individual species trend estimates through to the final composite trend metric. This function takes in a dataframe of sampled annual occupancy estimates across multiple species and returns a a single composite trend metric with uncertainty. This approach is only suitable for species without missing years.

Usage

CompositeTrend(
  indata,
  output_path,
  trend_choice = "arithmetic_logit_occ",
  group_name,
  save_iterations = "yes",
  TrendScale = NULL,
  plot_output = TRUE
)

Arguments

indata

The file path to an .rdata file containing a dataframe (called samp_post - GP to change this) which contains year columns (prefixed with "X", e.g "X1985"), a species column ("spp"), and an iteration identifier ("iter"). The year columns contain the annual occupancy estimates for the species-year-iteration combination in question.

output_path

The location where the outputs should be saved.

trend_choice

The approach used to combine the individual species estimates into a single composite trend. See details.

group_name

The name of the species group we are running, used for naming output files.

save_iterations

Do we want to save the composite trend estimates for each individual iteration, these are generally used for estimating temporal trends with uncertainty.

TrendScale

Traditionally some indicators are scaled so the first year is set to a given number, 100 in the case of the UK biodiversity indicators. This value can be chosen here, with no scaling as the default.

plot_output

plot the resulting composite indicator: TRUE or FALSE.

  • "arithmetic_logit_occ" - The raw occupancy values are converted to the log odds scale (using the logit function). The arithmetic mean across species is used to create a composite trend for each iteration. These means are then converted back to the odds scale (exp)

  • "geometric_raw_occ" - Take the geometric mean across species raw occupancy estimates

  • "arithmetic_raw_occ" - potentially drop this, as not used.

Value

A summary file. This .csv is saved in the output_path location and contains the annual composite indicator estimate (summarized across the iterations as wither the mean or median). The unique number of species contributing to the indicator is shown in the "spp_num" column. Various forms of uncertainty (estimated across the iterations) for the annual composite trend are presented, including the upper and lower 95


BiologicalRecordsCentre/BRCindicators documentation built on Jan. 31, 2024, midnight