tailskill: Calculates the difference between PDF tails.

Description Usage Arguments Details Value Examples

View source: R/tailskill.R

Description

Given two datasets (observations and model), this function calculates a skill score for the agreement between the tails. The skill score is the area between the two PDFs above some threshold, weighted linearly outwards. This metric is based on Perkins, et al. 2013 in the Int. J. Climatology (doi: 10.1002/joc.3500).

Usage

1
tailskill(obs, mod, threshold = 0.95, ...)

Arguments

obs

A vector of observed data.

mod

A vector of model data.

threshold

The probability threshold where the tail begins. Default value: 0.95.

...

Arguments to the density estimation function.

Details

The upper tail is scored if the threshold value is >= 0.5; otherwise, the lower tail is scored. The bkde function from the KernSmooth package is used to estimate the PDFs of the two datasets.

Value

A numeric skill score; 1 indicates perfect agreement, 0 no agreement.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(KernSmooth)
set.seed(22)
obs <- rgamma(1000, shape=1, scale=1)
perfect <- rgamma(1000, shape=1, scale=1)
good <- rgamma(1000, shape=6/5, scale=5/6)
bad <- rgamma(1000, shape=3, scale=1/3)

x <- namelist(obs, perfect, good, bad)

mplot(lapply(x, bkde), type="l", col=c("black","blue","green","red"), lty=1)

legend("topright", names(x), col=c("black","blue","green","red"), lty=1, lwd=2)

tailskill(obs, obs)
tailskill(obs, perfect)
tailskill(obs, good)
tailskill(obs, bad)

sethmcg/climod documentation built on Nov. 19, 2021, 11:12 p.m.