skillScore: Calculate Prediction Skill Scores

View source: R/skill.R View source: R/createPlots.R

skillScoreR Documentation

Calculate Prediction Skill Scores

Description

Computes threshold-based skill scores including TSS (True Skill Statistic) and AUC (Area Under the Curve) for fishery stock assessment models.

Usage

skillScore(x, y, threshold = NULL, reference = 1)

Arguments

x

Numeric vector of model predictions (e.g., estimated stock biomass)

y

Numeric vector of observed values (e.g., survey biomass index)

threshold

Optional numeric vector of decision thresholds for classification

reference

Reference value for stock status classification (default = 1, typical BMSY threshold)

Value

Data.frame containing optimal threshold and associated metrics:

  • ref: Optimal reference threshold

  • TP: True positives at threshold

  • TN: True negatives at threshold

  • FP: False positives at threshold

  • FN: False negatives at threshold

  • TSS: True Skill Statistic (TPR - FPR)

  • TPR: True Positive Rate (sensitivity)

  • FPR: False Positive Rate (1 - specificity)

  • AUC: Area Under ROC Curve

Examples

# Simulate stock assessment data
obs_status <- rlnorm(100, meanlog = log(1), sdlog = 0.5)
pred_status <- obs_status * exp(rnorm(100, sd = 0.3))
skillScore(pred_status, obs_status > 1, reference = 1)

laurieKell/FLCandy documentation built on April 17, 2025, 5:23 p.m.