Commit 47493189 authored by jana ulrich's avatar jana ulrich
Browse files

update to version 2.1.1

parent 203c03bf
Package: IDF Package: IDF
Type: Package Type: Package
Title: Estimation and Plotting of IDF Curves Title: Estimation and Plotting of IDF Curves
Version: 2.1.0.9000 Version: 2.1.1
Date: 2021-09-02 Date: 2022-03-03
Authors@R: c(person("Jana", "Ulrich", email = "jana.ulrich@met.fu-berlin.de", role = c("aut", "cre")), Authors@R: c(person("Jana", "Ulrich", email = "jana.ulrich@met.fu-berlin.de", role = c("aut", "cre")),
person("Laura","Mack", email= "laura.mack@fu-berlin.de",role="ctb"), person("Laura","Mack", email= "laura.mack@fu-berlin.de",role="ctb"),
person("Oscar E.","Jurado", email= "jurado@zedat.fu-berlin.de",role="ctb"), person("Oscar E.","Jurado", email= "jurado@zedat.fu-berlin.de",role="ctb"),
......
# IDF 2.1.0.9000 # IDF 2.1.1
- added confidence intervals for diagnostic plots (gev.d.diag) ## New features
- changed defintion of eta2 The function gev.d.diag, which creates diagnostic plots, now provides the option to
- implemented analytical likelihood gradient for faster oprimization add (95% bootstrapped) confidence intervals to the plot.
We implemented the analytic likelihood gradient into the function gev.d.fit. When using the
optimization method 'BFGS', it is now possible to obtain estimates, comparable to those of the
method 'Nelder-Mead' (default), but with considerably reduced computation time. This is especially
recommended, when using a model with covariates.
## Bug fixes
We fixed a bug, occurring when using different plotting symbols for different durations in the function gev.d.diag.
We changed the definition of the parameter eta2 in the documentation, so that it is in accordance
with the corresponding publication.
# IDF 2.1.0 # IDF 2.1.0
......
...@@ -526,9 +526,9 @@ gev.d.lik <- function(xdat,ds,mut,sigma0,xi,theta,eta,log=FALSE,tau=0,eta2=0) { ...@@ -526,9 +526,9 @@ gev.d.lik <- function(xdat,ds,mut,sigma0,xi,theta,eta,log=FALSE,tau=0,eta2=0) {
#' fit <- gev.d.fit(xdat=example$dat,ds = example$d,ydat=as.matrix(example[,c('cov1','cov2')]) #' fit <- gev.d.fit(xdat=example$dat,ds = example$d,ydat=as.matrix(example[,c('cov1','cov2')])
#' ,mutl=c(1,2),sigma0l=1) #' ,mutl=c(1,2),sigma0l=1)
#' # diagnostic plots for complete data #' # diagnostic plots for complete data
#' gev.d.diag(fit,pch=1) #' gev.d.diag(fit,pch=1,ci = TRUE)
#' # diagnostic plots for subset of data (e.g. one station) #' # diagnostic plots for subset of data (e.g. one station)
#' gev.d.diag(fit,subset = example$cov1==1,pch=1) #' gev.d.diag(fit,subset = example$cov1==1,pch=1,ci = TRUE)
gev.d.diag <- function(fit,subset=NULL,cols=NULL,pch=NULL,which='both',mfrow=c(1,2),legend=TRUE, gev.d.diag <- function(fit,subset=NULL,cols=NULL,pch=NULL,which='both',mfrow=c(1,2),legend=TRUE,
title=c('Residual Probability Plot','Residual Quantile Plot'), title=c('Residual Probability Plot','Residual Quantile Plot'),
emp.lab='Empirical',mod.lab='Model',ci=FALSE,...){ emp.lab='Empirical',mod.lab='Model',ci=FALSE,...){
...@@ -566,32 +566,34 @@ gev.d.diag <- function(fit,subset=NULL,cols=NULL,pch=NULL,which='both',mfrow=c(1 ...@@ -566,32 +566,34 @@ gev.d.diag <- function(fit,subset=NULL,cols=NULL,pch=NULL,which='both',mfrow=c(1
if(which=='both') par(mfrow=mfrow) # 2 subplots if(which=='both') par(mfrow=mfrow) # 2 subplots
# colors and symbols # colors and symbols
if(is.null(cols))cols <- rainbow(length(durs)) if(is.null(cols))cols <- rainbow(length(durs))
if(is.null(pch))pch <- df$cval if(length(cols)<length(durs)) cols <- rep(cols, length.out=length(durs))
if(is.null(pch))pch <- 0:(length(durs)-1)#df$cval
if(length(pch)<length(durs)) pch <- rep(pch, length.out=length(durs))
if(which=='both'|which=='pp'){ if(which=='both'|which=='pp'){
# pp # pp
plot(px, exp( - exp( - df$data)), xlab = emp.lab, ylab = mod.lab,col=cols[df$cval] plot(px, exp( - exp( - df$data)), xlab = emp.lab, ylab = mod.lab,col=cols[df$cval]
,pch=pch,ylim=range(exp( - exp(-c(ci.vals,df$data))),na.rm = TRUE),...) ,pch=pch[df$cval],ylim=range(exp( - exp(-c(ci.vals,df$data))),na.rm = TRUE),...)
abline(0, 1, col = 1,lwd=1) abline(0, 1, col = 1,lwd=1)
if(ci){ if(ci){
lines(px,exp( - exp( - ci.vals[,1])),lty=2) lines(px,exp( - exp( - ci.vals[,1])),lty=2)
lines(px,exp( - exp( - ci.vals[,2])),lty=2) lines(px,exp( - exp( - ci.vals[,2])),lty=2)
} }
title(title[1]) title(title[1])
if(legend){legend('bottomright',legend = round(durs,digits = 2),pch=pch, if(legend){legend('bottomright',legend = round(durs,digits = 2),pch=pch[1:length(durs)],
col = cols[1:length(durs)],title = 'Duration [h]',ncol = 2)} col = cols[1:length(durs)],title = 'Duration [h]',ncol = 2)}
} }
if(which=='both'|which=='qq'){ if(which=='both'|which=='qq'){
# qq # qq
plot( - log( - log(px)), df$data, ylab = emp.lab, xlab = mod.lab,col=cols[df$cval] plot( - log( - log(px)), df$data, ylab = emp.lab, xlab = mod.lab,col=cols[df$cval]
,pch=pch,ylim=range(c(ci.vals,df$data),na.rm = TRUE),...) ,pch=pch[df$cval],ylim=range(c(ci.vals,df$data),na.rm = TRUE),...)
abline(0, 1, col = 1,lwd=1) abline(0, 1, col = 1,lwd=1)
if(ci){ if(ci){
lines(-log(-log(px)),ci.vals[,1],lty=2) lines(-log(-log(px)),ci.vals[,1],lty=2)
lines(-log(-log(px)),ci.vals[,2],lty=2) lines(-log(-log(px)),ci.vals[,2],lty=2)
} }
title(title[2]) title(title[2])
if(legend){legend('bottomright',legend = round(durs,digits = 2),pch=pch, if(legend){legend('bottomright',legend = round(durs,digits = 2),pch=pch[1:length(durs)],
col = cols[1:length(durs)],title = 'Duration [h]',ncol = 2)} col = cols[1:length(durs)],title = 'Duration [h]',ncol = 2)}
} }
if(which=='both') par(mfrow=c(1,1)) # reset par if(which=='both') par(mfrow=c(1,1)) # reset par
......
...@@ -102,7 +102,7 @@ IDF.plot(durations,params,add=TRUE) ...@@ -102,7 +102,7 @@ IDF.plot(durations,params,add=TRUE)
## IDF Features ## IDF Features
This Example depicts the different features that can be used to model the IDF curves, see Fauer et. al (2021, https://hess.copernicus.org/preprints/hess-2021-334/). This Example depicts the different features that can be used to model the IDF curves, see Fauer et. al (2021, https://doi.org/10.5194/hess-25-6479-2021).
Here we assume, that the block maxima of each duration can be modeled with the GEV distribution ($\xi\neq0$): Here we assume, that the block maxima of each duration can be modeled with the GEV distribution ($\xi\neq0$):
$$G(z;\mu,\sigma,\xi)=\exp \left\lbrace -\left[ $$G(z;\mu,\sigma,\xi)=\exp \left\lbrace -\left[
1+\xi \left( \frac{z-\mu}{\sigma} \right) 1+\xi \left( \frac{z-\mu}{\sigma} \right)
......
...@@ -74,7 +74,7 @@ fit <- gev.d.fit(xdat = ann.max$xdat,ds = ann.max$ds,sigma0link = make.link('log ...@@ -74,7 +74,7 @@ fit <- gev.d.fit(xdat = ann.max$xdat,ds = ann.max$ds,sigma0link = make.link('log
#> [1] 6.478887e+00 3.817184e-01 -1.833254e-02 2.843666e-09 7.922310e-01 #> [1] 6.478887e+00 3.817184e-01 -1.833254e-02 2.843666e-09 7.922310e-01
#> #>
#> $se #> $se
#> [1] 4.018974e-01 6.677404e-02 4.931317e-02 2.000063e-06 1.141522e-02 #> [1] 0.25207846 0.02370771 0.04861600 NaN 0.01008561
# checking the fit # checking the fit
gev.d.diag(fit,pch=1,ci=TRUE) gev.d.diag(fit,pch=1,ci=TRUE)
``` ```
...@@ -118,9 +118,8 @@ IDF.plot(durations,params,add=TRUE) ...@@ -118,9 +118,8 @@ IDF.plot(durations,params,add=TRUE)
This Example depicts the different features that can be used to model This Example depicts the different features that can be used to model
the IDF curves, see Fauer et. al (2021, the IDF curves, see Fauer et. al (2021,
<https://hess.copernicus.org/preprints/hess-2021-334/>). Here we assume, <https://doi.org/10.5194/hess-25-6479-2021>). Here we assume, that the
that the block maxima of each duration can be modeled with the GEV block maxima of each duration can be modeled with the GEV distribution
distribution
(![\\xi\\neq0](https://latex.codecogs.com/png.latex?%5Cxi%5Cneq0 "\xi\neq0")): (![\\xi\\neq0](https://latex.codecogs.com/png.latex?%5Cxi%5Cneq0 "\xi\neq0")):
![G(z;\\mu,\\sigma,\\xi)=\\exp \\left\\lbrace -\\left\[ ![G(z;\\mu,\\sigma,\\xi)=\\exp \\left\\lbrace -\\left\[
......
## Test environments ## Test environments
* local: Debian Linux 4.19.160-2, R 3.6.3 * local: Debian Linux 4.19.160-2, R 4.1.0
* win-builder (devel and release)
* rhub:
- Windows Server 2008 R2 SP1, R-devel, 32/64 bit
- Ubuntu Linux 20.04.1 LTS, R-release, GCC
- Fedora Linux, R-devel, clang, gfortran
## R CMD check results ## R CMD check results
Status: OK Status: OK
......
...@@ -57,7 +57,7 @@ data('example',package ='IDF') ...@@ -57,7 +57,7 @@ data('example',package ='IDF')
fit <- gev.d.fit(xdat=example$dat,ds = example$d,ydat=as.matrix(example[,c('cov1','cov2')]) fit <- gev.d.fit(xdat=example$dat,ds = example$d,ydat=as.matrix(example[,c('cov1','cov2')])
,mutl=c(1,2),sigma0l=1) ,mutl=c(1,2),sigma0l=1)
# diagnostic plots for complete data # diagnostic plots for complete data
gev.d.diag(fit,pch=1) gev.d.diag(fit,pch=1,ci = TRUE)
# diagnostic plots for subset of data (e.g. one station) # diagnostic plots for subset of data (e.g. one station)
gev.d.diag(fit,subset = example$cov1==1,pch=1) gev.d.diag(fit,subset = example$cov1==1,pch=1,ci = TRUE)
} }
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