knitr::opts_chunk$set(echo = TRUE, fig.align = "center")
knitr::opts_chunk$set(fig.width = 12, fig.height = 7, fig.path = "README-", dpi = 200)
knitr::opts_chunk$set(warning = FALSE)
# options(width = 100)

Travis-CI Build Status

mbsi: Model-based standardized index

The mbsi package provide tools to compute and visualize extreme hydro-climatic events using the standardized precipitation index (SPI) and the model-based standardized index (MBSI). The difference with between the MBSPI and the classical SPI index is that it consider the association between continuous times using cycle P-splines ‘pbc’. The package can also with work with precipitation series containing missing values (NA), 0 or only non-zero values.

Installation

This package is not still on CRAN, so installation is done using the devtools package as shown below:

devtools::install_github("ErickChacon/mbsi")

How to use it?

Analysing the standardized precipitation with time-scale 1

library(mbsi)

data(simrain)

# Compute mbsi
spi_rain <- mbsi(y = simrain$rain, time = simrain$time, tscale = 1, period = 52)
# 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)

Analysing the standardized precipitation with time-scale 8

# Compute mbsi
spi_rain_8 <- mbsi(y = simrain$rain, time = simrain$time, tscale = 8, period = 52)
# Visualize model fitting
plot(spi_rain_8)
# Visualize distribution of empirical cumulative density function
plot(spi_rain_8, which = "ecdf", binwidth = 0.05)
# Visualize extreme events
plot_extremes(spi_rain_8, threshold = 2)


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