measure.ks.pval: Compute p-value of the two sample Kolmogorov-Smirnov test

View source: R/measure.ks.pval.R

measure.ks.pvalR Documentation

Compute p-value of the two sample Kolmogorov-Smirnov test

Description

Function to compute the p-value of the K-S test, optionally performing a correction by the effective sanmple size

Usage

measure.ks.pval(
  indexObs = NULL,
  indexPrd = NULL,
  obs,
  prd,
  dates = NULL,
  corrected = TRUE
)

Arguments

indexObs

index computed from the observations

indexPrd

index computed from the predictions

obs

A vector of observations

prd

A vector of predictions

dates

Ignored. Introduced for compatibility with the rest of measures

corrected

Logical flag. SHound the p-value be corrected by the effective sample size?. Default to TRUE

Details

The two-sample Kolmogorov-Smirnov test has the null hypothesis (H0) that x and y were drawn from the same continuous distribution. Therefore, the null hypothesis can be rejected only when p-values obtained are “small” (i.e. < 0.05 with ci=0.95). Larger values will indicate the H0 can't be rejected. Since the daily time series often used are serially correlated, this function calculates their effective sample size before estimating the p value of the KS statistic in order to avoid the inflation of type I error (i.e. erroneous rejection of the H0). Under the assumption that the underlying time series follow a first-order autoregressive process (Wilks 2006), the effective sample size, neff is defined as follows: neff=n(1-p1)/(1+p1), where p1 is the lag-1 autocorrelation coefficient.

Value

A float number corresponding to the p-value of the K-S test

Author(s)

J. Bedia, S. Brands

References

Wilks, D. (2006) Statistical methods in the atmospheric sciences, 2nd ed. Elsevier, Amsterdam

See Also

The atomic function measure.ks, returning the KS statistic


SantanderMetGroup/VALUE documentation built on July 8, 2023, 7:03 a.m.