[Vinecopula-commits] r53 - in pkg: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fr Feb 7 11:15:19 CET 2014
Author: ben_graeler
Date: 2014-02-07 11:15:19 +0100 (Fri, 07 Feb 2014)
New Revision: 53
Modified:
pkg/DESCRIPTION
pkg/NAMESPACE
pkg/R/tawnCopula.R
pkg/R/vineCopulas.R
pkg/man/vineCopula-class.Rd
Log:
- forgot to set fitCopula "generic"
- copy-paste error in fullname of rotated tawn copulas
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2014-02-06 16:53:02 UTC (rev 52)
+++ pkg/DESCRIPTION 2014-02-07 10:15:19 UTC (rev 53)
@@ -2,7 +2,7 @@
Type: Package
Title: Statistical inference of vine copulas
Version: 1.2-1
-Date: 2014-02-06
+Date: 2014-02-07
Author: Ulf Schepsmeier, Jakob Stoeber, Eike Christian Brechmann, Benedikt Graeler
Maintainer: Ulf Schepsmeier <schepsmeier at ma.tum.de>
Depends: R (>= 2.11.0)
Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE 2014-02-06 16:53:02 UTC (rev 52)
+++ pkg/NAMESPACE 2014-02-07 10:15:19 UTC (rev 53)
@@ -71,6 +71,7 @@
export(tawnT1Copula, surTawnT1Copula, r90TawnT1Copula, r270TawnT1Copula)
export(tawnT2Copula, surTawnT2Copula, r90TawnT2Copula, r270TawnT2Copula)
export(vineCopula)
+export(copulaFromFamilyIndex)
exportClasses(BB1Copula, surBB1Copula, r90BB1Copula, r270BB1Copula)
exportClasses(BB6Copula, surBB6Copula, r90BB6Copula, r270BB6Copula)
@@ -82,6 +83,8 @@
exportClasses(tawnT1Copula, surTawnT1Copula, r90TawnT1Copula, r270TawnT1Copula)
exportClasses(tawnT2Copula, surTawnT2Copula, r90TawnT2Copula, r270TawnT2Copula)
exportClasses(vineCopula)
+
+
S3method(print, RVineMatrix)
useDynLib("VineCopula")
\ No newline at end of file
Modified: pkg/R/tawnCopula.R
===================================================================
--- pkg/R/tawnCopula.R 2014-02-06 16:53:02 UTC (rev 52)
+++ pkg/R/tawnCopula.R 2014-02-07 10:15:19 UTC (rev 53)
@@ -139,7 +139,7 @@
stop(paste("Parameter values out of bounds: param1: [1,Inf), param2: [0,1]."))
new("r90TawnT1Copula", dimension = as.integer(2), parameters = param,
param.names = c("param1", "param2"), param.lowbnd = c(-Inf, 0), param.upbnd = c(-1, 1),
- family=124, fullname = "Survival Tawn type 1 copula family. Number 124 in VineCopula.")
+ family=124, fullname = "90 deg rotated Tawn type 1 copula family. Number 124 in VineCopula.")
}
## density ##
@@ -194,7 +194,7 @@
stop(paste("Parameter values out of bounds: param1: [1,Inf), param2: [0,1]."))
new("r270TawnT1Copula", dimension = as.integer(2), parameters = param,
param.names = c("param1", "param2"), param.lowbnd = c(-Inf, 0), param.upbnd = c(-1, 1),
- family=134, fullname = "Survival Tawn type 1 copula family. Number 134 in VineCopula.")
+ family=134, fullname = "270 deg rotated Tawn type 1 copula family. Number 134 in VineCopula.")
}
## density ##
@@ -361,7 +361,7 @@
stop(paste("Parameter values out of bounds: param1: [1,Inf), param2: [0,1]."))
new("r90TawnT2Copula", dimension = as.integer(2), parameters = param,
param.names = c("param1", "param2"), param.lowbnd = c(-Inf, 0), param.upbnd = c(-1, 1),
- family=224, fullname = "Survival Tawn type 2 copula family. Number 224 in VineCopula.")
+ family=224, fullname = "90 deg rotated Tawn type 2 copula family. Number 224 in VineCopula.")
}
## density ##
@@ -416,7 +416,7 @@
stop(paste("Parameter values out of bounds: param1: [1,Inf), param2: [0,1]."))
new("r270TawnT2Copula", dimension = as.integer(2), parameters = param,
param.names = c("param1", "param2"), param.lowbnd = c(-Inf, 0), param.upbnd = c(-1, 1),
- family=234, fullname = "Survival Tawn type 2 copula family. Number 234 in VineCopula.")
+ family=234, fullname = "270 deg rotated Tawn type 2 copula family. Number 234 in VineCopula.")
}
## density ##
Modified: pkg/R/vineCopulas.R
===================================================================
--- pkg/R/vineCopulas.R 2014-02-06 16:53:02 UTC (rev 52)
+++ pkg/R/vineCopulas.R 2014-02-07 10:15:19 UTC (rev 53)
@@ -90,21 +90,32 @@
setMethod("rCopula", signature("numeric","vineCopula"), rRVine)
+## make fitCopula from copula generic
+setGeneric("fitCopula",fitCopula)
+
# fitting using RVine
-fitVineCop <- function(copula, data, method) {
+fitVineCop <- function(copula, data,
+ method=list(StructureSelect=FALSE, indeptest=FALSE)) {
stopifnot(copula at dimension==ncol(data))
- if(!is.null(method[["familyset"]]))
+ if("familyset" %in% names(method))
familyset <- method[["familyset"]]
else
familyset <- NA
- if("StructureSelect" %in% method)
- vineCop <- vineCopula(RVineStructureSelect(data, familyset, indeptest="indeptest" %in% method))
+ if("indeptest" %in% names(method))
+ indept <- method[["indeptest"]]
else
- vineCop <- vineCopula(RVineCopSelect(data, familyset, copula at RVM$Matrix,
- indeptest="indeptest" %in% method))
+ indept <- FALSE
+ if("StructureSelect" %in% names(method)) {
+ if(method[["StructureSelect"]])
+ vineCop <- vineCopula(RVineStructureSelect(data, familyset, indeptest=indept))
+ else
+ vineCop <- vineCopula(RVineCopSelect(data, familyset, copula at RVM$Matrix, indeptest=indept))
+ } else {
+ vineCop <- vineCopula(RVineCopSelect(data, familyset, copula at RVM$Matrix, indeptest=indept))
+ }
return(new("fitCopula", estimate = vineCop at parameters, var.est = matrix(NA),
- method = sapply(method,paste,collapse=", "),
+ method = paste(names(method), method, sep="=", collapse=", "),
loglik = RVineLogLik(data, vineCop at RVM)$loglik,
fitting.stats=list(convergence = as.integer(NA)),
nsample = nrow(data), copula=vineCop))
Modified: pkg/man/vineCopula-class.Rd
===================================================================
--- pkg/man/vineCopula-class.Rd 2014-02-06 16:53:02 UTC (rev 52)
+++ pkg/man/vineCopula-class.Rd 2014-02-07 10:15:19 UTC (rev 53)
@@ -28,7 +28,7 @@
Class \code{"\linkS4class{Copula}"}, by class "copula", distance 2.
}
\section{Methods}{
-No additional methods yet, but uses e.g. \code{\link{dCopula}}, \code{\link{pCopula}}, \code{\link{rCopula}} and \code{\link{rCopula}} as any other copula. Via the \code{method} argument in \code{fitCopula}, control over the fit of the RVine can be taken via entries \code{"StructureSelect"}, \code{"indeptest"} and \code{"familyset"}. See \code{\link{RVineCopSelect}} and \code{\link{RVineStructureSelect}} for further details on the underlying functions.
+No additional methods yet, but uses e.g. \code{\link{dCopula}}, \code{\link{pCopula}}, \code{\link{rCopula}} and \code{\link{rCopula}} as any other copula. Via the \code{method} argument in \code{fitCopula}, control over the fit of the RVine can be taken via entries \code{StructureSelect}, \code{indeptest} and \code{familyset}. See \code{\link{RVineCopSelect}} and \code{\link{RVineStructureSelect}} for further details on the underlying functions. Missing entries are treated as default values, i.e. \code{StructureSelect=FALSE}, \code{indeptest=FALSE} and \code{familyset=NA}
}
\references{
Mehr Informationen über die Mailingliste Vinecopula-commits