Skip to content

Model-based Standardized Index: An R package to analyse and visualise extreme precipitation events

License

Notifications You must be signed in to change notification settings

ErickChacon/mbsi

Repository files navigation

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)
## GAMLSS-RS iteration 1: Global Deviance = -2344.71 
## GAMLSS-RS iteration 2: Global Deviance = -2344.712 
## GAMLSS-RS iteration 3: Global Deviance = -2344.712 
## new prediction 
## new prediction
# 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)
## GAMLSS-RS iteration 1: Global Deviance = -2344.71 
## GAMLSS-RS iteration 2: Global Deviance = -2344.712 
## GAMLSS-RS iteration 3: Global Deviance = -2344.712 
## new prediction 
## new prediction
# 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)

About

Model-based Standardized Index: An R package to analyse and visualise extreme precipitation events

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published