[spcopula-commits] r67 - in pkg: . R data demo man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Oct 31 15:44:39 CET 2012


Author: ben_graeler
Date: 2012-10-31 15:44:39 +0100 (Wed, 31 Oct 2012)
New Revision: 67

Added:
   pkg/data/spCopDemo.RData
   pkg/man/dduCopula-methods.Rd
   pkg/man/ddvCopula-methods.Rd
   pkg/man/fitCorFun.Rd
   pkg/man/invdduCopula-methods.Rd
   pkg/man/invddvCopula-methods.Rd
   pkg/man/loglikByCopulasLags.Rd
   pkg/man/simulatedTriples.Rd
   pkg/man/spCopula-class.Rd
   pkg/man/spCopula.Rd
   pkg/man/spcopula-package.Rd
   pkg/man/surClaytonCopula-class.Rd
   pkg/man/surGumbelCopula-class.Rd
Removed:
   pkg/man/spCopula-package.Rd
Modified:
   pkg/DESCRIPTION
   pkg/NAMESPACE
   pkg/R/Classes.R
   pkg/R/ClaytonGumbelCopula.R
   pkg/R/partialDerivatives.R
   pkg/R/spatialPreparation.R
   pkg/R/spcopula.R
   pkg/R/stcopula.R
   pkg/R/vineCopulas.R
   pkg/demo/00Index
   pkg/demo/spcopula_estimation.R
   pkg/man/BB1Copula-class.Rd
   pkg/man/BB6Copula-class.Rd
   pkg/man/BB7Copula-class.Rd
   pkg/man/BB8Copula-class.Rd
   pkg/man/JoeCopula-class.Rd
   pkg/man/calcBins.Rd
