Commit f873df79 by Laura Mack

### consistent names in function and example *gev.d

parent a163f7bc
 ... @@ -83,7 +83,7 @@ dgev.d <- function(q,mut,sigma0,xi,theta,eta,d,...) { ... @@ -83,7 +83,7 @@ dgev.d <- function(q,mut,sigma0,xi,theta,eta,d,...) { #' #' #' @examples #' @examples #' x <- seq(4,20,0.1) #' x <- seq(4,20,0.1) #' prob <- pgev.d(q=x,mu=4,sigma0=2,xi=0,theta=0.1,eta=0.1,d=1) #' prob <- pgev.d(q=x,mut=4,sigma0=2,xi=0,theta=0.1,eta=0.1,d=1) pgev.d <- function(q,mut,sigma0,xi,theta,eta,d,...) { pgev.d <- function(q,mut,sigma0,xi,theta,eta,d,...) { if(any(c(length(mut),length(sigma0),length(xi),length(theta),length(eta))>1)){ if(any(c(length(mut),length(sigma0),length(xi),length(theta),length(eta))>1)){ message('One of the parameters mut, sigma0, xi, theta, eta is a vector. ', message('One of the parameters mut, sigma0, xi, theta, eta is a vector. ', ... @@ -128,11 +128,11 @@ pgev.d <- function(q,mut,sigma0,xi,theta,eta,d,...) { ... @@ -128,11 +128,11 @@ pgev.d <- function(q,mut,sigma0,xi,theta,eta,d,...) { #' @examples #' @examples #' p <- c(0.5,0.9,0.99) #' p <- c(0.5,0.9,0.99) #' # calulate quantiles for one duration #' # calulate quantiles for one duration #' qgev.d(p=p,mu=4,sigma0=2,xi=0,theta=0.1,eta=0.3,d=1) #' qgev.d(p=p,mut=4,sigma0=2,xi=0,theta=0.1,eta=0.3,d=1) #' #' #' # calculate quantiles for sequence of durations #' # calculate quantiles for sequence of durations #' ds <- 2^seq(0,4,0.1) #' ds <- 2^seq(0,4,0.1) #' qs <- lapply(ds,qgev.d,p=p,mu=4,sigma0=2,xi=0,theta=0.1,eta=0.3) #' qs <- lapply(ds,qgev.d,p=p,mut=4,sigma0=2,xi=0,theta=0.1,eta=0.3) #' qs <- simplify2array(qs) #' qs <- simplify2array(qs) #' #' #' plot(ds,qs[1,],ylim=c(3,20),type='l',log = 'xy',ylab='Intensity',xlab = 'Duration') #' plot(ds,qs[1,],ylim=c(3,20),type='l',log = 'xy',ylab='Intensity',xlab = 'Duration') ... @@ -188,7 +188,7 @@ qgev.d <- function(p,mut,sigma0,xi,theta,eta,d,...) { ... @@ -188,7 +188,7 @@ qgev.d <- function(p,mut,sigma0,xi,theta,eta,d,...) { #' #' #' # compare randomn samples for different durations #' # compare randomn samples for different durations #' ds <- c(1,4) #' ds <- c(1,4) #' samp <- lapply(ds,rgev.d,n=100,mut=4,sigma=2,xi=0,theta=0.1,eta=0.3) #' samp <- lapply(ds,rgev.d,n=100,mut=4,sigma0=2,xi=0,theta=0.1,eta=0.3) #' #' #' hist(samp[[1]],breaks = 10,col=rgb(1,0,0,0.5),freq = FALSE #' hist(samp[[1]],breaks = 10,col=rgb(1,0,0,0.5),freq = FALSE #' ,ylim=c(0,0.3),xlab='x',main = 'd-GEV samples for two different durations') #' ,ylim=c(0,0.3),xlab='x',main = 'd-GEV samples for two different durations') ... ...
 ... @@ -35,7 +35,7 @@ modified location parameter \eqn{\mu_t=\mu/\sigma(d)}. ... @@ -35,7 +35,7 @@ modified location parameter \eqn{\mu_t=\mu/\sigma(d)}. } } \examples{ \examples{ x <- seq(4,20,0.1) x <- seq(4,20,0.1) prob <- pgev.d(q=x,mu=4,sigma0=2,xi=0,theta=0.1,eta=0.1,d=1) prob <- pgev.d(q=x,mut=4,sigma0=2,xi=0,theta=0.1,eta=0.1,d=1) } } \references{ \references{ Koutsoyannis et al., 1998, doi:10.1016/S0022-1694(98)00097-3 Koutsoyannis et al., 1998, doi:10.1016/S0022-1694(98)00097-3 ... ...
 ... @@ -36,11 +36,11 @@ modified location parameter \eqn{\mu_t=\mu/\sigma(d)}. ... @@ -36,11 +36,11 @@ modified location parameter \eqn{\mu_t=\mu/\sigma(d)}. \examples{ \examples{ p <- c(0.5,0.9,0.99) p <- c(0.5,0.9,0.99) # calulate quantiles for one duration # calulate quantiles for one duration qgev.d(p=p,mu=4,sigma0=2,xi=0,theta=0.1,eta=0.3,d=1) qgev.d(p=p,mut=4,sigma0=2,xi=0,theta=0.1,eta=0.3,d=1) # calculate quantiles for sequence of durations # calculate quantiles for sequence of durations ds <- 2^seq(0,4,0.1) ds <- 2^seq(0,4,0.1) qs <- lapply(ds,qgev.d,p=p,mu=4,sigma0=2,xi=0,theta=0.1,eta=0.3) qs <- lapply(ds,qgev.d,p=p,mut=4,sigma0=2,xi=0,theta=0.1,eta=0.3) qs <- simplify2array(qs) qs <- simplify2array(qs) plot(ds,qs[1,],ylim=c(3,20),type='l',log = 'xy',ylab='Intensity',xlab = 'Duration') plot(ds,qs[1,],ylim=c(3,20),type='l',log = 'xy',ylab='Intensity',xlab = 'Duration') ... ...
 ... @@ -37,7 +37,7 @@ rgev.d(n=100,mut=4,sigma=2,xi=0,theta=0.1,eta=0.3,d=1) ... @@ -37,7 +37,7 @@ rgev.d(n=100,mut=4,sigma=2,xi=0,theta=0.1,eta=0.3,d=1) # compare randomn samples for different durations # compare randomn samples for different durations ds <- c(1,4) ds <- c(1,4) samp <- lapply(ds,rgev.d,n=100,mut=4,sigma=2,xi=0,theta=0.1,eta=0.3) samp <- lapply(ds,rgev.d,n=100,mut=4,sigma0=2,xi=0,theta=0.1,eta=0.3) hist(samp[[1]],breaks = 10,col=rgb(1,0,0,0.5),freq = FALSE hist(samp[[1]],breaks = 10,col=rgb(1,0,0,0.5),freq = FALSE ,ylim=c(0,0.3),xlab='x',main = 'd-GEV samples for two different durations') ,ylim=c(0,0.3),xlab='x',main = 'd-GEV samples for two different durations') ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!