Commit 2b6aff3c authored by Laura Mack's avatar Laura Mack
Browse files

check duration > 0

parent 30bad559
......@@ -8,7 +8,7 @@
#' @param mut,sigma0,xi numeric value, giving modified location, modified scale and shape parameter
#' @param theta numeric value, giving duration offset (defining curvature of the IDF curve)
#' @param eta numeric value, giving duration exponent (defining slope of the IDF curve)
#' @param d numeric value, giving duration
#' @param d positive numeric value, giving duration
#' @param ... additional parameters passed to \code{\link[evd]{dgev}}
#'
#' @details The duration dependent GEV distribution is defined after
......@@ -44,6 +44,7 @@ dgev.d <- function(q,mut,sigma0,xi,theta,eta,d,...) {
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. ',
'This is not intended and might cause an error.')}
if (d<=0) {stop('The duration d has to be positive.')}
if(any(d+theta<=0)){
warning('Some shape parameters are negative,resulting from a negativ theta '
,theta, ' this will prododuce NAs.')}
......@@ -62,7 +63,7 @@ dgev.d <- function(q,mut,sigma0,xi,theta,eta,d,...) {
#' @param mut,sigma0,xi numeric value, giving modified location, modified scale and shape parameter
#' @param theta numeric value, giving duration offset (defining curvature of the IDF curve)
#' @param eta numeric value, giving duration exponent (defining slope of the IDF curve)
#' @param d numeric value, giving duration
#' @param d positive numeric value, giving duration
#' @param ... additional parameters passed to \code{\link[evd]{pgev}}
#'
#' @details The duration dependent GEV distribution is defined after
......@@ -87,6 +88,7 @@ pgev.d <- function(q,mut,sigma0,xi,theta,eta,d,...) {
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. ',
'This is not intended and might cause an error.')}
if (d<=0) {stop('The duration d has to be positive.')}
if(any(d+theta<=0)){
warning('Some shape parameters are negative,resulting from a negativ theta '
,theta, ' this will prododuce NAs.')}
......@@ -105,7 +107,7 @@ pgev.d <- function(q,mut,sigma0,xi,theta,eta,d,...) {
#' @param mut,sigma0,xi numeric value, giving modified location, modified scale and shape parameter
#' @param theta numeric value, giving duration offset (defining curvature of the IDF curve)
#' @param eta numeric value, giving duration exponent (defining slope of the IDF curve)
#' @param d numeric value, giving duration
#' @param d positive numeric value, giving duration
#' @param ... additional parameters passed to \code{\link[evd]{qgev}}
#'
#' @details The duration dependent GEV distribution is defined after
......@@ -143,6 +145,7 @@ qgev.d <- function(p,mut,sigma0,xi,theta,eta,d,...) {
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. ',
'This is not intended and might cause an error.')}
if (d<=0) {stop('The duration d has to be positive.')}
if(any(d+theta<=0)){
warning('Some shape parameters are negative,resulting from a negativ theta '
,theta, ' this will prododuce NAs.')}
......@@ -162,7 +165,7 @@ qgev.d <- function(p,mut,sigma0,xi,theta,eta,d,...) {
#' @param mut,sigma0,xi numeric value, giving modified location, modified scale and shape parameter
#' @param theta numeric value, giving duration offset (defining curvature of the IDF curve)
#' @param eta numeric value, giving duration exponent (defining slope of the IDF curve)
#' @param d numeric value, giving duration
#' @param d positive numeric value, giving duration
#'
#' @details The duration dependent GEV distribution is defined after
#' [Koutsoyannis et al., 1998]:
......@@ -194,8 +197,9 @@ rgev.d <- function(n,mut,sigma0,xi,theta,eta,d) {
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. ',
'This is not intended and might cause an error.')}
if (d<=0) {stop('The duration d has to be positive.')}
if(any(d+theta<=0)){
warning('Some shape parameters are negative,resulting from a negativ theta '
warning('Some shape parameters are negative, resulting from a negative theta '
,theta, ' this will prododuce NAs.')}
# if denominator is negative NAs will be returned
if(d+theta<=0){return(rep(NA,n))}else{
......
......@@ -15,7 +15,7 @@ dgev.d(q, mut, sigma0, xi, theta, eta, d, ...)
\item{eta}{numeric value, giving duration exponent (defining slope of the IDF curve)}
\item{d}{numeric value, giving duration}
\item{d}{positive numeric value, giving duration}
\item{...}{additional parameters passed to \code{\link[evd]{dgev}}}
}
......
......@@ -15,7 +15,7 @@ pgev.d(q, mut, sigma0, xi, theta, eta, d, ...)
\item{eta}{numeric value, giving duration exponent (defining slope of the IDF curve)}
\item{d}{numeric value, giving duration}
\item{d}{positive numeric value, giving duration}
\item{...}{additional parameters passed to \code{\link[evd]{pgev}}}
}
......
......@@ -15,7 +15,7 @@ qgev.d(p, mut, sigma0, xi, theta, eta, d, ...)
\item{eta}{numeric value, giving duration exponent (defining slope of the IDF curve)}
\item{d}{numeric value, giving duration}
\item{d}{positive numeric value, giving duration}
\item{...}{additional parameters passed to \code{\link[evd]{qgev}}}
}
......
......@@ -15,7 +15,7 @@ rgev.d(n, mut, sigma0, xi, theta, eta, d)
\item{eta}{numeric value, giving duration exponent (defining slope of the IDF curve)}
\item{d}{numeric value, giving duration}
\item{d}{positive numeric value, giving duration}
}
\value{
list containing vectors of random values
......
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