Log:
- further help files
- additional bug fixes

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2012-10-30 16:47:24 UTC (rev 66)
+++ pkg/DESCRIPTION	2012-10-31 14:44:39 UTC (rev 67)
@@ -1,30 +1,30 @@
-Package: spcopula
-Type: Package
-Title: copula driven spatial analysis
-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.
-License: GPL-2
-LazyLoad: yes
-Depends: copula (>= 0.99-2), spacetime, CDVine, methods, lattice, R (>= 2.13.2)
-URL: http://r-forge.r-project.org/projects/spcopula/
-Collate:
-  Classes.R
-  partialDerivatives.R
-  cqsCopula.R
-  asCopula.R 
-  spcopula.R 
-  stcopula.R
-  spatialPreparation.R
-  linkingCDVine.R
-  BB1copula.R
-  BB6copula.R
-  BB7copula.R
-  BB8copula.R
-  JoeCopula.R
-  ClaytonGumbelCopula.R
-  vineCopulas.R
-  utilities.R
-  returnPeriods.R
+Package: spcopula
+Type: Package
+Title: copula driven spatial analysis
+Version: 1.0.67
+Date: 2012-10-31
+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.
+License: GPL-2
+LazyLoad: yes
+Depends: copula (>= 0.99-2), spacetime, CDVine, methods, lattice, R (>= 2.13.2)
+URL: http://r-forge.r-project.org/projects/spcopula/
+Collate:
+  Classes.R
+  partialDerivatives.R
+  cqsCopula.R
+  asCopula.R 
+  spcopula.R 
+  stcopula.R
+  spatialPreparation.R
+  linkingCDVine.R
+  BB1copula.R
+  BB6copula.R
+  BB7copula.R
+  BB8copula.R
+  JoeCopula.R
+  ClaytonGumbelCopula.R
+  vineCopulas.R
+  utilities.R
+  returnPeriods.R

Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE	2012-10-30 16:47:24 UTC (rev 66)
+++ pkg/NAMESPACE	2012-10-31 14:44:39 UTC (rev 67)
@@ -1,58 +1,52 @@
-# useDynLib(spcopula)
-
-import(copula, spacetime, CDVine, lattice)
-# importClassesFrom(spacetime, STFDF)
-
-# 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(JoeCopula, surJoeCopula, r90JoeCopula, r270JoeCopula)
-export(surClaytonCopula, r90ClaytonCopula, r270ClaytonCopula)
-export(surGumbelCopula, r90GumbelCopula, r270GumbelCopula)
-export(vineCopula)
-export(neighbourhood)
-
-# general functions
-export(rankTransform, dependencePlot, unitScatter, univScatter)
-export(fitCopula)
-export(dduCopula,ddvCopula)
-export(invdduCopula, invddvCopula)
-export(qCopula_u)
-export(genEmpCop)
-
-# tweaks
-export(setSizeLim)
-
-# spatial
-export(getNeighbours)
-export(calcBins)
-# fitting
-export(fitCorFun, loglikByCopulasLags, composeSpCop, fitSpCopula)
-export(spCopula)
-
-# MRP functions
-export(genEmpKenFun, genInvKenFun)
-export(kendallRP, criticalLevel, kendallDistribution, getKendallDistr)
-
-## classes
-exportClasses(asCopula, cqsCopula, neighbourhood)
-
-# wrappers to CDVine
-exportClasses(BB1Copula, surBB1Copula, r90BB1Copula, r270BB1Copula)
-exportClasses(BB6Copula, surBB6Copula, r90BB6Copula, r270BB6Copula)
-exportClasses(BB7Copula, surBB7Copula, r90BB7Copula, r270BB7Copula)
-exportClasses(BB8Copula, surBB8Copula, r90BB8Copula, r270BB8Copula)
-exportClasses(JoeCopula, surJoeCopula, r90JoeCopula, r270JoeCopula)
-exportClasses(vineCopula, spCopula)
-
-## exportClasses(mvdc) ## S4 methods
-## exportMethods(persp, contour)
-## S3method(print, indepTest)
-## importClassesFrom(package, ...)
-## importMethodsFrom(package, ...)
-
-
-
+# useDynLib(spcopula)
+
+import(copula, spacetime, CDVine, lattice)
+# importClassesFrom(spacetime, STFDF)
+
+# 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(JoeCopula, surJoeCopula, r90JoeCopula, r270JoeCopula)
+export(surClaytonCopula, r90ClaytonCopula, r270ClaytonCopula)
+export(surGumbelCopula, r90GumbelCopula, r270GumbelCopula)
+export(vineCopula)
+export(neighbourhood)
+
+# general functions
+export(rankTransform, dependencePlot, unitScatter, univScatter)
+export(fitCopula)
+export(dduCopula,ddvCopula)
+export(invdduCopula, invddvCopula)
+export(qCopula_u)
+export(genEmpCop)
+
+# tweaks
+# export(setSizeLim)
+
+# spatial
+export(getNeighbours)
+export(calcBins)
+# fitting
+export(fitCorFun, loglikByCopulasLags, composeSpCop, fitSpCopula)
+export(spCopula)
+
+# MRP functions
+export(genEmpKenFun, genInvKenFun)
+export(kendallRP, criticalLevel, kendallDistribution, getKendallDistr)
+
+## classes
+exportClasses(asCopula, cqsCopula, neighbourhood)
+
+# wrappers to CDVine
+exportClasses(BB1Copula, surBB1Copula, r90BB1Copula, r270BB1Copula)
+exportClasses(BB6Copula, surBB6Copula, r90BB6Copula, r270BB6Copula)
+exportClasses(BB7Copula, surBB7Copula, r90BB7Copula, r270BB7Copula)
+exportClasses(BB8Copula, surBB8Copula, r90BB8Copula, r270BB8Copula)
+exportClasses(JoeCopula, surJoeCopula, r90JoeCopula, r270JoeCopula)
+exportClasses(surClaytonCopula, r90ClaytonCopula, r270ClaytonCopula)
+exportClasses(surGumbelCopula, r90GumbelCopula, r270GumbelCopula)
+
+exportClasses(vineCopula, spCopula, stCopula)
\ No newline at end of file

