Skip to content

Commit

Permalink
distLfit: fitting of lap excluded temporarily to avoid cdflap bug in …
Browse files Browse the repository at this point in the history
…lmomco 2.2.2
  • Loading branch information
brry committed Mar 30, 2016
1 parent 012f45f commit ce592f8
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 32 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,8 +1,8 @@
Package: extremeStat
Type: Package
Title: Extreme Value Statistics and Quantile Estimation
Version: 0.5.12
Date: 2016-03-29
Version: 0.5.13
Date: 2016-03-30
Imports:
lmomco (>= 2.1.3),
berryFunctions (>= 1.9.21),
Expand Down
3 changes: 2 additions & 1 deletion R/distLfit.R
Expand Up @@ -133,7 +133,8 @@ if( ! is.null(selection) )
else
# remove some to save time and errors, see ?dist.list # gld, gov and tri added
if(speed) dn <- dn[ ! dn %in%
c("aep4","cau","emu","gep","gld","gov","kmu","kur","lmrq","sla","st3","texp","tri")]
c("aep4","cau","emu","gep","gld","gov","kmu","kur","lmrq","sla","st3","texp","tri", "lap")]
### lap (Laplace) is taken out only temporarily until bug in cdflap in lmomco 2.2.2 (2016-03-20) is fixed
#
# Check remaining sample size
if(length(dat) < 5) {if(!ssquiet)on.exit(message("Note in distLfit: sample size (",
Expand Down
3 changes: 2 additions & 1 deletion inst/doc/extremeStat.Rmd
Expand Up @@ -150,7 +150,7 @@ d <- distLquantile(rain, truncate=0.9, plot=TRUE, probs=0.999, quiet=TRUE, break

## Truncation effect

To examine the effect of the truncation percentage, we can compute the quantiles for different cutoff percentages. This is quite time consuming, so the code is not performed upon vignette creation. The result is loaded instead.
To examine the effect of the truncation percentage, we can compute the quantiles for different cutoff percentages. This is quite time consuming, so the code is not performed upon vignette creation. The [result](https://github.com/brry/extremeStat/raw/master/vignettes/qq.Rdata) is loaded instead.

```{r teff, eval=FALSE}
tt <- seq(0,0.95, len=50)
Expand Down Expand Up @@ -208,6 +208,7 @@ sq <- pbapply::pbreplicate(n=100, rainsamplequantile())
save(ss,sq, file="vignettes/sq.Rdata")
```

Load the [resulting R objects](https://github.com/brry/extremeStat/raw/master/vignettes/sq.Rdata):

```{r ssdepplot, echo=-(1:3), fig.height=3.5, fig.width=5.5}
path <- "S:/Dropbox/Public/extremeStat/vignettes"
Expand Down
40 changes: 16 additions & 24 deletions inst/doc/extremeStat.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/testthat/test-quantile.R
Expand Up @@ -5,7 +5,7 @@ data(annMax, package="extremeStat") # Annual Discharge Maxima (streamflow)

test_that("distLquantile generally runs fine",{
distLquantile(annMax)
expect_equal(nrow(distLquantile(annMax, addinfo=TRUE)), 37)
expect_equal(nrow(distLquantile(annMax, addinfo=TRUE)), 37-1)
expect_silent(distLquantile(annMax, truncate=0.6, gpd=FALSE, quiet=TRUE))
expect_message(distLquantile(annMax, plot=FALSE, selection="wak", empirical=FALSE),
"Note in distLgof: Only wak was fitted, thus GOF can't be compared.")
Expand Down Expand Up @@ -41,9 +41,9 @@ test_that("distLquantile can deal with a given dlf",{
})

test_that("distLquantile can handle emp, truncate",{
expect_equal(nrow(distLquantile(annMax, emp=FALSE)), 17) # only distributions in lmomco
expect_equal(nrow(distLquantile(annMax, emp=FALSE)), 17-1) # only distributions in lmomco
expect_message(aq <- distLquantile(annMax, truncate=0.8, probs=0.95)) # POT
expect_equal(mean(aq, na.rm=TRUE), 102.055973)
expect_equal(round(mean(aq, na.rm=TRUE),2), 102.13) # 102.055973 with lap
expect_equal(sum(is.na(distLquantile(annMax, selection="gpa", weight=FALSE))), 3)
})

Expand Down
3 changes: 2 additions & 1 deletion vignettes/extremeStat.Rmd
Expand Up @@ -150,7 +150,7 @@ d <- distLquantile(rain, truncate=0.9, plot=TRUE, probs=0.999, quiet=TRUE, break

## Truncation effect

To examine the effect of the truncation percentage, we can compute the quantiles for different cutoff percentages. This is quite time consuming, so the code is not performed upon vignette creation. The result is loaded instead.
To examine the effect of the truncation percentage, we can compute the quantiles for different cutoff percentages. This is quite time consuming, so the code is not performed upon vignette creation. The [result](https://github.com/brry/extremeStat/raw/master/vignettes/qq.Rdata) is loaded instead.

```{r teff, eval=FALSE}
tt <- seq(0,0.95, len=50)
Expand Down Expand Up @@ -208,6 +208,7 @@ sq <- pbapply::pbreplicate(n=100, rainsamplequantile())
save(ss,sq, file="vignettes/sq.Rdata")
```

Load the [resulting R objects](https://github.com/brry/extremeStat/raw/master/vignettes/sq.Rdata):

```{r ssdepplot, echo=-(1:3), fig.height=3.5, fig.width=5.5}
path <- "S:/Dropbox/Public/extremeStat/vignettes"
Expand Down

0 comments on commit ce592f8

Please sign in to comment.