[spcopula-commits] r71 - / pkg pkg/R pkg/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Dec 18 13:10:32 CET 2012
Author: ben_graeler
Date: 2012-12-18 13:10:32 +0100 (Tue, 18 Dec 2012)
New Revision: 71
Added:
pkg/man/criticalLevel.Rd
pkg/man/genEmpCop.Rd
pkg/man/genEmpKenFun.Rd
pkg/man/genInvKenFun.Rd
pkg/man/kendallRP.Rd
pkg/man/unitScatter.Rd
pkg/man/vineCopula-class.Rd
pkg/man/vineCopula.Rd
spcopula_1.0.71.tar.gz
spcopula_1.0.71.zip
Removed:
spcopula_1.0.70.tar.gz
spcopula_1.0.70.zip
Modified:
pkg/DESCRIPTION
pkg/R/utilities.R
pkg/R/vineCopulas.R
Log:
- additional documentation
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2012-12-18 07:44:36 UTC (rev 70)
+++ pkg/DESCRIPTION 2012-12-18 12:10:32 UTC (rev 71)
@@ -1,7 +1,7 @@
Package: spcopula
Type: Package
Title: copula driven spatial analysis
-Version: 1.0.70
+Version: 1.0.71
Date: 2012-12-18
Author: Benedikt Graeler
Maintainer: Benedikt Graeler <ben.graeler at uni-muenster.de>
Modified: pkg/R/utilities.R
===================================================================
--- pkg/R/utilities.R 2012-12-18 07:44:36 UTC (rev 70)
+++ pkg/R/utilities.R 2012-12-18 12:10:32 UTC (rev 71)
@@ -61,7 +61,7 @@
}
##
-unitScatter <- function(formula=NULL, smpl, cuts=15, bandwidth=.075, transformation=function (x) x, ...) {
+unitScatter <- function(formula=NULL, smpl, ...) {
smpl <- as.data.frame(smpl)
if(is.null(formula)) {
if (ncol(smpl)>2) {
@@ -74,15 +74,15 @@
for(variable in all.vars(formula)){
if( min(smpl[,variable])<0 | max(smpl[,variable])>1) {
- smpl[,variable] <- rankTransform(smpl[,variable])
- warning("The variable ",variable," seems to exceed [0,1] and has been transformed using rankTransform.")
+ smpl[,variable] <- rank(smpl[,variable])/(length(smpl[,variable])+1)
+ warning("The variable ",variable," seems to exceed [0,1] and has been transformed using the rank order transformation.")
}
}
xyplot(formula, smpl, aspect="iso", xlim=c(0,1), ylim=c(0,1), ...)
}
-univScatter <- function(formula=NULL, smpl, cuts=15, bandwidth=.075, transformation=function (x) x, ...) {
+univScatter <- function(formula=NULL, smpl) {
warning("Use unitScatter instead!")
- unitScatter(formula, smpl, cuts, bandwidth, transformation, ...)
+ unitScatter(formula, smpl)
}
\ No newline at end of file
Modified: pkg/R/vineCopulas.R
===================================================================
--- pkg/R/vineCopulas.R 2012-12-18 07:44:36 UTC (rev 70)
+++ pkg/R/vineCopulas.R 2012-12-18 12:10:32 UTC (rev 71)
@@ -18,23 +18,28 @@
}
setClass("vineCopula",
- representation = representation(copulas="list", dimension="integer", type="character", pdf="numeric"),
+ representation = representation(copulas="list", dimension="integer",
+ type="character"),
validity = validVineCopula,
contains = list("copula")
)
# constructor
vineCopula <- function (copulas, dim, type) {
- val <- new("vineCopula", copulas=copulas, dimension = dim, parameters = numeric(),
- param.names = character(), param.lowbnd = numeric(), param.upbnd = numeric(), type=type, pdf=numeric(), fullname = paste(type, "copula family."))
- val
+ new("vineCopula", copulas=copulas, dimension = as.integer(dim), parameters = numeric(),
+ param.names = character(), param.lowbnd = numeric(),
+ param.upbnd = numeric(), type=type,
+ fullname = paste(type, "copula family."))
}
showVineCopula <- function(object) {
cat(object at fullname, "\n")
cat("Dimension: ", object at dimension, "\n")
cat("Copulas:\n")
- for (i in (1:length(object at copulas))) cat(" ", class(object at copulas[[i]]), "with parameter(s)", object at copulas[[i]]@parameters, "\n")
+ for (i in (1:length(object at copulas))) {
+ cat(" ", class(object at copulas[[i]]), "with parameter(s)",
+ object at copulas[[i]]@parameters, "\n")
+ }
}
setMethod("show", signature("vineCopula"), showVineCopula)
@@ -150,8 +155,6 @@
return(den(copula, u, log))
}
-
-
setMethod("dCopula", signature("numeric","vineCopula"), dvineCopula)
setMethod("dCopula", signature("matrix","vineCopula"), dvineCopula)
Added: pkg/man/criticalLevel.Rd
===================================================================
--- pkg/man/criticalLevel.Rd (rev 0)
+++ pkg/man/criticalLevel.Rd 2012-12-18 12:10:32 UTC (rev 71)
@@ -0,0 +1,44 @@
+\name{criticalLevel}
+\alias{criticalLevel}
+\title{
+Calculating the critical level for a given Kendall Return Period
+}
+\description{
+The critical level corresponding to a given Kendall Return Period and a given
+kendall distribution or its underlying copula.
+}
+\usage{
+criticalLevel(kendallFun = NULL, KRP = c(100, 1000), mu = 1, copula = NULL)
+}
+\arguments{
+ \item{kendallFun}{
+The kendall distribution function.
+}
+ \item{KRP}{
+The desired Kendall Return Period(s); the feault are 100 and 1000.
+}
+ \item{mu}{
+The reoccurence of an event per time unit; the default is 1.
+}
+ \item{copula}{
+The copula describing the dependencies between the investigated variables. Only necessary if \code{kendallFun} is not provided.
+}
+}
+\value{
+A vector of the same length as \code{KRP} with the corresponding critical levels.
+}
+\references{
+Salvadori, G., De Michele, C., and Durante, F.: On the return period and design in a multivariate framework, Hydrol. Earth Syst. Sci., 15, 3293-3305, doi:10.5194/hess-15-3293-2011, 2011.
+}
+\author{
+Benedikt Graeler
+}
+
+\seealso{
+\code{\link{kendallRP}} for the reverse direction: what is the Kendall Return Period for a given critical level?
+}
+\examples{
+criticalLevel(getKendallDistr(frankCopula(.7)), KRP=c(10,100,1000))
+}
+\keyword{ survival }
+\keyword{ multivariate }
\ No newline at end of file
Added: pkg/man/genEmpCop.Rd
===================================================================
--- pkg/man/genEmpCop.Rd (rev 0)
+++ pkg/man/genEmpCop.Rd 2012-12-18 12:10:32 UTC (rev 71)
@@ -0,0 +1,33 @@
+\name{genEmpCop}
+\alias{genEmpCop}
+\title{
+Generate an empirical copula
+}
+\description{
+Generates an empirical copula from a sample and returns the corresponding function.
+}
+\usage{
+genEmpCop(data)
+}
+\arguments{
+ \item{data}{
+The sample to be used as input for the empirical copula.
+}
+}
+\value{
+The empirical copula as a function (the multivariate cdf).
+}
+\author{
+Benedikt Graeler
+}
+
+\examples{
+empCop <- genEmpCop(rCopula(500, frankCopula(0.7)))
+
+# the empirical value
+empCop(c(0.3, 0.5))
+
+# the theoretical value
+pCopula(c(0.3, 0.5), frankCopula(0.7))
+}
+\keyword{ multivariate }
\ No newline at end of file
Added: pkg/man/genEmpKenFun.Rd
===================================================================
--- pkg/man/genEmpKenFun.Rd (rev 0)
+++ pkg/man/genEmpKenFun.Rd 2012-12-18 12:10:32 UTC (rev 71)
@@ -0,0 +1,35 @@
+\name{genEmpKenFun}
+\alias{genEmpKenFun}
+\title{
+Generates an emprical Kendall distribution function
+}
+\description{
+Generates an emprical Kendall distribution function in cases where no closed form exists. When a sample is provided (\code{smpl}) this exact sample is used to derive the empirical Kendall distribution function. Otherweise, a sample will be generated from the porovided copula.
+}
+\usage{
+genEmpKenFun(copula, sample = NULL)
+}
+\arguments{
+ \item{copula}{
+The underlying copula from which 1e6 samples are drawn by default.
+}
+ \item{sample}{
+Optional, a specific sample that should be used to generate the emopircal Kendall distribution function.
+}
+}
+\value{
+A function returning the corresponding empirical Kendalll distribution value.
+}
+\author{
+Benedikt Graeler
+}
+
+\seealso{
+\code{\link{getKendallDistr}} for the closed form of the Kendall distribution function.
+}
+\examples{
+empKenFun <- genEmpKenFun(frankCopula(0.7), rCopula(500, frankCopula(0.7)))
+empKenFun(.9)
+}
+\keyword{ multivariate }
+\keyword{ distribution }
Added: pkg/man/genInvKenFun.Rd
===================================================================
--- pkg/man/genInvKenFun.Rd (rev 0)
+++ pkg/man/genInvKenFun.Rd 2012-12-18 12:10:32 UTC (rev 71)
@@ -0,0 +1,38 @@
+\name{genInvKenFun}
+\alias{genInvKenFun}
+\title{
+Generate the inverse Kendall distribution function
+}
+\description{
+The inverse of a (empirical) Kendall distribution function is generated based on numerical inversion using optimise.
+}
+\usage{
+genInvKenFun(kenFun, ...)
+}
+\arguments{
+ \item{kenFun}{
+The (empirical) Kendall distribution function to be inverted.
+}
+ \item{\dots}{
+Control options passed on to \code{\link{optimise}}.
+}
+}
+\value{
+The inverse of a Kendall distribution function as a function.
+}
+\author{
+Benedikt Graeler
+}
+
+\seealso{
+\code{\link{genEmpKenFun}} and \code{\link{getKendallDistr}} for the Kendall distribution function.
+}
+\examples{
+frankKenDistrFun <- getKendallDistr(frankCopula(.5))
+frankInvKenDitrFun <- genInvKenFun(frankKenDistrFun)
+
+frankInvKenDitrFun(.8)
+frankKenDistrFun(frankInvKenDitrFun(.8))
+}
+\keyword{ multivariate }
+\keyword{ distribution }
Added: pkg/man/kendallRP.Rd
===================================================================
--- pkg/man/kendallRP.Rd (rev 0)
+++ pkg/man/kendallRP.Rd 2012-12-18 12:10:32 UTC (rev 71)
@@ -0,0 +1,43 @@
+\name{kendallRP}
+\alias{kendallRP}
+\title{
+calculating the Kendall Return Period
+}
+\description{
+The Kendall Return Period corresponding to a given critical level and a given
+kendall distribution or its underlying copula.
+}
+\usage{
+kendallRP(kendallFun = NULL, cl = c(0.99, 0.999), mu = 1, copula = NULL)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+ \item{kendallFun}{
+The kendall distribution function.
+}
+ \item{cl}{
+The desired critical level(s): the default are 0.99 and 0.999.
+}
+ \item{mu}{
+The reoccurence of an event per time unit; the default is 1.
+}
+ \item{copula}{
+The copula describing the dependencies between the investigated variables. Only necessary if \code{kendallFun} is not provided.
+}
+}
+\value{
+A vector of the same length as \code{cl} with the corresponding endall Return Perios.}
+\references{
+Salvadori, G., De Michele, C., and Durante, F.: On the return period and design in a multivariate framework, Hydrol. Earth Syst. Sci., 15, 3293-3305, doi:10.5194/hess-15-3293-2011, 2011.
+}
+\author{
+Benedikt Graeler
+}
+\seealso{
+\code{\link{criticalLevel}} for the reverse direction: what is the critical level for a given Kendall Return Period?
+}
+\examples{
+kendallRP(getKendallDistr(frankCopula(7)), cl=c(0.9,0.99,0.999))
+}
+\keyword{ survival }
+\keyword{ multivariate }
\ No newline at end of file
Added: pkg/man/unitScatter.Rd
===================================================================
--- pkg/man/unitScatter.Rd (rev 0)
+++ pkg/man/unitScatter.Rd 2012-12-18 12:10:32 UTC (rev 71)
@@ -0,0 +1,36 @@
+\name{unitScatter}
+\alias{unitScatter}
+\alias{univScatter}
+\title{
+A scatterplot on the unit-sqaure
+}
+\description{
+Plots a sample on the unit-square. If needed, it will transform the sample using the rank order transformation as in \code{\link{rankTransform}}.
+}
+\usage{
+unitScatter(formula = NULL, smpl, ...)
+}
+\arguments{
+ \item{formula}{
+A standard plotting formula to select the corresponding columns.
+}
+ \item{smpl}{
+The data set to be used.
+}
+\item{...}{
+Passed on to \code{\link{xyplot}}.
+}
+}
+\value{
+A lattice plot.
+}
+\author{
+Benedikt Graeler
+}
+\examples{
+data(loss)
+rt_loss <- rankTransform(loss[,1:2])
+unitScatter(loss~alae,rt_loss)
+}
+\keyword{ hplot }
+
Added: pkg/man/vineCopula-class.Rd
===================================================================
--- pkg/man/vineCopula-class.Rd (rev 0)
+++ pkg/man/vineCopula-class.Rd 2012-12-18 12:10:32 UTC (rev 71)
@@ -0,0 +1,42 @@
+\name{vineCopula-class}
+\Rdversion{1.1}
+\docType{class}
+\alias{vineCopula-class}
+
+\title{Class \code{"vineCopula"}}
+\description{
+A class representing vine copulas in a object oriented implementations. Many functions go back to the package \code{\link{CDVine-package}}
+}
+\section{Objects from the Class}{
+Objects can be created by calls of the form \code{new("vineCopula", ...)} or through the function \code{\link{vineCopula}}.
+}
+\section{Slots}{
+ \describe{
+ \item{\code{copulas}:}{Object of class \code{"list"} holding all copulas. }
+ \item{\code{dimension}:}{Object of class \code{"integer"}; the vines dimension. }
+ \item{\code{type}:}{Object of class \code{"character"} defining the type of the vine (either \"c-vine\" or \"d-vine\").}
+ \item{\code{parameters}:}{Object of class \code{"numeric"}: empty }
+ \item{\code{param.names}:}{Object of class \code{"character"}: empty }
+ \item{\code{param.lowbnd}:}{Object of class \code{"numeric"}: empty }
+ \item{\code{param.upbnd}:}{Object of class \code{"numeric"}: empty }
+ \item{\code{fullname}:}{Object of class \code{"character"} providing a descriptive name of the vine copula.}
+ }
+}
+\section{Extends}{
+Class \code{"\linkS4class{copula}"}, directly.
+Class \code{"\linkS4class{Copula}"}, by class "copula", distance 2.
+}
+\section{Methods}{
+No additional methods yet, but uses e.g. \code{\link{dCopula}}, \code{\link{pCopula}}, \code{\link{rCopula}} as any other copula.
+}
+\references{
+Aas, K., C. Czado, A. Frigessi, and H. Bakken (2009). Pair-copula constructions of multiple dependence Insurance: Mathematics and Economics 44 (2), 182-198.
+}
+\author{
+Benedikt Graeler
+}
+
+\examples{
+showClass("vineCopula")
+}
+\keyword{classes}
Added: pkg/man/vineCopula.Rd
===================================================================
--- pkg/man/vineCopula.Rd (rev 0)
+++ pkg/man/vineCopula.Rd 2012-12-18 12:10:32 UTC (rev 71)
@@ -0,0 +1,40 @@
+\name{vineCopula}
+\alias{vineCopula}
+\title{
+Constructor of the class \code{\linkS4class{vineCopula}}.
+}
+\description{
+Cosntruct an instance of the \code{\linkS4class{vineCopula}} class.
+}
+\usage{
+vineCopula(copulas, dim, type)
+}
+\arguments{
+ \item{copulas}{
+A list of copulas that build up the vine.
+}
+ \item{dim}{
+The dimension of the vine copula.
+}
+ \item{type}{
+The type of the vine, either \"c-vine\" or \"d-vine\".
+}
+}
+\value{
+An instance of the \code{\linkS4class{vineCopula}} class.
+}
+\references{
+Aas, K., C. Czado, A. Frigessi, and H. Bakken (2009). Pair-copula constructions of multiple dependence Insurance: Mathematics and Economics 44 (2), 182-198.
+}
+\author{
+Benedikt Graeler
+}
+\examples{
+vine <- vineCopula(list(frankCopula(.7), gumbelCopula(3), gumbelCopula(1)),
+ 3, "c-vine")
+
+if(require(lattice))
+ cloud(V1~V2+V3, as.data.frame(rCopula(500,vine)))
+}
+\keyword{ mulitvariate }
+\keyword{ distribution }
Deleted: spcopula_1.0.70.tar.gz
===================================================================
(Binary files differ)
Deleted: spcopula_1.0.70.zip
===================================================================
(Binary files differ)
Added: spcopula_1.0.71.tar.gz
===================================================================
(Binary files differ)
Property changes on: spcopula_1.0.71.tar.gz
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: spcopula_1.0.71.zip
===================================================================
(Binary files differ)
Property changes on: spcopula_1.0.71.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
More information about the spcopula-commits
mailing list