Modified: pkg/R/Classes.R
===================================================================
--- pkg/R/Classes.R	2012-10-30 16:47:24 UTC (rev 66)
+++ pkg/R/Classes.R	2012-10-31 14:44:39 UTC (rev 67)
@@ -1,163 +1,163 @@
-#################################################################################
-##
-##   R package spcopula by Benedikt Gräler Copyright (C) 2011
-##
-##   This file is part of the R package spcopula.
-##
-##   The R package spcopula is free software: you can redistribute it and/or modify
-##   it under the terms of the GNU General Public License as published by
-##   the Free Software Foundation, either version 3 of the License, or
-##   (at your option) any later version.
-##
-##   The R package spcopula is distributed in the hope that it will be useful,
-##   but WITHOUT ANY WARRANTY; without even the implied warranty of
-##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-##   GNU General Public License for more details.
-##
-##   You should have received a copy of the GNU General Public License
-##   along with the R package spcopula. If not, see <http://www.gnu.org/licenses/>.
-##
-#################################################################################
-## some additional bivariate copulas extending the set of copulas in the package copula
-
-####
-## an asymmetric copula with cubic and quadratic sections
-
-validAsCopula = function(object) {
-  if (object at dimension != 2)
-    return("Only copulas with cubic quadratic sections 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)
-}
-
-# the lower bound of the parameter a dependening on the parameter b
-limA <- function (b) {
-  (b-3-sqrt(9+6*b-3*b^2))/2
-}
-
-setClass("asCopula",
-  representation = representation("copula"),
-  validity = validAsCopula,
-  contains = list("copula")
-)
-
-####
-## a symmetric copula with cubic and quadratic sections
-
-validCqsCopula <- validAsCopula
-
-setClass("cqsCopula",
-  representation = representation("copula"),
-  validity = validCqsCopula,
-  contains = list("copula")
-)
-
-## 
-## the spatial copula
-##
-## realized as a distance dependent convex combination of biv copulas
-
-# dimension = "numeric"     set to 2
-# parameters = "numeric"    set of parameters
-# param.names = "character" appropriate names
-# param.lowbnd = "numeric"  appropriate lower bounds
-# param.upbnd = "numeric"   appropriate upper bounds
-# message = "character"     messgae printed with "show"
-# components="list"         list of copulas 
-# distances="numeric"       the linking distances
-# unit="character"          measurement unit of distance
-# depFun="function"         an optional dependence function; depFun(NULL)
-#                             has to return either "spearman" or "kendall" 
-#                             dependening on the moa used. Make sure depFun
-#                             assings valid parameters to the copulas involved
-
-validSpCopula <- function(object) {
-  if (length(object at components) != length(object at distances)) return("Length of components + 1 does not equal length of distances. \n Note: The last distance must give the range and it is automatically associated with the indepenence copula.")
-  check.upper <- NULL
-  check.lower <- NULL
-  
-  if(!is.null(object at calibMoa(normalCopula(0),0))) {
-    for (i in 1:(length(object at components)-1)) {
-      check.upper <- c(check.upper, is.na(object at calibMoa(object at components[[i]], object at distances[i+1])))
-      check.lower <- c(check.lower, is.na(object at calibMoa(object at components[[i]], c(0,object at distances)[i])))
-    }
-    if(sum(check.upper>0)) return(paste("Reconsider the upper boundary conditions of the following copula(s): \n",
-                                        paste(sapply(object at components[check.upper], function(x) x at message), 
-                                              "at", object at distances[check.upper],collapse="\n")))
-    if(sum(check.lower>0)) return(paste("Reconsider the lower boundary conditions of the following copula(s): \n",
-                                        paste(sapply(object at components[check.lower], function(x) x at message), 
-                                              "at", object at distances[check.lower],collapse="\n")))
-  }
-  return(TRUE)
-}
-
-setClass("spCopula", representation = representation("copula", 
-                                                     components="list",
-                                                     distances="numeric", 
-                                                     calibMoa="function", 
-                                                     unit="character"),
-         validity = validSpCopula, contains = list("copula"))
-
-############################
-## Spatio-Temporal Copula ##
-############################
-
-validStCopula <- function(object) {
-  if(length(object at t.lags) != length(object at spCopList)) return("The length of the temporal distance vector must equal the number of spatial copulas.")
-  return(TRUE) # validity of any spCopula in spCopList is tested by the constructor, I believe
-}
-
-setClass("stCopula", representation = representation("copula", 
-                                                     spCopList="list", 
-                                                     t.lags="numeric",
-                                                     t.res="character"),
-         validity = validStCopula, contains = list("copula"))
-
-
-
-########################################
-## spatial classes providing the data ##
-########################################
-
-## neighbourhood:
-
-sizeLim <- 25 #  a constant
-setSizeLim <- function(x) {
-  env <- parent.env(environment())
-  unlockBinding("neighbourLim",env)
-  assign("neighbourLim", x,envir=env)
-  lockBinding("neighbourLim",env)
-}
-
-# a class combining two matrices holding the data and the corresponding 
-# distances as well a slot for the coordinates refernce system and an attribute
-# if the data is already transformed to uniform on [0,1] distributed variables
-# data:		a list of data.frames holding the data per neighbour. each neighbour needs to have the same number of variables in the same order
-# sp: an optional slot providing the coordinates of locations
-# index: a matrix linking the data entries with the coordinates of the locations
-validNeighbourhood <- function(object) {
-  sizeN <- ncol(object at distances)+1
-  nVars <- length(object at varNames)
-  if (sizeN > sizeLim) return("The limting size of the neighbourhood is exceeded. Increase the constant sizeLim if needed.")
-  if (nrow(object at data) != nrow(object at distances)) return("Data and distances have unequal number of rows.")
-  if (ncol(object at data) %% sizeN != 0) return("Data and distances have non matching number of columns.")
-  if (nrow(object at data) != nrow(object at coords) ) return("Data and sp at coordinates have unequal number of rows.")
-  if (nrow(object at data) != nrow(object at index)) return("Data and index have unequal number of rows.")
-  if (sizeN != ncol(object at index)) return("Data and index have unequal number of columns.")
-  if (ncol(object at data) != sizeN * nVars) return(paste("Number of columns in data does not equal the product of the neighbourhood's size (",sizeN,") with number of variables (",nVars,").",sep=""))
-  else return(TRUE)
-}
-
-setClass("neighbourhood",
-  representation = representation(data = "data.frame", distances="matrix", "SpatialPoints", index="matrix", varNames="character"),
-  validity = validNeighbourhood,
-  contains = list("SpatialPoints"))
-
+#################################################################################
+##
+##   R package spcopula by Benedikt Gräler Copyright (C) 2011
+##
+##   This file is part of the R package spcopula.
+##
+##   The R package spcopula is free software: you can redistribute it and/or modify
+##   it under the terms of the GNU General Public License as published by
+##   the Free Software Foundation, either version 3 of the License, or
+##   (at your option) any later version.
+##
+##   The R package spcopula is distributed in the hope that it will be useful,
+##   but WITHOUT ANY WARRANTY; without even the implied warranty of
+##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+##   GNU General Public License for more details.
+##
+##   You should have received a copy of the GNU General Public License
+##   along with the R package spcopula. If not, see <http://www.gnu.org/licenses/>.
+##
+#################################################################################
+## some additional bivariate copulas extending the set of copulas in the package copula
+
+####
+## an asymmetric copula with cubic and quadratic sections
+
+validAsCopula = function(object) {
+  if (object at dimension != 2)
+    return("Only copulas with cubic quadratic sections 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)
+}
+
+# the lower bound of the parameter a dependening on the parameter b
+limA <- function (b) {
+  (b-3-sqrt(9+6*b-3*b^2))/2
+}
+
+setClass("asCopula",
+  representation = representation("copula"),
+  validity = validAsCopula,
+  contains = list("copula")
+)
+
+####
+## a symmetric copula with cubic and quadratic sections
+
+validCqsCopula <- validAsCopula
+
+setClass("cqsCopula",
+  representation = representation("copula"),
+  validity = validCqsCopula,
+  contains = list("copula")
+)
+
+## 
+## the spatial copula
+##
+## realized as a distance dependent convex combination of biv copulas
+
+# dimension = "numeric"     set to 2
+# parameters = "numeric"    set of parameters
+# param.names = "character" appropriate names
+# param.lowbnd = "numeric"  appropriate lower bounds
+# param.upbnd = "numeric"   appropriate upper bounds
+# message = "character"     messgae printed with "show"
+# components="list"         list of copulas 
+# distances="numeric"       the linking distances
+# unit="character"          measurement unit of distance
+# depFun="function"         an optional dependence function; depFun(NULL)
+#                             has to return either "spearman" or "kendall" 
+#                             dependening on the moa used. Make sure depFun
+#                             assings valid parameters to the copulas involved
+
+validSpCopula <- function(object) {
+  if (length(object at components) != length(object at distances)) return("Length of components + 1 does not equal length of distances. \n Note: The last distance must give the range and it is automatically associated with the indepenence copula.")
+  check.upper <- NULL
+  check.lower <- NULL
+  
+  if(!is.null(object at calibMoa(normalCopula(0),0))) {
+    for (i in 1:(length(object at components)-1)) {
+      check.upper <- c(check.upper, is.na(object at calibMoa(object at components[[i]], object at distances[i+1])))
+      check.lower <- c(check.lower, is.na(object at calibMoa(object at components[[i]], c(0,object at distances)[i])))
+    }
+    if(sum(check.upper>0)) return(paste("Reconsider the upper boundary conditions of the following copula(s): \n",
+                                        paste(sapply(object at components[check.upper], function(x) x at message), 
+                                              "at", object at distances[check.upper],collapse="\n")))
+    if(sum(check.lower>0)) return(paste("Reconsider the lower boundary conditions of the following copula(s): \n",
+                                        paste(sapply(object at components[check.lower], function(x) x at message), 
+                                              "at", object at distances[check.lower],collapse="\n")))
+  }
+  return(TRUE)
+}
+
+setClass("spCopula", representation = representation("copula", 
+                                                     components="list",
+                                                     distances="numeric", 
+                                                     calibMoa="function", 
+                                                     unit="character"),
+         validity = validSpCopula, contains = list("copula"))
+
+############################
+## Spatio-Temporal Copula ##
+############################
+
+validStCopula <- function(object) {
+  if(length(object at t.lags) != length(object at spCopList)) return("The length of the temporal distance vector must equal the number of spatial copulas.")
+  return(TRUE) # validity of any spCopula in spCopList is tested by the constructor, I believe
+}
+
+setClass("stCopula", representation = representation("copula", 
+                                                     spCopList="list", 
+                                                     t.lags="numeric",
+                                                     t.res="character"),
+         validity = validStCopula, contains = list("copula"))
+
+
+
+########################################
+## spatial classes providing the data ##
+########################################
+
+## neighbourhood:
+
+sizeLim <- 25 #  a constant
+# setSizeLim <- function(x) {
+#   env <- parent.env(environment())
+#   unlockBinding("neighbourLim",env)
+#   assign("neighbourLim", x,envir=env)
+#   lockBinding("neighbourLim",env)
+# }
+
+# a class combining two matrices holding the data and the corresponding 
+# distances as well a slot for the coordinates refernce system and an attribute
+# if the data is already transformed to uniform on [0,1] distributed variables
+# data:		a list of data.frames holding the data per neighbour. each neighbour needs to have the same number of variables in the same order
+# sp: an optional slot providing the coordinates of locations
+# index: a matrix linking the data entries with the coordinates of the locations
+validNeighbourhood <- function(object) {
+  sizeN <- ncol(object at distances)+1
+  nVars <- length(object at varNames)
+  if (sizeN > sizeLim) return("The limting size of the neighbourhood is exceeded. Increase the constant sizeLim if needed.")
+  if (nrow(object at data) != nrow(object at distances)) return("Data and distances have unequal number of rows.")
+  if (ncol(object at data) %% sizeN != 0) return("Data and distances have non matching number of columns.")
+  if (nrow(object at data) != nrow(object at coords) ) return("Data and sp at coordinates have unequal number of rows.")
+  if (nrow(object at data) != nrow(object at index)) return("Data and index have unequal number of rows.")
+  if (sizeN != ncol(object at index)) return("Data and index have unequal number of columns.")
+  if (ncol(object at data) != sizeN * nVars) return(paste("Number of columns in data does not equal the product of the neighbourhood's size (",sizeN,") with number of variables (",nVars,").",sep=""))
+  else return(TRUE)
+}
+
+setClass("neighbourhood",
+  representation = representation(data = "data.frame", distances="matrix", "SpatialPoints", index="matrix", varNames="character"),
+  validity = validNeighbourhood,
+  contains = list("SpatialPoints"))
+

Modified: pkg/R/ClaytonGumbelCopula.R
===================================================================
--- pkg/R/ClaytonGumbelCopula.R	2012-10-30 16:47:24 UTC (rev 66)
+++ pkg/R/ClaytonGumbelCopula.R	2012-10-31 14:44:39 UTC (rev 67)
@@ -37,17 +37,33 @@
 }
 
 ## density ##
-setMethod("dCopula", signature("numeric","surClaytonCopula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","surClaytonCopula"), 
+          function(u, copula, log) {
+            linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
+          })
+setMethod("dCopula", signature("matrix","surClaytonCopula"), linkCDVine.PDF)
 
 ## jcdf ##
-setMethod("pCopula", signature("numeric","surClaytonCopula"), linkCDVine.surCDF)
-  
+setMethod("pCopula", signature("numeric","surClaytonCopula"), 
+          function(u, copula, log) {
+            linkCDVine.surCDF(matrix(u,ncol=copula at dimension),copula, log)
+          })
+setMethod("pCopula", signature("matrix","surClaytonCopula"), linkCDVine.surCDF)
+
 ## partial derivatives ##
 # ddu
-setMethod("dduCopula", signature("numeric","surClaytonCopula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","surClaytonCopula"), 
+          function(u, copula, log) {
+            linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula, log)
+          })
+setMethod("dduCopula", signature("matrix","surClaytonCopula"), linkCDVine.ddu)
 
 # ddv
