ck_spei: Standardized Precipitation-Evapotranspiration Index (SPEI)

View source: R/drought.R

ck_speiR Documentation

Standardized Precipitation-Evapotranspiration Index (SPEI)

Description

Compute the SPEI by fitting a log-logistic distribution to the monthly climatic water balance (precipitation minus potential evapotranspiration) accumulated over a rolling window.

Usage

ck_spei(precip, pet, dates, scale = 3, distribution = c("log-logistic", "gev"))

Arguments

precip

Numeric vector of daily precipitation (mm).

pet

Numeric vector of daily potential evapotranspiration (mm).

dates

Date vector of the same length as precip and pet.

scale

Integer. Accumulation period in months (default 3).

distribution

Character. Either "log-logistic" (default, Vicente-Serrano et al. 2010) or "gev" (Generalised Extreme Value, fitted by L-moments; preferred for water-balance series with heavy upper or lower tails).

Value

A data frame with columns period, value, index, and unit.

References

Vicente-Serrano, S. M., Begueria, S., & Lopez-Moreno, J. I. (2010). A multiscalar drought index sensitive to global warming: the Standardized Precipitation Evapotranspiration Index. Journal of Climate, 23(7), 1696-1718.

Examples

dates <- seq(as.Date("2020-01-01"), as.Date("2023-12-31"), by = "day")
set.seed(42)
precip <- rgamma(length(dates), shape = 0.5, rate = 0.1)
pet <- rep(3, length(dates))
ck_spei(precip, pet, dates, scale = 3)

climatekit documentation built on May 9, 2026, 5:08 p.m.