[spcopula-commits] r66 - in pkg: . R demo man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Oct 30 17:47:24 CET 2012
Author: ben_graeler
Date: 2012-10-30 17:47:24 +0100 (Tue, 30 Oct 2012)
New Revision: 66
Added:
pkg/demo/spcopula_estimation.R
pkg/man/BB1Copula-class.Rd
pkg/man/BB1Copula.Rd
pkg/man/BB6Copula-class.Rd
pkg/man/BB6Copula.Rd
pkg/man/BB7Copula-class.Rd
pkg/man/BB7Copula.Rd
pkg/man/BB8Copula-class.Rd
pkg/man/BB8Copula.Rd
pkg/man/JoeCopula-class.Rd
pkg/man/JoeCopula.Rd
pkg/man/asCopula-class.Rd
pkg/man/asCopula.Rd
pkg/man/calcBins.Rd
pkg/man/cqsCopula-class.Rd
pkg/man/cqsCopula.Rd
pkg/man/dduCopula.Rd
Modified:
pkg/
pkg/DESCRIPTION
pkg/R/BB1copula.R
pkg/R/BB6copula.R
pkg/R/BB8copula.R
pkg/R/JoeCopula.R
pkg/R/partialDerivatives.R
pkg/R/spatialPreparation.R
pkg/demo/00Index
Log:
- many fixes due to the changes in "copula"
- finally, some documentation
Property changes on: pkg
___________________________________________________________________
Added: svn:ignore
+ .Rproj.user
.Rhistory
.RData
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2012-10-19 15:22:31 UTC (rev 65)
+++ pkg/DESCRIPTION 2012-10-30 16:47:24 UTC (rev 66)
@@ -1,8 +1,8 @@
Package: spcopula
Type: Package
Title: copula driven spatial analysis
-Version: 1.0.65
-Date: 2012-10-19
+Version: 1.0.66
+Date: 2012-10-30
Author: Benedikt Graeler
Maintainer: Benedikt Graeler <ben.graeler at uni-muenster.de>
Description: This package provides a framework to analyse spatial data provided in the format of the spacetime package with copulas. Additionally, support for calculating multivariate return periods is implemented.
Modified: pkg/R/BB1copula.R
===================================================================
--- pkg/R/BB1copula.R 2012-10-19 15:22:31 UTC (rev 65)
+++ pkg/R/BB1copula.R 2012-10-30 16:47:24 UTC (rev 66)
@@ -34,17 +34,33 @@
}
## density ##
-setMethod("dCopula", signature("numeric","BB1Copula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","BB1Copula"),
+ function(u, copula, log) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
+ })
+setMethod("dCopula", signature("matrix","BB1Copula"), function(u, copula, log) linkCDVine.PDF(u, copula, log))
## jcdf ##
-setMethod("pCopula", signature("numeric","BB1Copula"), linkCDVine.CDF)
+setMethod("pCopula", signature("numeric","BB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","BB1Copula"), linkCDVine.CDF)
## partial derivatives ##
# ddu
-setMethod("dduCopula", signature("numeric","BB1Copula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","BB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","BB1Copula"), linkCDVine.ddu)
# ddv
-setMethod("ddvCopula", signature("numeric","BB1Copula"), linkCDVine.ddv)
+setMethod("ddvCopula", signature("numeric","BB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","BB1Copula"), linkCDVine.ddv)
## random number generator
setMethod("rCopula", signature("numeric","BB1Copula"), linkCDVine.r)
@@ -82,17 +98,33 @@
}
## density ##
-setMethod("dCopula", signature("numeric","surBB1Copula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","surBB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dCopula", signature("matrix","surBB1Copula"), linkCDVine.PDF)
## jcdf ##
-setMethod("pCopula", signature("numeric","surBB1Copula"), linkCDVine.surCDF)
-
+setMethod("pCopula", signature("numeric","surBB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","surBB1Copula"), linkCDVine.surCDF)
+
## partial derivatives ##
# ddu
-setMethod("dduCopula", signature("numeric","surBB1Copula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","surBB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","surBB1Copula"), linkCDVine.ddu)
# ddv
-setMethod("ddvCopula", signature("numeric","surBB1Copula"), linkCDVine.ddv)
+setMethod("ddvCopula", signature("numeric","surBB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","surBB1Copula"), linkCDVine.ddv)
## random number generater ??
setMethod("rCopula", signature("numeric","surBB1Copula"), linkCDVine.r)
@@ -129,17 +161,33 @@
}
## density ##
-setMethod("dCopula", signature("numeric","r90BB1Copula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","r90BB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dCopula", signature("matrix","r90BB1Copula"), linkCDVine.PDF)
## jcdf ##
-setMethod("pCopula", signature("numeric","r90BB1Copula"), linkCDVine.r90CDF)
+setMethod("pCopula", signature("numeric","r90BB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","r90BB1Copula"), linkCDVine.r90CDF)
## partial derivatives ##
# ddu
-setMethod("dduCopula", signature("numeric","r90BB1Copula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","r90BB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","r90BB1Copula"), linkCDVine.ddu)
## ddv
-setMethod("ddvCopula", signature("numeric","r90BB1Copula"), linkCDVine.ddv)
+setMethod("ddvCopula", signature("numeric","r90BB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","r90BB1Copula"), linkCDVine.ddv)
## random number generator
setMethod("rCopula", signature("numeric","r90BB1Copula"), linkCDVine.r)
@@ -161,17 +209,33 @@
}
## density ##
-setMethod("dCopula", signature("numeric","r270BB1Copula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","r270BB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dCopula", signature("matrix","r270BB1Copula"), linkCDVine.PDF)
## jcdf ##
-setMethod("pCopula", signature("numeric","r270BB1Copula"), linkCDVine.r270CDF)
-
+setMethod("pCopula", signature("numeric","r270BB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","r270BB1Copula"), linkCDVine.r270CDF)
+
## partial derivatives ##
# ddu
-setMethod("dduCopula", signature("numeric","r270BB1Copula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","r270BB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","r270BB1Copula"), linkCDVine.ddu)
# ddv
-setMethod("ddvCopula", signature("numeric","r270BB1Copula"), linkCDVine.ddv)
+setMethod("ddvCopula", signature("numeric","r270BB1Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","r270BB1Copula"), linkCDVine.ddv)
## random number generator
setMethod("rCopula", signature("numeric","r270BB1Copula"), linkCDVine.r)
\ No newline at end of file
Modified: pkg/R/BB6copula.R
===================================================================
--- pkg/R/BB6copula.R 2012-10-19 15:22:31 UTC (rev 65)
+++ pkg/R/BB6copula.R 2012-10-30 16:47:24 UTC (rev 66)
@@ -1,180 +1,242 @@
-#####################
-## ##
-## the BB6 copulas ##
-## ##
-#####################
-# Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73, London: Chapman and Hall.
-
-validBB6Copula = function(object) {
- if (object at dimension != 2)
- return("Only BB6 copulas of dimension 2 are supported.")
- param <- object at parameters
- upper <- object at param.upbnd
- lower <- object at param.lowbnd
- if (length(param) != length(upper))
- return("Parameter and upper bound have non-equal length")
- if (length(param) != length(lower))
- return("Parameter and lower bound have non-equal length")
- if (any(is.na(param) | param >= upper | param < lower))
- return("Parameter value out of bound.")
- else return (TRUE)
-}
-
-setClass("BB6Copula",
- representation = representation("copula", family="numeric"),
- validity = validBB6Copula,
- contains = list("copula")
-)
-
-# constructor
-BB6Copula <- function (param) {
- val <- new("BB6Copula", dimension = as.integer(2), parameters = param,
- param.names = c("theta", "delta"), param.lowbnd = c(1, 1), param.upbnd = c(Inf, Inf), family=8, fullname = "BB6 copula family. Number 8 in CDVine.")
- val
-}
-
-## density ##
-setMethod("dCopula", signature("numeric","BB6Copula"), linkCDVine.PDF)
-
-## jcdf ##
-setMethod("pCopula", signature("numeric","BB6Copula"), linkCDVine.CDF)
-
-## partial derivatives ##
-# ddu
-setMethod("dduCopula", signature("numeric","BB6Copula"), linkCDVine.ddu)
-
-# ddv
-setMethod("ddvCopula", signature("numeric","BB6Copula"), linkCDVine.ddv)
-
-## random number generater ??
-setMethod("rCopula", signature("numeric","BB6Copula"), linkCDVine.r)
-
-## kendall distribution/measure, taken from CDVine:::obs.stat
-kendall.BB6 <- function(copula, t){
- theta = copula at parameters[1]
- delta = copula at parameters[2]
-
- kt <- rep(NA,length(t))
- kt <- t + log(-(1 - t)^theta + 1) * (1 - t - (1 - t)^(-theta) + (1 - t)^(-theta) * t)/(delta * theta)
- kt[t==1] <- 1
- kt[t==0] <- 0
- return(kt)
-}
-
-setMethod("kendallDistribution", signature("BB6Copula"), kendall.BB6)
-
-setMethod("getKendallDistr", signature("BB6Copula"),
- function(copula) return(function(t) kendall.BB6(copula, t)))
-
-#########################
-## BB6 survival copula ##
-#########################
-
-setClass("surBB6Copula",
- representation = representation("copula", family="numeric"),
- validity = validBB6Copula,
- contains = list("copula")
-)
-
-# constructor
-surBB6Copula <- function (param) {
- val <- new("surBB6Copula", dimension = as.integer(2), parameters = param, param.names = c("theta", "delta"), param.lowbnd = c(1, 1), param.upbnd = c(Inf, Inf), family=18, fullname = "Survival BB6 copula family. Number 18 in CDVine.")
- val
-}
-
-## density ##
-setMethod("dCopula", signature("numeric","surBB6Copula"), linkCDVine.PDF)
-
-## jcdf ##
-setMethod("pCopula", signature("numeric","surBB6Copula"), linkCDVine.surCDF)
-
-## partial derivatives ##
-# ddu
-setMethod("dduCopula", signature("numeric","surBB6Copula"), linkCDVine.ddu)
-
-# ddv
-setMethod("ddvCopula", signature("numeric","surBB6Copula"), linkCDVine.ddv)
-
-## random number generator
-setMethod("rCopula", signature("numeric","surBB6Copula"), linkCDVine.r)
-
-#######################
-## BB6 copula 90 deg ##
-#######################
-
-validRotBB6Copula = function(object) {
- if (object at dimension != 2)
- return("Only BB6 copulas of dimension 2 are supported.")
- param <- object at parameters
- upper <- object at param.upbnd
- lower <- object at param.lowbnd
- if (length(param) != length(upper))
- return("Parameter and upper bound have non-equal length")
- if (length(param) != length(lower))
- return("Parameter and lower bound have non-equal length")
- if (any(is.na(param) | param > upper | param <= lower))
- return("Parameter value out of bound")
- else return (TRUE)
-}
-
-setClass("r90BB6Copula",
- representation = representation("copula", family="numeric"),
- validity = validRotBB6Copula,
- contains = list("copula")
-)
-
-# constructor
-r90BB6Copula <- function (param) {
- val <- new("r90BB6Copula", dimension = as.integer(2), parameters = param, param.names = c("theta", "delta"), param.lowbnd = c(-Inf, -Inf), param.upbnd = c(-1, -1), family=28, fullname = "90 deg rotated BB6 copula family. Number 28 in CDVine.")
- val
-}
-
-## density ##
-setMethod("dCopula", signature("numeric","r90BB6Copula"), linkCDVine.PDF)
-
-## jcdf ##
-setMethod("pCopula", signature("numeric","r90BB6Copula"), linkCDVine.r90CDF)
-# persp(r90BB6Copula(c(-1.329995,-1.1201476)), pcopula)
-
-## partial derivatives ##
-# ddu
-setMethod("dduCopula", signature("numeric","r90BB6Copula"), linkCDVine.ddu)
-
-## ddv
-setMethod("ddvCopula", signature("numeric","r90BB6Copula"), linkCDVine.ddv)
-
-## random number generator
-setMethod("rCopula", signature("numeric","r90BB6Copula"), linkCDVine.r)
-# rcopula(r90BB6Copula(c(-5.329995,-1.1201476)),500)
-
-#####################
-## BB6 copula 270� ##
-#####################
-
-setClass("r270BB6Copula",
- representation = representation("copula", family="numeric"),
- validity = validRotBB6Copula,
- contains = list("copula")
-)
-
-# constructor
-r270BB6Copula <- function (param) {
- val <- new("r270BB6Copula", dimension = as.integer(2), parameters = param, param.names = c("theta", "delta"), param.lowbnd = c(-Inf, -Inf), param.upbnd = c(-1, -1), family=38, fullname = "270 deg rotated BB6 copula family. Number 38 in CDVine.")
- val
-}
-
-## density ##
-setMethod("dCopula", signature("numeric","r270BB6Copula"), linkCDVine.PDF)
-
-## jcdf ##
-setMethod("pCopula", signature("numeric","r270BB6Copula"), linkCDVine.r270CDF)
-
-## partial derivatives ##
-# ddu
-setMethod("dduCopula", signature("numeric","r270BB6Copula"), linkCDVine.ddu)
-
-# ddv
-setMethod("ddvCopula", signature("numeric","r270BB6Copula"), linkCDVine.ddv)
-
-## random number generator
+#####################
+## ##
+## the BB6 copulas ##
+## ##
+#####################
+# Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73, London: Chapman and Hall.
+
+validBB6Copula = function(object) {
+ if (object at dimension != 2)
+ return("Only BB6 copulas of dimension 2 are supported.")
+ param <- object at parameters
+ upper <- object at param.upbnd
+ lower <- object at param.lowbnd
+ if (length(param) != length(upper))
+ return("Parameter and upper bound have non-equal length")
+ if (length(param) != length(lower))
+ return("Parameter and lower bound have non-equal length")
+ if (any(is.na(param) | param >= upper | param < lower))
+ return("Parameter value out of bound.")
+ else return (TRUE)
+}
+
+setClass("BB6Copula",
+ representation = representation("copula", family="numeric"),
+ validity = validBB6Copula,
+ contains = list("copula")
+)
+
+# constructor
+BB6Copula <- function (param) {
+ val <- new("BB6Copula", dimension = as.integer(2), parameters = param,
+ param.names = c("theta", "delta"), param.lowbnd = c(1, 1), param.upbnd = c(Inf, Inf), family=8, fullname = "BB6 copula family. Number 8 in CDVine.")
+ val
+}
+
+## density ##
+setMethod("dCopula", signature("numeric","BB6Copula"),
+ function(u, copula, log) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
+ })
+setMethod("dCopula", signature("matrix","BB6Copula"), function(u, copula, log) linkCDVine.PDF(u, copula, log))
+
+## jcdf ##
+setMethod("pCopula", signature("numeric","BB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","BB6Copula"), linkCDVine.CDF)
+
+## partial derivatives ##
+# ddu
+setMethod("dduCopula", signature("numeric","BB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","BB6Copula"), linkCDVine.ddu)
+
+# ddv
+setMethod("ddvCopula", signature("numeric","BB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","BB6Copula"), linkCDVine.ddv)
+
+## random number generater ??
+setMethod("rCopula", signature("numeric","BB6Copula"), linkCDVine.r)
+
+## kendall distribution/measure, taken from CDVine:::obs.stat
+kendall.BB6 <- function(copula, t){
+ theta = copula at parameters[1]
+ delta = copula at parameters[2]
+
+ kt <- rep(NA,length(t))
+ kt <- t + log(-(1 - t)^theta + 1) * (1 - t - (1 - t)^(-theta) + (1 - t)^(-theta) * t)/(delta * theta)
+ kt[t==1] <- 1
+ kt[t==0] <- 0
+ return(kt)
+}
+
+setMethod("kendallDistribution", signature("BB6Copula"), kendall.BB6)
+
+setMethod("getKendallDistr", signature("BB6Copula"),
+ function(copula) return(function(t) kendall.BB6(copula, t)))
+
+#########################
+## BB6 survival copula ##
+#########################
+
+setClass("surBB6Copula",
+ representation = representation("copula", family="numeric"),
+ validity = validBB6Copula,
+ contains = list("copula")
+)
+
+# constructor
+surBB6Copula <- function (param) {
+ val <- new("surBB6Copula", dimension = as.integer(2), parameters = param, param.names = c("theta", "delta"), param.lowbnd = c(1, 1), param.upbnd = c(Inf, Inf), family=18, fullname = "Survival BB6 copula family. Number 18 in CDVine.")
+ val
+}
+
+## density ##
+setMethod("dCopula", signature("numeric","surBB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dCopula", signature("matrix","surBB6Copula"), linkCDVine.PDF)
+
+## jcdf ##
+setMethod("pCopula", signature("numeric","surBB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","surBB6Copula"), linkCDVine.surCDF)
+
+## partial derivatives ##
+# ddu
+setMethod("dduCopula", signature("numeric","surBB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","surBB6Copula"), linkCDVine.ddu)
+
+# ddv
+setMethod("ddvCopula", signature("numeric","surBB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","surBB6Copula"), linkCDVine.ddv)
+
+## random number generator
+setMethod("rCopula", signature("numeric","surBB6Copula"), linkCDVine.r)
+
+#######################
+## BB6 copula 90 deg ##
+#######################
+
+validRotBB6Copula = function(object) {
+ if (object at dimension != 2)
+ return("Only BB6 copulas of dimension 2 are supported.")
+ param <- object at parameters
+ upper <- object at param.upbnd
+ lower <- object at param.lowbnd
+ if (length(param) != length(upper))
+ return("Parameter and upper bound have non-equal length")
+ if (length(param) != length(lower))
+ return("Parameter and lower bound have non-equal length")
+ if (any(is.na(param) | param > upper | param <= lower))
+ return("Parameter value out of bound")
+ else return (TRUE)
+}
+
+setClass("r90BB6Copula",
+ representation = representation("copula", family="numeric"),
+ validity = validRotBB6Copula,
+ contains = list("copula")
+)
+
+# constructor
+r90BB6Copula <- function (param) {
+ val <- new("r90BB6Copula", dimension = as.integer(2), parameters = param, param.names = c("theta", "delta"), param.lowbnd = c(-Inf, -Inf), param.upbnd = c(-1, -1), family=28, fullname = "90 deg rotated BB6 copula family. Number 28 in CDVine.")
+ val
+}
+
+## density ##
+setMethod("dCopula", signature("numeric","r90BB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dCopula", signature("matrix","r90BB6Copula"), linkCDVine.PDF)
+
+## jcdf ##
+setMethod("pCopula", signature("numeric","r90BB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","r90BB6Copula"), linkCDVine.r90CDF)
+
+## partial derivatives ##
+# ddu
+setMethod("dduCopula", signature("numeric","r90BB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","r90BB6Copula"), linkCDVine.ddu)
+
+## ddv
+setMethod("ddvCopula", signature("numeric","r90BB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","r90BB6Copula"), linkCDVine.ddv)
+
+## random number generator
+setMethod("rCopula", signature("numeric","r90BB6Copula"), linkCDVine.r)
+
+###########################
+## BB6 copula 270 degree ##
+###########################
+
+setClass("r270BB6Copula",
+ representation = representation("copula", family="numeric"),
+ validity = validRotBB6Copula,
+ contains = list("copula")
+)
+
+# constructor
+r270BB6Copula <- function (param) {
+ val <- new("r270BB6Copula", dimension = as.integer(2), parameters = param, param.names = c("theta", "delta"), param.lowbnd = c(-Inf, -Inf), param.upbnd = c(-1, -1), family=38, fullname = "270 deg rotated BB6 copula family. Number 38 in CDVine.")
+ val
+}
+
+## density ##
+setMethod("dCopula", signature("numeric","r270BB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dCopula", signature("matrix","r270BB6Copula"), linkCDVine.PDF)
+
+## jcdf ##
+setMethod("pCopula", signature("numeric","r270BB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","r270BB6Copula"), linkCDVine.r270CDF)
+
+## partial derivatives ##
+# ddu
+setMethod("dduCopula", signature("numeric","r270BB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","r270BB6Copula"), linkCDVine.ddu)
+
+# ddv
+setMethod("ddvCopula", signature("numeric","r270BB6Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","r270BB6Copula"), linkCDVine.ddv)
+
+## random number generator
setMethod("rCopula", signature("numeric","r270BB6Copula"), linkCDVine.r)
\ No newline at end of file
Modified: pkg/R/BB8copula.R
===================================================================
--- pkg/R/BB8copula.R 2012-10-19 15:22:31 UTC (rev 65)
+++ pkg/R/BB8copula.R 2012-10-30 16:47:24 UTC (rev 66)
@@ -34,17 +34,33 @@
}
## density ##
-setMethod("dCopula", signature("numeric","BB8Copula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","BB8Copula"),
+ function(u, copula, log) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
+ })
+setMethod("dCopula", signature("matrix","BB8Copula"), function(u, copula, log) linkCDVine.PDF(u, copula, log))
## jcdf ##
-setMethod("pCopula", signature("numeric","BB8Copula"), linkCDVine.CDF)
+setMethod("pCopula", signature("numeric","BB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","BB8Copula"), linkCDVine.CDF)
## partial derivatives ##
-## ddu
-setMethod("dduCopula", signature("numeric","BB8Copula"),linkCDVine.ddu)
+# ddu
+setMethod("dduCopula", signature("numeric","BB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","BB8Copula"), linkCDVine.ddu)
-## ddv
-setMethod("ddvCopula", signature("numeric","BB8Copula"),linkCDVine.ddv)
+# ddv
+setMethod("ddvCopula", signature("numeric","BB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","BB8Copula"), linkCDVine.ddv)
## random number generator
setMethod("rCopula", signature("numeric","BB8Copula"),linkCDVine.r)
@@ -83,17 +99,33 @@
}
## density ##
-setMethod("dCopula", signature("numeric","surBB8Copula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","surBB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dCopula", signature("matrix","surBB8Copula"), linkCDVine.PDF)
## jcdf ##
-setMethod("pCopula", signature("numeric","surBB8Copula"), linkCDVine.surCDF)
+setMethod("pCopula", signature("numeric","surBB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","surBB8Copula"), linkCDVine.surCDF)
## partial derivatives ##
-## ddu
-setMethod("dduCopula", signature("numeric","surBB8Copula"), linkCDVine.ddu)
+# ddu
+setMethod("dduCopula", signature("numeric","surBB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","surBB8Copula"), linkCDVine.ddu)
-## ddv
-setMethod("ddvCopula", signature("numeric","surBB8Copula"), linkCDVine.ddv)
+# ddv
+setMethod("ddvCopula", signature("numeric","surBB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","surBB8Copula"), linkCDVine.ddv)
## random number generator
setMethod("rCopula", signature("numeric","surBB8Copula"), linkCDVine.r)
@@ -130,24 +162,40 @@
}
## density ##
-setMethod("dCopula", signature("numeric","r90BB8Copula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","r90BB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dCopula", signature("matrix","r90BB8Copula"), linkCDVine.PDF)
## jcdf ##
-setMethod("pCopula", signature("numeric","r90BB8Copula"), linkCDVine.r90CDF)
-
+setMethod("pCopula", signature("numeric","r90BB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","r90BB8Copula"), linkCDVine.r90CDF)
+
## partial derivatives ##
# ddu
-setMethod("dduCopula", signature("numeric","r90BB8Copula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","r90BB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","r90BB8Copula"), linkCDVine.ddu)
## ddv
-setMethod("ddvCopula", signature("numeric","r90BB8Copula"), linkCDVine.ddv)
+setMethod("ddvCopula", signature("numeric","r90BB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","r90BB8Copula"), linkCDVine.ddv)
## random number generator
setMethod("rCopula", signature("numeric","r90BB8Copula"), linkCDVine.r)
-#####################
-## BB8 copula 270� ##
-#####################
+###########################
+## BB8 copula 270 degree ##
+###########################
setClass("r270BB8Copula",
representation = representation("copula", family="numeric"),
@@ -162,17 +210,33 @@
}
## density ##
-setMethod("dCopula", signature("numeric","r270BB8Copula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","r270BB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dCopula", signature("matrix","r270BB8Copula"), linkCDVine.PDF)
## jcdf ##
-setMethod("pCopula", signature("numeric","r270BB8Copula"), linkCDVine.r270CDF)
-
+setMethod("pCopula", signature("numeric","r270BB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","r270BB8Copula"), linkCDVine.r270CDF)
+
## partial derivatives ##
# ddu
-setMethod("dduCopula", signature("numeric","r270BB8Copula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","r270BB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","r270BB8Copula"), linkCDVine.ddu)
# ddv
-setMethod("ddvCopula", signature("numeric","r270BB8Copula"), linkCDVine.ddv)
+setMethod("ddvCopula", signature("numeric","r270BB8Copula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","r270BB8Copula"), linkCDVine.ddv)
## random number generator
setMethod("rCopula", signature("numeric","r270BB8Copula"), linkCDVine.r)
\ No newline at end of file
Modified: pkg/R/JoeCopula.R
===================================================================
--- pkg/R/JoeCopula.R 2012-10-19 15:22:31 UTC (rev 65)
+++ pkg/R/JoeCopula.R 2012-10-30 16:47:24 UTC (rev 66)
@@ -28,25 +28,41 @@
# constructor
JoeCopula <- function (param) {
- new("JoeCopula", dimension = as.integer(2), parameters = param, param.names = c("theta", "delta"),
+ new("JoeCopula", dimension = as.integer(2), parameters = param, param.names = c("theta"),
param.lowbnd = 1, param.upbnd = Inf, family=6,
fullname = "Joe copula family. Number 6 in CDVine.")
}
## density ##
-setMethod("dCopula", signature("numeric","JoeCopula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","JoeCopula"),
+ function(u, copula, log) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
+ })
+setMethod("dCopula", signature("matrix","JoeCopula"), function(u, copula, log) linkCDVine.PDF(u, copula, log))
## jcdf ##
-setMethod("pCopula", signature("numeric","JoeCopula"), linkCDVine.CDF)
+setMethod("pCopula", signature("numeric","JoeCopula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","JoeCopula"), linkCDVine.CDF)
## partial derivatives ##
# ddu
-setMethod("dduCopula", signature("numeric","JoeCopula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","JoeCopula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","JoeCopula"), linkCDVine.ddu)
# ddv
-setMethod("ddvCopula", signature("numeric","JoeCopula"), linkCDVine.ddv)
+setMethod("ddvCopula", signature("numeric","JoeCopula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","JoeCopula"), linkCDVine.ddv)
-## random number generater ??
+## random number generater
setMethod("rCopula", signature("numeric","JoeCopula"), linkCDVine.r)
## Kendalls tau to parameter conversion
@@ -90,19 +106,35 @@
}
## density ##
-setMethod("dCopula", signature("numeric","surJoeCopula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","surJoeCopula"),
+ function(u, copula, ...) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dCopula", signature("matrix","surJoeCopula"), linkCDVine.PDF)
## jcdf ##
-setMethod("pCopula", signature("numeric","surJoeCopula"), linkCDVine.surCDF)
-
+setMethod("pCopula", signature("numeric","surJoeCopula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","surJoeCopula"), linkCDVine.surCDF)
+
## partial derivatives ##
# ddu
-setMethod("dduCopula", signature("numeric","surJoeCopula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","surJoeCopula"),
+ function(u, copula, ...) {
+ linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dduCopula", signature("matrix","surJoeCopula"), linkCDVine.ddu)
# ddv
-setMethod("ddvCopula", signature("numeric","surJoeCopula"), linkCDVine.ddv)
+setMethod("ddvCopula", signature("numeric","surJoeCopula"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","surJoeCopula"), linkCDVine.ddv)
-## random number generater ??
+## random number generater
setMethod("rCopula", signature("numeric","surJoeCopula"), linkCDVine.r)
## Kendalls tau to parameter conversion
@@ -145,17 +177,33 @@
}
## density ##
-setMethod("dCopula", signature("numeric","r90JoeCopula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","r90JoeCopula"),
+ function(u, copula, ...) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("dCopula", signature("matrix","r90JoeCopula"), linkCDVine.PDF)
## jcdf ##
-setMethod("pCopula", signature("numeric","r90JoeCopula"), linkCDVine.r90CDF)
+setMethod("pCopula", signature("numeric","r90JoeCopula"),
+ function(u, copula, ...) {
+ linkCDVine.CDF(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("pCopula", signature("matrix","r90JoeCopula"), linkCDVine.r90CDF)
## partial derivatives ##
# ddu
-setMethod("dduCopula", signature("numeric","r90JoeCopula"), linkCDVine.ddu)
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/spcopula -r 66
More information about the spcopula-commits
mailing list