knitr::opts_chunk$set(echo = TRUE, collapse = TRUE, comment = "#>", fig.path = "man/figures/README-" )
The goal of droughtR
is to enable meteorological drought monitoring by generating non-stationary drought indices under various distributional assumptions (Normal, Gamma, Zero Inflated Gamma and Weibull). It computes the stationary (SPI) and the non-stationary (NSPI) Standardized Precipitation Indices using General Additive Models for Location Scale and Shape (GAMLSS).
knitr::opts_chunk$set( fig.path = "README_figs/README-" )
# Install the development version on Github devtools::install_github("mammask/droughtR")
The function computenspi
creates stationary and non-stationary meteorological drought indices at different time scales. By default, droughtR uses the gamma distribution:
# Load droughtR library library(droughtR) # Generate synthetic monthly rainfall data using the Gamma distribution rain = dummyrainfall(startYear = 1950, endYear = 2010) # Compute the non-stationary standardized precipitation index (NSPI) for scale 12 using GAMLSS nonstatdrought = computenspi(x = rain, stationaryspi = FALSE, spiScale = 12, dist = 'gamma') # Plot NSPI plot(nonstatdrought)
# Compute the stationary standardized precipitation index (NSPI) for scale 12 using GAMLSS and the weibull distribution statdrought = computenspi(x = rain, stationaryspi = TRUE, spiScale = 12, dist = 'weibull') # Plot SPI plot(statdrought)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.