Commit d98f1874 authored by Rust Henning's avatar Rust Henning 🐿
Browse files

initial commit

parents
Package: IDF
Type: Package
Title: Estimating intensity-duration-frequency parameters
Version: 1.01
Date: 2016-01-28
Author: Christoph Ritschel, Sarah Joedicke
Maintainer: Christoph Ritschel <christoph.ritschel@met.fu-berlin.de>
Description: The package 'IDF' reads precipitation data from webwerdis and Berlin Stadtmessnetz.
It aggregates these data and calculates yearly intensity maxima. From those maxima intensity-duration-frequency
parameters are estimated. IDF curves based on these estimated parameters can be plotted.
Depends: stats4, evd
License: GPL (>=2)
exportPattern(IDF.read,IDF.fit,IDF.plot)
# Import all packages listed as Imports or Depends
import(
stats4,
evd
)
This diff is collapsed.
This diff is collapsed.
\name{IDF-package}
\alias{IDF-package}
\alias{IDF}
\docType{package}
\title{
Estimating intensity-duration-frequency parameters
}
\description{
The package 'IDF' reads precipitation data from webwerdis and Berlin Stadtmessnetz.
It aggregates these data and calculates yearly intensity maxima. From those maxima intensity-duration-frequency
parameters are estimated. IDF curves based on these estimated parameters can be plotted.
}
\details{
\tabular{ll}{
Package: \tab IDF\cr
Type: \tab Package\cr
Version: \tab 1.0\cr
Date: \tab 2015-07-16\cr
License: \tab GPL (>=2) \cr
}
}
\author{
Christoph Ritschel, Sarah Joedicke
Maintainer: Christoph Ritschel <christoph.ritschel@met.fu-berlin.de>
}
\references{
Koutsoyiannis et al. (1998)
}
\keyword{ package, IDF, parameter, estimation, optimization, GEV }
\seealso{
~~ \code{\link{optim}} ~~
~~ \code{\link[evd]{dgev}} ~~
}
\examples{
## file <- example.csv
## data <- IDF.read(file,"WebWerdis")
## fit <- IDF.fit(data)
## IDF.plot(fit$par)
}
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/IDF.R
\name{IDF.agg}
\alias{IDF.agg}
\title{Aggregation of a time series for seperated time steps}
\usage{
IDF.agg(x, ks=c(2,4,8,16,32,64,128))
}
\arguments{
\item{x}{a \code{list} containing a \code{data.frame} named 't1', preferably generated by function \code{IDF.read}.}
\item{ks}{a numeric \code{vector} of aggregatation levels. Each value represents an aggregation level and will create
a new \code{data.frame} in the output list.}
}
\value{
Liste a \code{list} containing \code{data.frames} of original and aggregated precipitation time series with time information and
precipitation values.
}
\description{
The function \code{IDF.agg} aggregates the precipitation values of a \code{data.frame} in a \code{list} in groups.
The list should be created by function \code{IDF.read} in a previous step.
}
\details{
This function is designed to aggregate data which has been read by function \code{IDF.read}.
The time given in the data is the end time, so the precipitation was added up to that time.
In this process the data will be summed up in groups, depending on the chosen aggregation levels. In the end,
the aggregated \code{data.frames} will be much shorter than the original one.
In the end, a new \code{list} containing several \code{data.frames} will be created. The first one will be the
initial data frame, now named agg0. The other data frames will be named 'agg' + the aggregation level number from ks.
}
\author{
Sarah Joedicke \email{sarah.joedicke@fu-berlin.de}
}
\seealso{
read.data, agg.f().
}
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/IDF.R
\name{IDF.fit}
\alias{IDF.fit}
\title{Fitting IDF model parameters to observations at different durations}
\usage{
IDF.fit(data, agg.lev = c(2, 3, 6, 12, 24, 48, 72, 96), month = "all",
mu = 1, sigma = 1, xi = 0, theta = 0, eta = 1, use.log = FALSE,
DEBUG = FALSE, method = "Nelder-Mead", upper = Inf, lower = -Inf,
plot = FALSE, station.name = "Berlin")
}
\arguments{
\item{data}{a \code{list} containing a \code{data.frame} named 't1', preferably generated by function \code{IDF.read}.}
\item{agg.lev}{a vector of aggregation levels used to fit the IDF curves.}
\item{month}{a value specifying the month to be used for estimating the IDF parameters. Type "all" for all months.}
\item{mu}{location value}
\item{sigma}{scale value}
\item{xi}{shape value}
\item{theta}{value defining the curvature of the IDF}
\item{eta}{value defining the slope of the IDF}
\item{use.log}{\code{logical} value for usage of logarithmic values, default is \code{FALSE}}
\item{DEBUG}{\code{logical} value for usage of debugging, if \code{TRUE} the input parameters and the value of negative
log-likelihood are printed on console for each iteration during optimization.}
\item{method}{\code{character} defining the method to be used in \code{optim}, preferences are: "Nelder-Mead", "BFGS", "L-BFGS-B"e}
\item{upper}{\code{vector} specifying the upper boundary of parameters for "L-BFGS-B" method}
\item{lower}{\code{vector} specifying the lower boundary of parameters for "L-BFGS-B" method}
\item{plot}{\code{logical} option of creating a plot of IDF curves with estimated parameters.}
\item{station.name}{\code{character} naming of data input, e.g. a observational station name}
}
\value{
$ints vector of sorted intensities for selected aggregation levels
$durs vector of sorted aggregation levels
$min minimum value of negative log-likelihood during optimization
$par vector of estimated IDF model parameters mu,sigma,xi,theta,eta at minimum value of negative log-likelihood.
}
\description{
The function \code{IDF.fit} fits the IDF model parameters \code{mu,sigma,xi,eta,theta}
to a list object of observations \code{data} in a data.frame with temporal inforamtion and values of precipitation
at a given temporal resoultion. This precipitation time series gets aggregated at given aggregation levels
\code{agg.lev} and yearly maxima of intensity are caluclated for a specific month or the whole year.
The starting values of the IDF model parameters can be determined by the user as well as specific options to use
during optimization. Logartihmic transformation, debugging, the optimization method, and an option to plot the
IDF curves.
}
\author{
Christoph Ritschel \email{christoph.ritschel@met.fu-berlin.de}
}
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/IDF.R
\name{IDF.magg}
\alias{IDF.magg}
\title{Moving aggregation of a time series}
\usage{
IDF.magg(x, ks=c(2,4,8,16,32,64,128))
}
\arguments{
\item{x}{a \code{list} containing a \code{data.frame} named 't1', preferably generated by function \code{IDF.read}.}
\item{ks}{a numeric \code{vector} of aggregatation levels. Each value represents an aggregation level and will create
a new \code{data.frame} in the output list.}
}
\value{
Liste a \code{list} containing \code{data.frames} of original and aggregated precipitation time series with time information and
precipitation values.
}
\description{
The function \code{IDF.magg} aggregates the precipitation values of a \code{data.frame} in a \code{list} by moving an aggregation
window over the time steps. The list should be created by funcntion \code{IDF.read} in a previous step.
}
\details{
This function is designed to aggregate data which has been read by function \code{IDF.read}.
The time given in the data is the end time, so the precipitation was added up to that time.
Every line of data will be used in this process. In the end, the data frames containing aggregated precipitation
will be exactly as long as the original one. In the end, a new \code{list} containing several \code{data.frames} will be created.
The first one will be the initial \code{data.frame}, now named agg0. The other data frames will be named 'agg' + the aggregation level number from ks.
}
\author{
Sarah Joedicke \email{sarah.joedicke@fu-berlin.de}
}
\seealso{
IDF.read, IDF.agg.
}
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/IDF.R
\name{IDF.max}
\alias{IDF.max}
\title{Yearly precipitation maximum}
\usage{
IDF.max(df, month = 1)
}
\arguments{
\item{df}{a \code{data.frame} containing date and time information and the corresponding precipitation values at a single aggregation level.}
\item{month}{a \code{value} defining the month to use. A single number between 1 and 12 selects the month. The \code{character string} "all"
can be used if the maximum for all months is needed.}
}
\value{
RR.max a \code{vector} containing the precipitation maxima for each year of a defined month or all months.
}
\description{
The function \code{IDF.max} generates an \code{vector} of yearly precipitation maxima from a \code{data.frame}
containing time information and precipitation data at a single aggregation level generated by functions \code{IDF.agg} or \code{IDF.magg}. An option
for selection a single month or search the whole year exists.
}
\author{
Christoph Ritschel \email{christoph.ritschel@met.fu-berlin.de}
}
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/IDF.R
\name{IDF.nll}
\alias{IDF.nll}
\title{Negativ log-likelihood of modified GEV}
\usage{
IDF.nll(mu = 0, sigma = 1, xi = 0, theta = 0, eta = 1, x, d,
use.log = F, DEBUG = F)
}
\arguments{
\item{mu}{location value}
\item{sigma}{scale value}
\item{xi}{shape value}
\item{theta}{value defining the curvature of the IDF}
\item{eta}{value defining the slope of the IDF}
\item{x}{vector of observations at different durations d}
\item{d}{vector of durations}
\item{use.log}{\code{logical} value for usage of logarithmic values, default is \code{FALSE}}
\item{DEBUG}{\code{logical} value for usage of debugging, if \code{TRUE} the input parameters and the value of negative
log-likelihood are printed on console.}
}
\value{
retruns weightes negative log-likelihood by number of observatons uesd
}
\description{
The function \code{IDF.nll} calculates the negative log-likelihood for a given set of model parameters
\code{mu,sigma,xi,theta,eta}, given observations \code{x} and given durations \code{d}. Options for the usage of
logartihmic values \code{use.log} and a debugging function \code{DEBUG} are available.
}
\author{
Christoph Ritschel \email{christoph.ritschel@met.fu-berlin.de}
}
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/IDF.R
\name{IDF.plot}
\alias{IDF.plot}
\title{Plotting IDF curves}
\usage{
IDF.plot(pars, probs = c(0.5, 0.9, 0.99), dur = c(0.5, 1, 2, 3, 6, 12, 24,
48, 72, 96), cols = c(rgb(1, 0, 0, 1), rgb(0, 1, 0, 1), rgb(0, 0, 1, 1)),
name = "Berlin-Dahlem", ints = NA, ds = NA)
}
\arguments{
\item{pars}{a vector of IDF model parameters mu,sigma,xi,eta,theta}
\item{probs}{a vector of probabilities for which the IDF curves are calculated}
\item{dur}{a vector of durations at which the IDF curves are calculated}
\item{cols}{a vector of colors for the seperate IDF curves, needs same length as \code{probs}}
\item{name}{a character string defining the station name for which the IDF curves are calculated, will be printed in legend}
\item{ints}{\code{vector} of observational intensities (surted by durations)}
\item{ds}{\code{vector} of durations (same length as intensities)}
}
\description{
The function \code{IDF.plot} plots a set of IDF curves with given IDF model parameters \code{pars} for
several probability levels \code{probs} at given durations \code{dur}. The colors of the curves can be defined with
parameter \code{cols} (need to have same length as \code{probs}). The \code{station.name} will be printed in the legend.
}
\author{
Christoph Ritschel \email{christoph.ritschel@met.fu-berlin.de}
}
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/IDF.R
\name{IDF.read}
\alias{IDF.read}
\title{Reading precipitation data}
\usage{
IDF.read(file, type)
}
\arguments{
\item{file}{a \code{character string} naming the file from which the data is to be read.}
\item{type}{a \code{character string} defining the type of data to be read: either "stadtmessnetz" or "webwerdis", depending on if the data comes from the Stadtmessnetz Berlin
or WebWerdis. If type = "webwerdis", the data will be read, then sorted, formatted and missing lines added,
while if type = "stadtmessnetz", the data will just be read and formatted.
Both source types have a different layout in the original file.}
}
\value{
Liste a \code{list} containing a \code{data.frame} of date and time information and precipitation values for each time step
}
\description{
The function \code{IDF.read} reads a file in table format and creates a \code{list} from it, writing the data frame as first entry
and adds some attributes (station information, aggregation time, data source). The only data values used are:
date, precipitation
The \code{data.frame} will have the following format:
| year | mon | day | hour | min | RR |
|------+-----+-----+------+-----+----+
| | | | | | |
}
\details{
This function is designed to prepare a data file for aggregation by functions \code{IDF.agg} or \code{IDF.magg}.
The time given in the data is the end time, so the precipitation was measured up to that time.
}
\note{
The first entry of the list will be a \code{data.frame} named 't1'.
}
\author{
Sarah Joedicke \email{sarah.joedicke@fu-berlin.de}
}
\seealso{
read.table, IDF.agg, IDF.magg
}
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/IDF.R
\name{dgev.d}
\alias{dgev.d}
\title{Density function of modified generalized extreme value distribution}
\usage{
dgev.d(q, mu = 0, sigma = 1, xi = 0, theta = 0, eta = 1, d = 1,
log = FALSE)
}
\arguments{
\item{q}{Vector of quantiles}
\item{mu}{location value}
\item{sigma}{scale value}
\item{xi}{shape value}
\item{theta}{value defining the curvature of the IDF}
\item{eta}{value defining the slope of the IDF}
\item{d}{vector of durations}
\item{log}{\code{logical} option to use logarithmic parameter values, default=FALSE}
}
\value{
dgev.d gives the density function
}
\description{
The function \code{dgev.d} is a modified version of the function \code{dgev} for different durations \code{d} developed by Koutsoyiannis et al. (1998).
}
\author{
Christoph Ritschel \email{christoph.ritschel@met.fu-berlin.de}
}
\seealso{
\code{\link[evd]{dgev}}
}
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/IDF.R
\name{fit.fun}
\alias{fit.fun}
\title{Fitting function to optimize IDF model parameters}
\usage{
fit.fun(obs, dur, mu = 1, sigma = 1, xi = 0.5, theta = 1, eta = 1,
use.log = F, DEBUG = F, method = "Nelder-Mead", upper = Inf,
lower = -Inf)
}
\arguments{
\item{obs}{vector of yearly intensity maxima at different durations. Order: Y1D1, Y2D1,...,YnD1,Y1D2,...YnD2,Y1D3,...,YnDk}
\item{dur}{vector of durations with same length as \code{obs}. Order: n x D1, n x D2, ... n x Dk}
\item{mu}{location value}
\item{sigma}{scale value}
\item{xi}{shape value}
\item{theta}{value defining the curvature of the IDF}
\item{eta}{value defining the slope of the IDF}
\item{use.log}{\code{logical} value for usage of logarithmic values, default is \code{FALSE}}
\item{DEBUG}{\code{logical} value for usage of debugging, if \code{TRUE} the input parameters and the value of negative
log-likelihood are printed on console for each iteration during optimization.}
\item{method}{\code{character} defining the method to be used in \code{optim}, preferences are: "Nelder-Mead", "BFGS", "L-BFGS-B"e}
\item{upper}{\code{vector} specifying the upper boundary of parameters for "L-BFGS-B" method}
\item{lower}{\code{vector} specifying the lower boundary of parameters for "L-BFGS-B" method}
}
\value{
$min value of negative log-likelihood at optimization minimum
$par vector of IDF parameters at optimization minimum
}
\description{
The function \code{fit.fun} fits IDF model parameters \code{mu,sigma,xi,theta,eta} to a set of given observations \code{obs},
typically a series of yearly maxima at different durations \code{d}. Options for using logarithmic parameter values and debugging
are given. Also the \code{optim} parameters \code{method} and \code{upper,lower} can be defined.
}
\author{
Christoph Ritschel \email{christoph.ritschel@met.fu-berlin.de}
}
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/IDF.R
\name{qgev.d}
\alias{qgev.d}
\title{Quantile function of modified generalized extreme value distribution}
\usage{
qgev.d(p, mu = 0, sigma = 1, xi = 0, theta = 0, eta = 1, d = 1,
lower.tail = TRUE)
}
\arguments{
\item{p}{Vector of probabilities}
\item{mu}{location value}
\item{sigma}{scale value}
\item{xi}{shape value}
\item{theta}{value defining the curvature of the IDF}
\item{eta}{value defining the slope of the IDF}
\item{d}{vector of durations}
\item{lower.tail}{\code{logical} if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]}
}
\value{
qgev.d gives the quantile function
}
\description{
The function \code{qgev.d} is a modified version of the function \code{qgev} for different durations \code{d} developed by Koutsoyiannis et al. (1998).
}
\author{
Christoph Ritschel \email{christoph.ritschel@met.fu-berlin.de}
}
\seealso{
\code{\link[evd]{qgev}}
}
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/IDF.R
\name{rgev.d}
\alias{rgev.d}
\title{Random generation for the modified generalized extreme value distribution}
\usage{
rgev.d(n, mu = 0, sigma = 1, xi = 0, theta = 0, eta = 1, d = 1)
}
\arguments{
\item{n}{Number of observations}
\item{mu}{location value}
\item{sigma}{scale value}
\item{xi}{shape value}
\item{theta}{value defining the curvature of the IDF}
\item{eta}{value defining the slope of the IDF}
\item{d}{vector of durations}
}
\value{
rgev.d generates random derivates
}
\description{
The function \code{rgev.d} is a modified version of the function \code{rgev} for different durations \code{d} developed by Koutsoyiannis et al. (1998).
}
\author{
Christoph Ritschel \email{christoph.ritschel@met.fu-berlin.de}
}
\seealso{
\code{\link[evd]{rgev}}
}
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