Commit 0d3bf8df authored by Jana Ulrich's avatar Jana Ulrich
Browse files

add seed for random generation of example data

parent fd08b92e
......@@ -51,6 +51,7 @@ Here are a few examples to illustrate the order in which the functions are inten
* Step 0: sample 20 years of example hourly 'precipitation' data
```{r sampledata}
set.seed(999)
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)
......@@ -118,8 +119,8 @@ $$
The function `gev.d.fit` provides the options:
* `theta_zero = TRUE` $\theta = 0$
* `eta2_zero = TRUE` $\eta_2 = \eta$
* `tau_zero = TRUE` $\tau = 0$
* `eta2_zero = TRUE` (default) $\eta_2 = \eta$
* `tau_zero = TRUE` (default) $\tau = 0$
resulting in the following features for IDF-curves:
......@@ -152,7 +153,7 @@ fit.cols <- c('red','purple','blue','darkgreen')
fit.labels <- c('simple-scaling','theta!=0','eta2!=eta','tau!=0')
# plotting probabilities
idf.probs <- c(0.5,0.75,0.99)
# create 4 plots for each additional parameter
# create 4 plots: one for each additional parameter
par(mfrow=c(2,2),mar=c(0.2,0.2,0.2,0.2),oma=c(3.5,4.5,0,0),mgp=c(2.5,0.6,0))
for(i.fit in 1:length(all.fits)){
plot(example$ds,example$xdat,log='xy',type='n',axes=FALSE)
......
......@@ -44,6 +44,7 @@ are intended to be used.
<!-- end list -->
``` r
set.seed(999)
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)
......@@ -74,13 +75,13 @@ fit <- gev.d.fit(xdat = ann.max$xdat,ds = ann.max$ds,sigma0link = make.link('log
#> [1] 0
#>
#> $nllh
#> [1] 60.23787
#> [1] 59.34496
#>
#> $mle
#> [1] 5.682697e+00 5.816338e-01 -8.017104e-02 7.574509e-09 8.059212e-01
#> [1] 6.478887e+00 3.817184e-01 -1.833254e-02 2.843666e-09 7.922310e-01
#>
#> $se
#> [1] 3.530129e-01 6.884231e-02 4.942244e-02 2.000060e-06 1.153130e-02
#> [1] 4.018974e-01 6.677404e-02 4.931317e-02 2.000063e-06 1.141522e-02
# checking the fit
gev.d.diag(fit,pch=1,)
```
......@@ -91,8 +92,8 @@ gev.d.diag(fit,pch=1,)
# parameter estimates
params <- gev.d.params(fit)
print(params)
#> mut sigma0 xi theta eta eta2 tau
#> 1 5.682697 1.788959 -0.08017104 7.574509e-09 0.8059212 0.8059212 0
#> mut sigma0 xi theta eta eta2 tau
#> 1 6.478887 1.4648 -0.01833254 2.843666e-09 0.792231 0.792231 0
# plotting the probability density for a single duration
q.min <- floor(min(ann.max$xdat[ann.max$ds%in%1:2]))
......@@ -155,10 +156,10 @@ The function `gev.d.fit` provides the options:
- `theta_zero = TRUE` ![\\theta
= 0](https://latex.codecogs.com/png.latex?%5Ctheta%20%3D%200
"\\theta = 0")
- `eta2_zero = TRUE` ![\\eta\_2 =
- `eta2_zero = TRUE` (default) ![\\eta\_2 =
\\eta](https://latex.codecogs.com/png.latex?%5Ceta_2%20%3D%20%5Ceta
"\\eta_2 = \\eta")
- `tau_zero = TRUE` ![\\tau
- `tau_zero = TRUE` (default) ![\\tau
= 0](https://latex.codecogs.com/png.latex?%5Ctau%20%3D%200
"\\tau = 0")
......@@ -203,7 +204,7 @@ fit.cols <- c('red','purple','blue','darkgreen')
fit.labels <- c('simple-scaling','theta!=0','eta2!=eta','tau!=0')
# plotting probabilities
idf.probs <- c(0.5,0.75,0.99)
# create 4 plots for each additional parameter
# create 4 plots: one for each additional parameter
par(mfrow=c(2,2),mar=c(0.2,0.2,0.2,0.2),oma=c(3.5,4.5,0,0),mgp=c(2.5,0.6,0))
for(i.fit in 1:length(all.fits)){
plot(example$ds,example$xdat,log='xy',type='n',axes=FALSE)
......
man/figures/README-annualmax-1.png

9.73 KB | W: | H:

man/figures/README-annualmax-1.png

9.68 KB | W: | H:

man/figures/README-annualmax-1.png
man/figures/README-annualmax-1.png
man/figures/README-annualmax-1.png
man/figures/README-annualmax-1.png
  • 2-up
  • Swipe
  • Onion skin
man/figures/README-fit-1.png

43.8 KB | W: | H:

man/figures/README-fit-1.png

44.6 KB | W: | H:

man/figures/README-fit-1.png
man/figures/README-fit-1.png
man/figures/README-fit-1.png
man/figures/README-fit-1.png
  • 2-up
  • Swipe
  • Onion skin
man/figures/README-fit-2.png

21.2 KB | W: | H:

man/figures/README-fit-2.png

22.8 KB | W: | H:

man/figures/README-fit-2.png
man/figures/README-fit-2.png
man/figures/README-fit-2.png
man/figures/README-fit-2.png
  • 2-up
  • Swipe
  • Onion skin
man/figures/README-idf-1.png

37.2 KB | W: | H:

man/figures/README-idf-1.png

35.5 KB | W: | H:

man/figures/README-idf-1.png
man/figures/README-idf-1.png
man/figures/README-idf-1.png
man/figures/README-idf-1.png
  • 2-up
  • Swipe
  • Onion skin
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