Commit 1bd06d3b authored by Jana Ulrich's avatar Jana Ulrich
Browse files

added Readme and NEWS

parent 65507354
......@@ -15,8 +15,8 @@ Description: Intensity-duration-frequency (IDF) curves are a widely used analysi
The package 'IDF' provides functions to estimate IDF parameters for given
precipitation time series on the basis of a duration-dependent
generalised extreme value distribution
[Koutsoyannis et al., 1998, <doi:10.1016/S0022-1694(98)00097-3>].
Author: Jana Ulrich [aut, cre], Laura Mack [ctb], Christoph Ritschel [aut], Carola Detring [ctb], Sarah Joedicke [ctb]
[Koutsoyiannis et al., 1998, <doi:10.1016/S0022-1694(98)00097-3>].
Author: Jana Ulrich [aut, cre], Laura Mack [ctb], Oscar E. Jurado [ctb], Christoph Ritschel [aut], Carola Detring [ctb], Sarah Joedicke [ctb]
Maintainer: Jana Ulrich <jana.ulrich@fu-berlin.de>
Imports: stats,
evd,
......
# IDF 2.0.0
The package was extended to allow generalized linear modeling of the d-GEV parameters. This can be used to model for example spatial variations of the parameters.
The packet was extensively revised and restructured and some functions were removed as they were too specific.
# IDF 1.0.0
R package for maximum likelihood fitting of duration-dependent generalized extreme value distribution (d-GEV).
Additional functions forprocessing data (obtaining annual maxima) plotting IDF curves.
\ No newline at end of file
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# IDF
<!-- badges: start -->
<!-- badges: end -->
Intensity-duration-frequency (IDF) curves are a widely used analysis-tool
in hydrology to assessthe characteristics of extreme precipitation.
The package 'IDF' functions to estimate IDF relations for given
precipitation time series on the basis of a duration-dependent
generalized extreme value (GEV) distribution.
The central function is \code{\link{gev.d.fit}}, which uses the method
of maximum-likelihood estimation for the d-GEV parameters, whereby it is
possible to include generalized linear modeling
for each parameter.
For more detailed information on the methods and the application of the package for estimating IDF curves with spatial covariates, see Ulrich et. al (2020, https://doi.org/10.3390/w12113119).
## Installation
You can install the released version of IDF from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("IDF")
```
or from gitlab using:
``` r
devtools::install_git("https://gitlab.met.fu-berlin.de/Rpackages/IDF")
```
## Example
Here are a few examples to illustrate the order in which the functions are intended to be used.
* Step 0: sample 20 years of example hourly 'precipitation' data
```{r sample data}
dates <- seq(as.POSIXct("2000-01-01 00:00:00"),as.POSIXct("2019-12-31 23:00:00"),by = 'hour')
sample.precip <- rgamma(n = length(dates), shape = 0.05, rate = 0.4)
precip.df <- data.frame(date=dates,RR=sample.precip)
```
* Step 1: get annual maxima
```{r annual max}
library(IDF)
durations <- 2^(0:6) # accumulation durations [h]
ann.max <- IDF.agg(list(precip.df),ds=durations,na.accept = 0.1)
# plotting the annual maxima in log-log representation
plot(ann.max$ds,ann.max$xdat,log='xy',xlab = 'Duration [h]',ylab='Intensity [mm/h]')
```
* Step 2: fit d-GEV to annual maxima
```{r fit}
fit <- gev.d.fit(xdat = ann.max$xdat,ds = ann.max$ds,sigma0link = make.link('log'))
# checking the fit
gev.d.diag(fit,pch=1,)
# parameter estimates
params <- gev.d.params(fit)
print(params)
# plotting the probability density for a single duration
q.min <- floor(min(ann.max$xdat[ann.max$ds%in%1:2]))
q.max <- ceiling(max(ann.max$xdat[ann.max$ds%in%1:2]))
q <- seq(q.min,q.max,0.2)
plot(range(q),c(0,0.55),type = 'n',xlab = 'Intensity [mm/h]',ylab = 'Density')
for(d in 1:2){ # d=1h and d=2h
# sampled data:
hist(ann.max$xdat[ann.max$ds==d],main = paste('d=',d),q.min:q.max
,freq = FALSE,add=TRUE,border = d)
# etimated prob. density:
lines(q,dgev.d(q,params$mut,params$sigma0,params$xi,params$theta,params$eta,d = d),col=d)
}
legend('topright',col=1:2,lwd=1,legend = paste('d=',1:2,'h'),title = 'Duration')
```
* Step 3: adding the IDF-curves to the data
```{r idf}
plot(ann.max$ds,ann.max$xdat,log='xy',xlab = 'Duration [h]',ylab='Intensity [mm/h]')
IDF.plot(durations,params,add=TRUE)
```
<!-- README.md is generated from README.Rmd. Please edit that file -->
# IDF
<!-- badges: start -->
<!-- badges: end -->
Intensity-duration-frequency (IDF) curves are a widely used
analysis-tool in hydrology to assessthe characteristics of extreme
precipitation. The package ‘IDF’ functions to estimate IDF relations for
given precipitation time series on the basis of a duration-dependent
generalized extreme value (GEV) distribution. The central function is ,
which uses the method of maximum-likelihood estimation for the d-GEV
parameters, whereby it is possible to include generalized linear
modeling for each parameter. For more detailed information on the
methods and the application of the package for estimating IDF curves
with spatial covariates, see Ulrich et. al (2020,
<https://doi.org/10.3390/w12113119>).
## Installation
You can install the released version of IDF from
[CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("IDF")
```
or from gitlab using:
``` r
devtools::install_git("https://gitlab.met.fu-berlin.de/Rpackages/IDF")
```
## Example
Here are a few examples to illustrate the order in which the functions
are intended to be used.
- Step 0: sample 20 years of example hourly ‘precipitation’ data
<!-- end list -->
``` r
dates <- seq(as.POSIXct("2000-01-01 00:00:00"),as.POSIXct("2019-12-31 23:00:00"),by = 'hour')
sample.precip <- rgamma(n = length(dates), shape = 0.05, rate = 0.4)
precip.df <- data.frame(date=dates,RR=sample.precip)
```
- Step 1: get annual maxima
<!-- end list -->
``` r
library(IDF)
durations <- 2^(0:6) # accumulation durations [h]
ann.max <- IDF.agg(list(precip.df),ds=durations,na.accept = 0.1)
# plotting the annual maxima in log-log representation
plot(ann.max$ds,ann.max$xdat,log='xy',xlab = 'Duration [h]',ylab='Intensity [mm/h]')
```
<img src="man/figures/README-annual max-1.png" width="100%" />
- Step 2: fit d-GEV to annual maxima
<!-- end list -->
``` r
fit <- gev.d.fit(xdat = ann.max$xdat,ds = ann.max$ds,sigma0link = make.link('log'))
#> $conv
#> [1] 0
#>
#> $nllh
#> [1] 73.81918
#>
#> $mle
#> [1] 5.384207e+00 6.400833e-01 -9.082818e-03 5.752210e-09 8.153861e-01
#>
#> $se
#> [1] 3.531081e-01 7.670363e-02 5.422432e-02 2.000074e-06 1.279425e-02
# checking the fit
gev.d.diag(fit,pch=1,)
```
<img src="man/figures/README-fit-1.png" width="100%" />
``` r
# parameter estimates
params <- gev.d.params(fit)
print(params)
#> mut sigma0 xi theta eta
#> 1 5.384207 1.896639 -0.009082818 5.75221e-09 0.8153861
# plotting the probability density for a single duration
q.min <- floor(min(ann.max$xdat[ann.max$ds%in%1:2]))
q.max <- ceiling(max(ann.max$xdat[ann.max$ds%in%1:2]))
q <- seq(q.min,q.max,0.2)
plot(range(q),c(0,0.55),type = 'n',xlab = 'Intensity [mm/h]',ylab = 'Density')
for(d in 1:2){ # d=1h and d=2h
# sampled data:
hist(ann.max$xdat[ann.max$ds==d],main = paste('d=',d),q.min:q.max
,freq = FALSE,add=TRUE,border = d)
# etimated prob. density:
lines(q,dgev.d(q,params$mut,params$sigma0,params$xi,params$theta,params$eta,d = d),col=d)
}
legend('topright',col=1:2,lwd=1,legend = paste('d=',1:2,'h'),title = 'Duration')
```
<img src="man/figures/README-fit-2.png" width="100%" />
- Step 3: adding the IDF-curves to the data
<!-- end list -->
``` r
plot(ann.max$ds,ann.max$xdat,log='xy',xlab = 'Duration [h]',ylab='Intensity [mm/h]')
IDF.plot(durations,params,add=TRUE)
```
<img src="man/figures/README-idf-1.png" width="100%" />
......@@ -25,6 +25,10 @@ CRAN repository db overrides:
X-CRAN-Comment: Archived on 2020-03-13 as check problems were not
corrected in time.
The maintainer of this package has changed. The former maintainer did not inform us that check problems had occurred.
This submission is a substantially revised version.
## Reverse dependencies
This is a new release, so there are no reverse dependencies.
There are currently no downstream dependencies for this package.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment