performance: Compute performance statistics

performanceR Documentation

Compute performance statistics

Description

TODO

Usage

## S4 method for signature 'FLQuants'
performance(
  x,
  statistics,
  refpts = FLPar(),
  years = setNames(list(dimnames(x[[1]])$year), nm = dims(x[[1]])$maxyear),
  probs = c(0.1, 0.25, 0.5, 0.75, 0.9),
  mp = NULL
)

## S4 method for signature 'FLStock'
performance(
  x,
  statistics,
  refpts = FLPar(),
  years = as.character(seq(dims(x)$minyear, dims(x)$maxyear)),
  metrics = FLCore::metrics(x),
  probs = NULL,
  mp = NULL
)

## S4 method for signature 'FLStocks'
performance(
  x,
  statistics,
  refpts = FLPar(),
  years = dims(x[[1]])$maxyear,
  metrics = FLCore::metrics,
  probs = NULL,
  grid = missing,
  mp = NULL,
  mc.cores = 1
)

## S4 method for signature 'list'
performance(
  x,
  statistics,
  refpts = FLPar(),
  years = dims(x[[1]])$maxyear,
  probs = NULL,
  grid = "missing",
  mp = NULL,
  mc.cores = 1,
  ...
)

## S4 method for signature 'FLom'
performance(x, refpts = x@refpts, metrics = NULL, statistics = NULL, ...)

Arguments

statistics

statistics to be computed, as formula, name and description, list

refpts

Reference points for calculations, list

years

Years on which statistics should be computed, defaults to last year of input FLQuants

run

Object holding the results of forward projections, as a named FLQuants

Details

Each statistics is an object of class list object, with three elements, the first two of them compulsory:

  • An unnamed element of class formula, e.g. yearMeans(SB/SB0).

  • name: A short name to be output on tables and plots, of class character, e.g. "SB/SB0".

  • desc: A longer description of the statistics, of class character, e.g. "Mean spawner biomass relative to unfished"

Each statistic formula is evaluated against the metrics and refpts used in the function call. Formulas can thus use (i) the names of the FLQuants object or of the object returned by the call to metrics(), (ii) of the params in the refpts object and, for all classes but FLQuants, (iii) functions that can be called on object. See examples below for the necessary matching between metrics, refpts and the statistics formulas.

Value

data.table Results of computing performance statistics.

Author(s)

Iago Mosqueira, EC JRC

See Also

FLQuants

Examples


# LOAD example FLmse object
data(sol274)
# GENERATE pseudo-run from last 20 years of OM
run <- window(stock(om), start=2012, end=2021)
# DEFINE statistics
statistics <- list(
  dCatch=list(~yearMeans(C[, -1]/C[, -dims(C)$year]),
    name="mean(C[t] / C[t-1])",
    desc="Mean absolute proportional change in catch"),
  varCatch=list(~yearVars(C),
    name="var(C)",
    desc="Variance in catch"),
  varF=list(~yearVars(F),
    name="var(F)",
    desc="Variance in fishing mortality"))
# COMPUTE performance
performance(run, statistics, refpts=FLPar(MSY=110000),
  metrics=list(C=catch, F=fbar), years=list(2016:2021))
# Minimum statistic, named list with formula and name
performance(run, statistics=list(CMSY=list(~yearMeans(C/MSY), name="CMSY")),
  refpts=FLPar(MSY=110000), metrics=list(C=catch, F=fbar),
  years=list(2012:2021))
# return quantiles
performance(run, statistics, refpts=FLPar(MSY=110000),
  metrics=list(C=catch, F=fbar), years=list(2012:2021),
  probs =  c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95))
# DEFINE statistics without summaries
statistics <- list(
  CMSY=list(~yearMeans(C/MSY),
    name="CMSY",
    desc="Catch over MSY"))
# COMPUTE performance
perf <- performance(run, statistics, refpts=FLPar(MSY=110000),
  metrics=list(C=catch), years=list(2012:2021))
# COMPUTE summaries
perf[, .(CMSY=mean(data))]
perf <- performance(FLStocks(B=run, A=run), statistics, 
  refpts=FLPar(MSY=110000), metrics=list(C=catch), years=list(2012:2015))

iagomosqueira/mse documentation built on April 24, 2024, 4:35 a.m.