spi: Classic standardized precipitation index (SPI)

Description Usage Arguments Details Value Author(s) Examples

View source: R/spi-classic.R

Description

spi computes the spi index using gamlss models. It can also with work with precipitation series containing NA, 0 or only non-zero values.

Usage

1
spi(y, time, tscale = 1, period = 52)

Arguments

y

Usually rainfall from which to compute the SPI, but other variables like precipitation can also be used.

time

Time indexed to the values of the argument y, it can be in weeks, months, etc.

tscale

Time-scale to compute the SPI in time units. This argument is used to perform a moving average to the rainfall series before computing the SPI.

period

Numeric value representing the period to define seasonality. For example, 53 weeks, 12 months, 365 days. As it can be seen, it depends of the units of the argument time.

Details

details.

Value

A dataframe consisting of y, time, season, mu, sigma, pzero, ecdf and spi.

Author(s)

Erick A. Chacon-Montalvan

Examples

1
2
3
4
5
6
7
8
9
data(simrain)
spi_rain <- spi(simrain$rain, simrain$time)

# Visualize model fitting
plot(spi_rain)
# Visualize distribution of empirical cumulative density function
plot(spi_rain, which = "ecdf", binwidth = 0.05)
# Visualize extreme events
plot_extremes(spi_rain, threshold = 2)

ErickChacon/mbsi documentation built on Aug. 1, 2019, 4:47 p.m.