[Vinecopula-commits] r96 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mo Apr 20 10:36:01 CEST 2015


Author: tnagler
Date: 2015-04-20 10:36:00 +0200 (Mon, 20 Apr 2015)
New Revision: 96

Modified:
   pkg/R/RVinePartialcorr.R
Log:
- RVinePcor2cor: another bug fix for d = 2

Modified: pkg/R/RVinePartialcorr.R
===================================================================
--- pkg/R/RVinePartialcorr.R	2015-04-17 17:02:11 UTC (rev 95)
+++ pkg/R/RVinePartialcorr.R	2015-04-20 08:36:00 UTC (rev 96)
@@ -98,6 +98,7 @@
 RVinePcor2cor <- function(RVM) {
     d <- nrow(RVM$Matrix)
     ## sanity checks
+    stopifnot(d > 1)
     stopifnot(is(RVM, "RVineMatrix"))
     stopifnot(all(RVM$family %in% c(0, 1, 2)))
     if (is.null(RVM$names))
@@ -120,10 +121,8 @@
     pc <- RVM$par[d:1, d:1]
     
     ## if d=2 there is nothing to compute
-    if (d <= 2) {
-        iorder <- diag(RVM$Matrix)
-        corMat <- matrix(c(1, pc[iorder[1], iorder[2]],
-                           pc[iorder[1], iorder[2]], 1),
+    if (d == 2) {
+        corMat <- matrix(c(1, rep(RVM$par[2, 1], 2), 1),
                          nrow = 2, ncol = 2)
         return(corMat)
     }



Mehr Informationen über die Mailingliste Vinecopula-commits