trend_assessment: Assess trends for indicator

View source: R/trend_assessment.r

trend_assessmentR Documentation

Assess trends for indicator

Description

This assessment covers both the indicator and the constituent species. An assessment is made of the indicator over the time period given, examining whether the initial indicator value falls within the credible interval of the final year. Over the same time period the change in each species is assessed and reported.

Usage

trend_assessment(
  dat,
  method = "lambda",
  start_year = NULL,
  end_year = NULL,
  species_stat = "mean"
)

Arguments

dat

An object returned by lambda_interpolation or bma

method

Which indicator method was used to produce the data. One of "lambda" or "bma".

start_year

(Optional) a numeric value, defaults to the first year

end_year

(Optional) a numeric value, defaults to the last year

species_stat

(Optional) character, the statistic used to average across a species yearly change values to arrive at a single value per species. This can be either 'mean' (default) or 'median'.

Value

Returns a list of two elements, a summary of the species and indicator assessments. A plot of the species assessment is returned to the device.

Examples

### Running from an array ####
set.seed(123)
# number of species
nsp = 50

# number of years
nyr = 40

#number of iterations
iter = 500

# Build a random set of data
myArray <- array(data = rnorm(n = nsp*nyr*iter,
                              mean = 0.5,
                              sd = 0.1),
                 dim = c(nsp, nyr, iter),
                 dimnames = list(paste0('SP',1:nsp),
                                 1:nyr,
                                 1:iter))

# Ensure values are bounded by 0 and 1
myArray[myArray > 1] <- 1
myArray[myArray < 0] <- 0

# Run the lambda_indicator method on this data                
myIndicator <- lambda_indicator(myArray)

# Plot the trend stack
trend_assessment(myIndicator)

BiologicalRecordsCentre/BRCindicators documentation built on April 22, 2024, 2:32 p.m.