-setMethod("ddvCopula", signature("numeric","surClaytonCopula"), linkCDVine.ddv)
+setMethod("ddvCopula", signature("numeric","surClaytonCopula"), 
+          function(u, copula, log) {
+            linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula, log)
+          })
+setMethod("ddvCopula", signature("matrix","surClaytonCopula"), linkCDVine.ddv)
 
 ## random number generater ??
 setMethod("rCopula", signature("numeric","surClaytonCopula"), linkCDVine.r)
@@ -92,17 +108,33 @@
 }
 
 ## density ##
-setMethod("dCopula", signature("numeric","r90ClaytonCopula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","r90ClaytonCopula"), 
+          function(u, copula, log) {
+            linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
+          })
+setMethod("dCopula", signature("matrix","r90ClaytonCopula"), linkCDVine.PDF)
 
 ## jcdf ##
-setMethod("pCopula", signature("numeric","r90ClaytonCopula"), linkCDVine.r90CDF)
+setMethod("pCopula", signature("numeric","r90ClaytonCopula"), 
+          function(u, copula) {
+            linkCDVine.r90CDF(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("pCopula", signature("matrix","r90ClaytonCopula"), linkCDVine.r90CDF)
 
 ## partial derivatives ##
 # ddu
-setMethod("dduCopula", signature("numeric","r90ClaytonCopula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","r90ClaytonCopula"), 
+          function(u, copula) {
+            linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("dduCopula", signature("matrix","r90ClaytonCopula"), linkCDVine.ddu)
 
 ## ddv
-setMethod("ddvCopula", signature("numeric","r90ClaytonCopula"), linkCDVine.ddv)
+setMethod("ddvCopula", signature("numeric","r90ClaytonCopula"), 
+          function(u, copula) {
+            linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("ddvCopula", signature("matrix","r90ClaytonCopula"), linkCDVine.ddv)
 
 ## random number generator
 setMethod("rCopula", signature("numeric","r90ClaytonCopula"), linkCDVine.r)
@@ -132,17 +164,33 @@
 }
 
 ## density ##
-setMethod("dCopula", signature("numeric","r270ClaytonCopula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","r270ClaytonCopula"), 
+          function(u, copula, log) {
+            linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
+          })
+setMethod("dCopula", signature("matrix","r270ClaytonCopula"), linkCDVine.PDF)
 
 ## jcdf ##
-setMethod("pCopula", signature("numeric","r270ClaytonCopula"), linkCDVine.r270CDF)
-  
+setMethod("pCopula", signature("numeric","r270ClaytonCopula"), 
+          function(u, copula) {
+            linkCDVine.r270CDF(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("pCopula", signature("matrix","r270ClaytonCopula"), linkCDVine.r270CDF)
+
 ## partial derivatives ##
 # ddu
-setMethod("dduCopula", signature("numeric","r270ClaytonCopula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","r270ClaytonCopula"), 
+          function(u, copula) {
+            linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("dduCopula", signature("matrix","r270ClaytonCopula"), linkCDVine.ddu)
 
-# ddv
-setMethod("ddvCopula", signature("numeric","r270ClaytonCopula"), linkCDVine.ddv)
+## ddv
+setMethod("ddvCopula", signature("numeric","r270ClaytonCopula"), 
+          function(u, copula) {
+            linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("ddvCopula", signature("matrix","r270ClaytonCopula"), linkCDVine.ddv)
 
 ## random number generator
 setMethod("rCopula", signature("numeric","r270ClaytonCopula"), linkCDVine.r)
@@ -193,17 +241,33 @@
 }
 
 ## density ##
-setMethod("dCopula", signature("numeric","surGumbelCopula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","surGumbelCopula"), 
+          function(u, copula, log) {
+            linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
+          })
+setMethod("dCopula", signature("matrix","surGumbelCopula"), linkCDVine.PDF)
 
 ## jcdf ##
-setMethod("pCopula", signature("numeric","surGumbelCopula"), linkCDVine.surCDF)
+setMethod("pCopula", signature("numeric","surGumbelCopula"), 
+          function(u, copula) {
+            linkCDVine.surCDF(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("pCopula", signature("matrix","surGumbelCopula"), linkCDVine.surCDF)
 
 ## partial derivatives ##
 # ddu
-setMethod("dduCopula", signature("numeric","surGumbelCopula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","surGumbelCopula"), 
+          function(u, copula) {
+            linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("dduCopula", signature("matrix","surGumbelCopula"), linkCDVine.ddu)
 
 # ddv
-setMethod("ddvCopula", signature("numeric","surGumbelCopula"), linkCDVine.ddv)
+setMethod("ddvCopula", signature("numeric","surGumbelCopula"), 
+          function(u, copula) {
+            linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("ddvCopula", signature("matrix","surGumbelCopula"), linkCDVine.ddv)
 
 ## random number generater ??
 setMethod("rCopula", signature("numeric","surGumbelCopula"), linkCDVine.r)
@@ -248,17 +312,33 @@
 }
 
 ## density ##
-setMethod("dCopula", signature("numeric","r90GumbelCopula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","r90GumbelCopula"), 
+          function(u, copula, log) {
+            linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
+          })
+setMethod("dCopula", signature("matrix","r90GumbelCopula"), linkCDVine.PDF)
 
 ## jcdf ##
-setMethod("pCopula", signature("numeric","r90GumbelCopula"), linkCDVine.r90CDF)
+setMethod("pCopula", signature("numeric","r90GumbelCopula"), 
+          function(u, copula) {
+            linkCDVine.r90CDF(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("pCopula", signature("matrix","r90GumbelCopula"), linkCDVine.r90CDF)
 
 ## partial derivatives ##
 # ddu
-setMethod("dduCopula", signature("numeric","r90GumbelCopula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","r90GumbelCopula"), 
+          function(u, copula) {
+            linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("dduCopula", signature("matrix","r90GumbelCopula"), linkCDVine.ddu)
 
 ## ddv
-setMethod("ddvCopula", signature("numeric","r90GumbelCopula"), linkCDVine.ddv)
+setMethod("ddvCopula", signature("numeric","r90GumbelCopula"), 
+          function(u, copula) {
+            linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("ddvCopula", signature("matrix","r90GumbelCopula"), linkCDVine.ddv)
 
 ## random number generator
 setMethod("rCopula", signature("numeric","r90GumbelCopula"), linkCDVine.r)
@@ -288,17 +368,33 @@
 }
 
 ## density ##
-setMethod("dCopula", signature("numeric","r270GumbelCopula"), linkCDVine.PDF)
+setMethod("dCopula", signature("numeric","r270GumbelCopula"), 
+          function(u, copula, log) {
+            linkCDVine.PDF(matrix(u,ncol=copula at dimension),copula, log)
+          })
+setMethod("dCopula", signature("matrix","r270GumbelCopula"), linkCDVine.PDF)
 
 ## jcdf ##
-setMethod("pCopula", signature("numeric","r270GumbelCopula"), linkCDVine.r270CDF)
+setMethod("pCopula", signature("numeric","r270GumbelCopula"), 
+          function(u, copula) {
+            linkCDVine.r270CDF(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("pCopula", signature("matrix","r270GumbelCopula"), linkCDVine.r270CDF)
 
 ## partial derivatives ##
 # ddu
-setMethod("dduCopula", signature("numeric","r270GumbelCopula"), linkCDVine.ddu)
+setMethod("dduCopula", signature("numeric","r270GumbelCopula"), 
+          function(u, copula) {
+            linkCDVine.ddu(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("dduCopula", signature("matrix","r270GumbelCopula"), linkCDVine.ddu)
 
-# ddv
-setMethod("ddvCopula", signature("numeric","r270GumbelCopula"), linkCDVine.ddv)
+## ddv
+setMethod("ddvCopula", signature("numeric","r270GumbelCopula"), 
+          function(u, copula) {
+            linkCDVine.ddv(matrix(u,ncol=copula at dimension),copula)
+          })
+setMethod("ddvCopula", signature("matrix","r270GumbelCopula"), linkCDVine.ddv)
 
 ## random number generator
 setMethod("rCopula", signature("numeric","r270GumbelCopula"), linkCDVine.r)

Modified: pkg/R/partialDerivatives.R
===================================================================
--- pkg/R/partialDerivatives.R	2012-10-30 16:47:24 UTC (rev 66)
+++ pkg/R/partialDerivatives.R	2012-10-31 14:44:39 UTC (rev 67)
@@ -43,7 +43,6 @@
 setGeneric("invdduCopula")
 
 invddvCopula <- function(v, copula, y) {
-#  standardGeneric("invddvCopula")
     if (length(v) != length(y)) 
         stop("Length of v and y differ!")
   warning("Numerical evaluation of invddv takes place.")
@@ -88,7 +87,7 @@
   return(pnorm(qnorm(y,mean=rho*qnorm(u),sd=sqrt(1-rho^2))))
 }
 
-setMethod("invdduCopula", signature("numeric","normalCopula"), invdduNorm)
+setMethod("invdduCopula", signature("numeric","normalCopula","numeric"), invdduNorm)
 
 
 ## partial derivative d/dv
@@ -157,7 +156,7 @@
   return(y)
 }
 
-setMethod("invddvCopula", signature("numeric","indepCopula"), invddvIndep)
+setMethod("invddvCopula", signature("numeric","indepCopula", "numeric"), invddvIndep)
 
 
 ####################

Modified: pkg/R/spatialPreparation.R
===================================================================
--- pkg/R/spatialPreparation.R	2012-10-30 16:47:24 UTC (rev 66)
+++ pkg/R/spatialPreparation.R	2012-10-31 14:44:39 UTC (rev 67)
@@ -207,7 +207,9 @@
     abline(h=c(-min(lagCor),0,min(lagCor)),col="grey")
   }
   
-  return(list(meanDists = mDists, lagCor=lagCor, lagData=lagData, lags=lags))
+  res <- list(meanDists = mDists, lagCor=lagCor, lagData=lagData, lags=lags)
+  attr(res,"cor.method") <- cor.method
+  return(res)
 }
 
 setMethod(calcBins, signature("Spatial"), calcSpBins)
@@ -277,7 +279,9 @@
     abline(h=c(-min(lagCor),0,min(lagCor)),col="grey")
   }
   
-  return(list(meanDists = mDists, lagCor=lagCor, lagData=lagData, lags=list(sp=spIndices, time=tempIndices)))
+  res <- list(meanDists = mDists, lagCor=lagCor, lagData=lagData, lags=list(sp=spIndices, time=tempIndices))
+  attr(res,"cor.method") <- cor.method
+  return(res)
 }
 
 setMethod(calcBins, signature("STFDF"), calcStBins)

Modified: pkg/R/spcopula.R
===================================================================
--- pkg/R/spcopula.R	2012-10-30 16:47:24 UTC (rev 66)
+++ pkg/R/spcopula.R	2012-10-31 14:44:39 UTC (rev 67)
@@ -1,577 +1,584 @@
-#################################################################################
-##
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/spcopula -r 67


More information about the spcopula-commits mailing list