[spcopula-commits] r81 - in pkg: . R demo man src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jan 25 16:25:45 CET 2013
Author: ben_graeler
Date: 2013-01-25 16:25:45 +0100 (Fri, 25 Jan 2013)
New Revision: 81
Added:
pkg/R/wrappingCFunctions.R
pkg/src/
pkg/src/cdvine.c
pkg/src/hfunc.c
pkg/src/likelihood.c
pkg/src/memoryhandling.c
pkg/src/tools.c
pkg/src/vine.h
Modified:
pkg/DESCRIPTION
pkg/NAMESPACE
pkg/R/BB1copula.R
pkg/R/BB6copula.R
pkg/R/BB7copula.R
pkg/R/BB8copula.R
pkg/R/Classes.R
pkg/R/ClaytonGumbelCopula.R
pkg/R/asCopula.R
pkg/R/cqsCopula.R
pkg/R/empiricalCopula.R
pkg/R/joeBiCopula.R
pkg/R/leafCopula.R
pkg/R/linkingCDVine.R
pkg/R/partialDerivatives.R
pkg/R/returnPeriods.R
pkg/R/spCopula.R
pkg/R/spatialPreparation.R
pkg/R/stCopula.R
pkg/R/utilities.R
pkg/R/vineCopulas.R
pkg/demo/00Index
pkg/demo/MRP.R
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/asCopula-class.Rd
pkg/man/asCopula.Rd
pkg/man/calcBins.Rd
pkg/man/composeSpCopula.Rd
pkg/man/cqsCopula-class.Rd
pkg/man/cqsCopula.Rd
pkg/man/criticalLevel.Rd
pkg/man/criticalPair.Rd
pkg/man/criticalTriple.Rd
pkg/man/dduCopula-methods.Rd
pkg/man/dduCopula.Rd
pkg/man/ddvCopula-methods.Rd
pkg/man/dependencePlot.Rd
pkg/man/empiricalCopula-class.Rd
pkg/man/empiricalCopula.Rd
pkg/man/fitCorFun.Rd
pkg/man/fitSpCopula.Rd
pkg/man/genEmpCop.Rd
pkg/man/genEmpKenFun.Rd
pkg/man/genInvKenFun.Rd
pkg/man/getKendallDistr.Rd
pkg/man/getNeighbours.Rd
pkg/man/invdduCopula-methods.Rd
pkg/man/invddvCopula-methods.Rd
pkg/man/joeBiCopula-class.Rd
pkg/man/joeBiCopula.Rd
pkg/man/kendallDistribution.Rd
pkg/man/kendallRP.Rd
pkg/man/loglikByCopulasLags.Rd
pkg/man/neighbourhood-class.Rd
pkg/man/neighbourhood.Rd
pkg/man/qCopula_u.Rd
pkg/man/rankTransform.Rd
pkg/man/simulatedTriples.Rd
pkg/man/spCopDemo.Rd
pkg/man/spCopula-class.Rd
pkg/man/spCopula.Rd
pkg/man/spcopula-package.Rd
pkg/man/stCopula-class.Rd
pkg/man/surClaytonCopula-class.Rd
pkg/man/surClaytonCopula.Rd
pkg/man/surGumbelCopula-class.Rd
pkg/man/surGumbelCopula.Rd
pkg/man/unitScatter.Rd
pkg/man/vineCopula-class.Rd
pkg/man/vineCopula.Rd
Log:
- modified EOL treatment in svn
- borrowed C-Code from CDVine
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2013-01-23 11:37:45 UTC (rev 80)
+++ pkg/DESCRIPTION 2013-01-25 15:25:45 UTC (rev 81)
@@ -1,32 +1,33 @@
-Package: spcopula
-Type: Package
-Title: copula driven spatial analysis
-Version: 0.1-1
-Date: 2013-01-23
-Author: Benedikt Graeler
-Maintainer: Benedikt Graeler <ben.graeler at uni-muenster.de>
-Description: This package provides a framework to analyse via copulas spatial and spatio-temporal data provided in the format of the spacetime package. Additionally, support for calculating different multivariate return periods is implemented.
-License: GPL-2
-LazyLoad: yes
-Depends: copula (>= 0.999-5), spacetime (>= 1.0-2), CDVine, methods, R (>= 2.15.0)
-URL: http://r-forge.r-project.org/projects/spcopula/
-Collate:
- Classes.R
- empiricalCopula.R
- partialDerivatives.R
- cqsCopula.R
- asCopula.R
- leafCopula.R
- spCopula.R
- stCopula.R
- spatialPreparation.R
- linkingCDVine.R
- BB1copula.R
- BB6copula.R
- BB7copula.R
- BB8copula.R
- joeBiCopula.R
- ClaytonGumbelCopula.R
- vineCopulas.R
- utilities.R
- returnPeriods.R
+Package: spcopula
+Type: Package
+Title: copula driven spatial analysis
+Version: 0.1-1
+Date: 2013-01-23
+Author: Benedikt Graeler
+Maintainer: Benedikt Graeler <ben.graeler at uni-muenster.de>
+Description: This package provides a framework to analyse via copulas spatial and spatio-temporal data provided in the format of the spacetime package. Additionally, support for calculating different multivariate return periods is implemented.
+License: GPL-2
+LazyLoad: yes
+Depends: copula (>= 0.999-5), spacetime (>= 1.0-2), CDVine, methods, R (>= 2.15.0)
+URL: http://r-forge.r-project.org/projects/spcopula/
+Collate:
+ Classes.R
+ empiricalCopula.R
+ partialDerivatives.R
+ cqsCopula.R
+ asCopula.R
+ leafCopula.R
+ spCopula.R
+ stCopula.R
+ spatialPreparation.R
+ wrappingCFunctions.R
+ linkingCDVine.R
+ BB1copula.R
+ BB6copula.R
+ BB7copula.R
+ BB8copula.R
+ joeBiCopula.R
+ ClaytonGumbelCopula.R
+ vineCopulas.R
+ utilities.R
+ returnPeriods.R
Property changes on: pkg/DESCRIPTION
___________________________________________________________________
Added: svn:eol-style
+ LF
Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE 2013-01-23 11:37:45 UTC (rev 80)
+++ pkg/NAMESPACE 2013-01-25 15:25:45 UTC (rev 81)
@@ -1,51 +1,53 @@
-import(copula, spacetime, CDVine)
-
-# constructor
-export(asCopula, cqsCopula, leafCopula)
-export(BB1Copula, surBB1Copula, r90BB1Copula, r270BB1Copula)
-export(BB6Copula, surBB6Copula, r90BB6Copula, r270BB6Copula)
-export(BB7Copula, surBB7Copula, r90BB7Copula, r270BB7Copula)
-export(BB8Copula, surBB8Copula, r90BB8Copula, r270BB8Copula)
-export(joeBiCopula, surJoeBiCopula, r90JoeBiCopula, r270JoeBiCopula)
-export(surClaytonCopula, r90ClaytonCopula, r270ClaytonCopula)
-export(surGumbelCopula, r90GumbelCopula, r270GumbelCopula)
-export(vineCopula)
-export(neighbourhood)
-export(empiricalCopula, genEmpCop)
-
-# general functions
-export(rankTransform, dependencePlot, unitScatter, univScatter)
-export(fitCopula)
-export(dduCopula,ddvCopula)
-export(invdduCopula, invddvCopula)
-export(qCopula_u)
-
-# tweaks
-# export(setSizeLim)
-
-# spatial
-export(getNeighbours)
-export(calcBins)
-
-# fitting
-export(fitCorFun, loglikByCopulasLags, fitSpCopula, composeSpCopula)
-export(spCopula)
-
-# MRP functions
-export(genEmpKenFun, genInvKenFun)
-export(kendallRP, criticalLevel, kendallDistribution, getKendallDistr)
-export(criticalPair, criticalTriple)
-
-## classes
-exportClasses(asCopula, cqsCopula, neighbourhood, empiricalCopula, leafCopula)
-
-# wrappers to CDVine
-exportClasses(BB1Copula, surBB1Copula, r90BB1Copula, r270BB1Copula)
-exportClasses(BB6Copula, surBB6Copula, r90BB6Copula, r270BB6Copula)
-exportClasses(BB7Copula, surBB7Copula, r90BB7Copula, r270BB7Copula)
-exportClasses(BB8Copula, surBB8Copula, r90BB8Copula, r270BB8Copula)
-exportClasses(joeBiCopula, surJoeBiCopula, r90JoeBiCopula, r270JoeBiCopula)
-exportClasses(surClaytonCopula, r90ClaytonCopula, r270ClaytonCopula)
-exportClasses(surGumbelCopula, r90GumbelCopula, r270GumbelCopula)
-
-exportClasses(vineCopula, spCopula, stCopula)
\ No newline at end of file
+import(copula, spacetime, CDVine)
+
+# constructor
+export(asCopula, cqsCopula)
+export(BB1Copula, surBB1Copula, r90BB1Copula, r270BB1Copula)
+export(BB6Copula, surBB6Copula, r90BB6Copula, r270BB6Copula)
+export(BB7Copula, surBB7Copula, r90BB7Copula, r270BB7Copula)
+export(BB8Copula, surBB8Copula, r90BB8Copula, r270BB8Copula)
+export(joeBiCopula, surJoeBiCopula, r90JoeBiCopula, r270JoeBiCopula)
+export(surClaytonCopula, r90ClaytonCopula, r270ClaytonCopula)
+export(surGumbelCopula, r90GumbelCopula, r270GumbelCopula)
+export(vineCopula)
+export(neighbourhood)
+export(empiricalCopula, genEmpCop)
+
+# general functions
+export(rankTransform, dependencePlot, unitScatter, univScatter)
+export(fitCopula)
+export(dduCopula,ddvCopula)
+export(invdduCopula, invddvCopula)
+export(qCopula_u)
+
+# tweaks
+# export(setSizeLim)
+
+# spatial
+export(getNeighbours)
+export(calcBins)
+
+# fitting
+export(fitCorFun, loglikByCopulasLags, fitSpCopula, composeSpCopula)
+export(spCopula)
+
+# MRP functions
+export(genEmpKenFun, genInvKenFun)
+export(kendallRP, criticalLevel, kendallDistribution, getKendallDistr)
+export(criticalPair, criticalTriple)
+
+## classes
+exportClasses(asCopula, cqsCopula, neighbourhood, empiricalCopula)
+
+# wrappers to CDVine
+exportClasses(BB1Copula, surBB1Copula, r90BB1Copula, r270BB1Copula)
+exportClasses(BB6Copula, surBB6Copula, r90BB6Copula, r270BB6Copula)
+exportClasses(BB7Copula, surBB7Copula, r90BB7Copula, r270BB7Copula)
+exportClasses(BB8Copula, surBB8Copula, r90BB8Copula, r270BB8Copula)
+exportClasses(joeBiCopula, surJoeBiCopula, r90JoeBiCopula, r270JoeBiCopula)
+exportClasses(surClaytonCopula, r90ClaytonCopula, r270ClaytonCopula)
+exportClasses(surGumbelCopula, r90GumbelCopula, r270GumbelCopula)
+
+exportClasses(vineCopula, spCopula, stCopula)
+
+useDynLib("spcopula")
\ No newline at end of file
Property changes on: pkg/NAMESPACE
___________________________________________________________________
Added: svn:eol-style
+ LF
Modified: pkg/R/BB1copula.R
===================================================================
--- pkg/R/BB1copula.R 2013-01-23 11:37:45 UTC (rev 80)
+++ pkg/R/BB1copula.R 2013-01-25 15:25:45 UTC (rev 81)
@@ -1,260 +1,260 @@
-#####################
-## ##
-## the BB1 copulas ##
-## ##
-#####################
-# Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73, London: Chapman and Hall.
-
-validBB1Copula = function(object) {
- if (object at dimension != 2)
- return("Only BB1 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")
- else return (TRUE)
-}
-
-setClass("BB1Copula",
- representation = representation("copula", family="numeric"),
- validity = validBB1Copula,
- contains = list("copula")
-)
-
-# constructor
-BB1Copula <- function (param) {
- if (any(is.na(param) | param >= c(Inf,Inf) | param[1] <= 0 | param[2] < 1))
- stop(paste("Parameter values out of bounds: theta: (0,Inf), delta: [1,Inf)."))
- new("BB1Copula", dimension = as.integer(2), parameters = param,
- param.names = c("theta", "delta"), param.lowbnd = c(0, 1), param.upbnd = c(Inf, Inf),
- family=7, fullname = "BB1 copula family. Number 7 in CDVine.")
-}
-
-## density ##
-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"),
- 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"),
- 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"),
- 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)
-
-## kendall distribution/measure
-kendall.BB1 <- function(copula, t){
- theta = copula at parameters[1]
- delta = copula at parameters[2]
-
- kt <- rep(NA,length(t))
- kt <- t + 1/(theta * delta) * (t^(-theta) - 1)/(t^(-1 - theta))
- kt[t==1] <- 1
- kt[t==0] <- 0
- return(kt)
-}
-
-setMethod("kendallDistribution", signature("BB1Copula"), kendall.BB1)
-
-setMethod("getKendallDistr", signature("BB1Copula"), function(copula) return(function(t) kendall.BB1(copula, t)) )
-
-setMethod("tau",signature("BB1Copula"),linkCDVine.tau)
-setMethod("tailIndex",signature("BB1Copula"),linkCDVine.tailIndex)
-
-#########################
-## BB1 survival copula ##
-#########################
-
-setClass("surBB1Copula",
- representation = representation("copula", family="numeric"),
- validity = validBB1Copula,
- contains = list("copula")
-)
-
-# constructor
-surBB1Copula <- function (param) {
- if (any(is.na(param) | param >= c(Inf,Inf) | param[1] <= 0 | param[2] < 1))
- stop(paste("Parameter values out of bounds: theta: (0,Inf), delta: [1,Inf)."))
- new("surBB1Copula", dimension = as.integer(2), parameters = param,
- param.names = c("theta", "delta"), param.lowbnd = c(0, 1), param.upbnd = c(Inf, Inf),
- family=17, fullname = "Survival BB1 copula family. Number 17 in CDVine.")
-}
-
-## density ##
-setMethod("dCopula", signature("numeric","surBB1Copula"),
- function(u, copula, log) {
- linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
- })
-setMethod("dCopula", signature("matrix","surBB1Copula"), linkCDVine.PDF)
-
-## jcdf ##
-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"),
- 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"),
- function(u, copula, ...) {
- linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
- })
-setMethod("ddvCopula", signature("matrix","surBB1Copula"), linkCDVine.ddv)
-
-## random number generator
-setMethod("rCopula", signature("numeric","surBB1Copula"), linkCDVine.r)
-
-setMethod("tau",signature("surBB1Copula"),linkCDVine.tau)
-setMethod("tailIndex",signature("surBB1Copula"),linkCDVine.tailIndex)
-
-#######################
-## BB1 copula 90 deg ##
-#######################
-
-validRotBB1Copula = function(object) {
- if (object at dimension != 2)
- return("Only BB1 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")
- else return (TRUE)
-}
-
-setClass("r90BB1Copula",
- representation = representation("copula", family="numeric"),
- validity = validRotBB1Copula,
- contains = list("copula")
-)
-
-# constructor
-r90BB1Copula <- function (param) {
- if (any(is.na(param) | param[1] >= 0 | param[2] > -1 | param <= c(-Inf,-Inf)))
- stop(paste("Parameter values out of bounds: theta: (-Inf,0), delta: (-Inf,-1]."))
- new("r90BB1Copula", dimension = as.integer(2), parameters = param,
- param.names = c("theta", "delta"), param.lowbnd = c(-Inf, -Inf), param.upbnd = c(0, -1),
- family=27, fullname = "90 deg rotated BB1 copula family. Number 27 in CDVine.")
-}
-BiCopCDF
-## density ##
-setMethod("dCopula", signature("numeric","r90BB1Copula"),
- function(u, copula, log) {
- linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
- })
-setMethod("dCopula", signature("matrix","r90BB1Copula"), linkCDVine.PDF)
-
-## jcdf ##
-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"),
- 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"),
- 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)
-
-setMethod("tau",signature("r90BB1Copula"),linkCDVine.tau)
-setMethod("tailIndex",signature("r90BB1Copula"),linkCDVine.tailIndex)
-
-########################
-## BB1 copula 270 deg ##
-########################
-
-setClass("r270BB1Copula",
- representation = representation("copula", family="numeric"),
- validity = validRotBB1Copula,
- contains = list("copula")
-)
-
-# constructor
-r270BB1Copula <- function (param) {
- if (any(is.na(param) | param[1] >= 0 | param[2] > -1 | param <= c(-Inf,-Inf)))
- stop(paste("Parameter values out of bounds: theta: (-Inf,0), delta: (-Inf,-1]."))
- new("r270BB1Copula", dimension = as.integer(2), parameters = param,
- param.names = c("theta", "delta"), param.lowbnd = c(-Inf, -Inf), param.upbnd = c(0, -1),
- family=37, fullname = "270 deg rotated BB1 copula family. Number 37 in CDVine.")
-}
-
-## density ##
-setMethod("dCopula", signature("numeric","r270BB1Copula"),
- function(u, copula, log) {
- linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
- })
-setMethod("dCopula", signature("matrix","r270BB1Copula"), linkCDVine.PDF)
-
-## jcdf ##
-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"),
- 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"),
- 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)
-
-setMethod("tau",signature("r270BB1Copula"),linkCDVine.tau)
+#####################
+## ##
+## the BB1 copulas ##
+## ##
+#####################
+# Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73, London: Chapman and Hall.
+
+validBB1Copula = function(object) {
+ if (object at dimension != 2)
+ return("Only BB1 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")
+ else return (TRUE)
+}
+
+setClass("BB1Copula",
+ representation = representation("copula", family="numeric"),
+ validity = validBB1Copula,
+ contains = list("copula")
+)
+
+# constructor
+BB1Copula <- function (param) {
+ if (any(is.na(param) | param >= c(Inf,Inf) | param[1] <= 0 | param[2] < 1))
+ stop(paste("Parameter values out of bounds: theta: (0,Inf), delta: [1,Inf)."))
+ new("BB1Copula", dimension = as.integer(2), parameters = param,
+ param.names = c("theta", "delta"), param.lowbnd = c(0, 1), param.upbnd = c(Inf, Inf),
+ family=7, fullname = "BB1 copula family. Number 7 in CDVine.")
+}
+
+## density ##
+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"),
+ 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"),
+ 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"),
+ 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)
+
+## kendall distribution/measure
+kendall.BB1 <- function(copula, t){
+ theta = copula at parameters[1]
+ delta = copula at parameters[2]
+
+ kt <- rep(NA,length(t))
+ kt <- t + 1/(theta * delta) * (t^(-theta) - 1)/(t^(-1 - theta))
+ kt[t==1] <- 1
+ kt[t==0] <- 0
+ return(kt)
+}
+
+setMethod("kendallDistribution", signature("BB1Copula"), kendall.BB1)
+
+setMethod("getKendallDistr", signature("BB1Copula"), function(copula) return(function(t) kendall.BB1(copula, t)) )
+
+setMethod("tau",signature("BB1Copula"),linkCDVine.tau)
+setMethod("tailIndex",signature("BB1Copula"),linkCDVine.tailIndex)
+
+#########################
+## BB1 survival copula ##
+#########################
+
+setClass("surBB1Copula",
+ representation = representation("copula", family="numeric"),
+ validity = validBB1Copula,
+ contains = list("copula")
+)
+
+# constructor
+surBB1Copula <- function (param) {
+ if (any(is.na(param) | param >= c(Inf,Inf) | param[1] <= 0 | param[2] < 1))
+ stop(paste("Parameter values out of bounds: theta: (0,Inf), delta: [1,Inf)."))
+ new("surBB1Copula", dimension = as.integer(2), parameters = param,
+ param.names = c("theta", "delta"), param.lowbnd = c(0, 1), param.upbnd = c(Inf, Inf),
+ family=17, fullname = "Survival BB1 copula family. Number 17 in CDVine.")
+}
+
+## density ##
+setMethod("dCopula", signature("numeric","surBB1Copula"),
+ function(u, copula, log) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
+ })
+setMethod("dCopula", signature("matrix","surBB1Copula"), linkCDVine.PDF)
+
+## jcdf ##
+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"),
+ 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"),
+ function(u, copula, ...) {
+ linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+ })
+setMethod("ddvCopula", signature("matrix","surBB1Copula"), linkCDVine.ddv)
+
+## random number generator
+setMethod("rCopula", signature("numeric","surBB1Copula"), linkCDVine.r)
+
+setMethod("tau",signature("surBB1Copula"),linkCDVine.tau)
+setMethod("tailIndex",signature("surBB1Copula"),linkCDVine.tailIndex)
+
+#######################
+## BB1 copula 90 deg ##
+#######################
+
+validRotBB1Copula = function(object) {
+ if (object at dimension != 2)
+ return("Only BB1 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")
+ else return (TRUE)
+}
+
+setClass("r90BB1Copula",
+ representation = representation("copula", family="numeric"),
+ validity = validRotBB1Copula,
+ contains = list("copula")
+)
+
+# constructor
+r90BB1Copula <- function (param) {
+ if (any(is.na(param) | param[1] >= 0 | param[2] > -1 | param <= c(-Inf,-Inf)))
+ stop(paste("Parameter values out of bounds: theta: (-Inf,0), delta: (-Inf,-1]."))
+ new("r90BB1Copula", dimension = as.integer(2), parameters = param,
+ param.names = c("theta", "delta"), param.lowbnd = c(-Inf, -Inf), param.upbnd = c(0, -1),
+ family=27, fullname = "90 deg rotated BB1 copula family. Number 27 in CDVine.")
+}
+BiCopCDF
+## density ##
+setMethod("dCopula", signature("numeric","r90BB1Copula"),
+ function(u, copula, log) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
+ })
+setMethod("dCopula", signature("matrix","r90BB1Copula"), linkCDVine.PDF)
+
+## jcdf ##
+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"),
+ 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"),
+ 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)
+
+setMethod("tau",signature("r90BB1Copula"),linkCDVine.tau)
+setMethod("tailIndex",signature("r90BB1Copula"),linkCDVine.tailIndex)
+
+########################
+## BB1 copula 270 deg ##
+########################
+
+setClass("r270BB1Copula",
+ representation = representation("copula", family="numeric"),
+ validity = validRotBB1Copula,
+ contains = list("copula")
+)
+
+# constructor
+r270BB1Copula <- function (param) {
+ if (any(is.na(param) | param[1] >= 0 | param[2] > -1 | param <= c(-Inf,-Inf)))
+ stop(paste("Parameter values out of bounds: theta: (-Inf,0), delta: (-Inf,-1]."))
+ new("r270BB1Copula", dimension = as.integer(2), parameters = param,
+ param.names = c("theta", "delta"), param.lowbnd = c(-Inf, -Inf), param.upbnd = c(0, -1),
+ family=37, fullname = "270 deg rotated BB1 copula family. Number 37 in CDVine.")
+}
+
+## density ##
+setMethod("dCopula", signature("numeric","r270BB1Copula"),
+ function(u, copula, log) {
+ linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
+ })
+setMethod("dCopula", signature("matrix","r270BB1Copula"), linkCDVine.PDF)
+
+## jcdf ##
+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"),
+ 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"),
+ 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)
+
+setMethod("tau",signature("r270BB1Copula"),linkCDVine.tau)
setMethod("tailIndex",signature("r270BB1Copula"),linkCDVine.tailIndex)
\ No newline at end of file
Property changes on: pkg/R/BB1copula.R
___________________________________________________________________
Added: svn:eol-style
+ LF
Modified: pkg/R/BB6copula.R
===================================================================
--- pkg/R/BB6copula.R 2013-01-23 11:37:45 UTC (rev 80)
+++ pkg/R/BB6copula.R 2013-01-25 15:25:45 UTC (rev 81)
@@ -1,263 +1,263 @@
-#####################
-## ##
-## 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) {
- if (any(is.na(param) | param >= c(Inf, Inf) | param < c(1,1)))
- stop("Parameter value(s) out of bound(s): theta: [1,Inf), delta: [1,Inf).")
- 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.")
-}
-
-## 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)))
-
-setMethod("tau",signature("BB6Copula"),linkCDVine.tau)
-setMethod("tailIndex",signature("BB6Copula"),linkCDVine.tailIndex)
-
-#########################
-## BB6 survival copula ##
-#########################
-
-setClass("surBB6Copula",
- representation = representation("copula", family="numeric"),
- validity = validBB6Copula,
- contains = list("copula")
-)
-
-# constructor
-surBB6Copula <- function (param) {
- if (any(is.na(param) | param >= c(Inf, Inf) | param < c(1,1)))
- stop("Parameter value(s) out of bound(s): theta: [1,Inf), delta: [1,Inf).")
- 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.")
-}
-
-## density ##
-setMethod("dCopula", signature("numeric","surBB6Copula"),
- function(u, copula, log) {
- linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
- })
-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)
-
-setMethod("tau",signature("surBB6Copula"),linkCDVine.tau)
-setMethod("tailIndex",signature("surBB6Copula"),linkCDVine.tailIndex)
-
-#######################
-## 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")
- else return (TRUE)
-}
-
-setClass("r90BB6Copula",
- representation = representation("copula", family="numeric"),
- validity = validRotBB6Copula,
- contains = list("copula")
-)
-
-# constructor
-r90BB6Copula <- function (param) {
- if (any(is.na(param) | param > c(-1,-1) | param <= c(-Inf,-Inf)))
- stop("Parameter value out of bound: theta: (-Inf,1], delta: (-Inf,1].")
- 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.")
-}
-
-## density ##
-setMethod("dCopula", signature("numeric","r90BB6Copula"),
- function(u, copula, log) {
- linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula,log)
- })
-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
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/spcopula -r 81
More information about the spcopula-commits
mailing list