From noreply at r-forge.r-project.org Mon Nov 4 12:44:14 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 4 Nov 2013 12:44:14 +0100 (CET) Subject: [Vinecopula-commits] r37 - pkg/R Message-ID: <20131104114414.30B83184C7B@r-forge.r-project.org> Author: ulf Date: 2013-11-04 12:44:13 +0100 (Mon, 04 Nov 2013) New Revision: 37 Modified: pkg/R/BiCopSelect.r Log: Ich berechne jetzt nur noch Stratwerte bei family=5 und 6, wenn sie im familyset sind. Ich hatte Faelle, in denen er bei Frank oder Joe folgende Fehler geworfen hat Fehler in uniroot(function(x) tau - tauF(x), lower = 0, upper = 500, tol = .Machine$double.eps^0.5) : f() values at end points not of opposite sign Wenn ich die Familie nicht in der familyset hatte, kam der Fehler auch, weil er immer den Startwert berechnet hat in der BiCopSelect.r. Modified: pkg/R/BiCopSelect.r =================================================================== --- pkg/R/BiCopSelect.r 2013-10-30 09:32:41 UTC (rev 36) +++ pkg/R/BiCopSelect.r 2013-11-04 11:44:13 UTC (rev 37) @@ -45,15 +45,15 @@ start[[2]] = c(sin(emp_tau*pi/2),10) start[[3]] = start[[13]] = 2*abs(emp_tau)/(1-abs(emp_tau)) start[[4]] = start[[14]] = 1/(1-abs(emp_tau)) - start[[5]] = Frank.itau.JJ(emp_tau) - start[[6]] = start[[16]] = Joe.itau.JJ(abs(emp_tau)) + if(5%in% familyset) start[[5]] = Frank.itau.JJ(emp_tau) else start[[5]] = 0 + if(any(c(6,16)%in% familyset)) start[[6]] = start[[16]] = Joe.itau.JJ(abs(emp_tau)) else start[[6]] = start[[16]] = 0 start[[7]] = start[[17]] = c(0.5, 1.5) start[[8]] = start[[18]] = c(1.5, 1.5) start[[9]] = start[[19]] = c(1.5, 0.5) start[[10]] = start[[20]] = c(1.5,0.5) start[[23]] = start[[33]] = -2*abs(emp_tau)/(1-abs(emp_tau)) start[[24]] = start[[34]] = -1/(1-abs(emp_tau)) - start[[26]] = start[[36]] = -Joe.itau.JJ(abs(emp_tau)) + if(any(c(26,36)%in% familyset)) start[[26]] = start[[36]] = -Joe.itau.JJ(abs(emp_tau)) else start[[26]] = start[[36]] = 0 start[[27]] = start[[37]] = c(-0.5, -1.5) start[[28]] = start[[38]] = c(-1.5, -1.5) start[[29]] = start[[39]] = c(-1.5, -0.5) From noreply at r-forge.r-project.org Wed Nov 6 12:08:59 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 6 Nov 2013 12:08:59 +0100 (CET) Subject: [Vinecopula-commits] r38 - in pkg: R inst Message-ID: <20131106110859.BF9A218544B@r-forge.r-project.org> Author: ulf Date: 2013-11-06 12:08:59 +0100 (Wed, 06 Nov 2013) New Revision: 38 Modified: pkg/R/BiCopPar2TailDep.r pkg/inst/ChangeLog Log: Nadine hatte noch eine Fehler bei der tail dependence fuer survival BB1 gefunden. Modified: pkg/R/BiCopPar2TailDep.r =================================================================== --- pkg/R/BiCopPar2TailDep.r 2013-11-04 11:44:13 UTC (rev 37) +++ pkg/R/BiCopPar2TailDep.r 2013-11-06 11:08:59 UTC (rev 38) @@ -90,7 +90,7 @@ else if(family==17) { lower=2-2^(1/par2) - upper=2^(-1/par2) + upper=2^(-1/par*par2) } else if(family==18) { Modified: pkg/inst/ChangeLog =================================================================== --- pkg/inst/ChangeLog 2013-11-04 11:44:13 UTC (rev 37) +++ pkg/inst/ChangeLog 2013-11-06 11:08:59 UTC (rev 38) @@ -22,6 +22,8 @@ - Bug fix: * RVineStructureSelect: Corrected code for the igraph package * RVineTreePlot: Now a 3-dimensional R-vine can be plotted too. + * Corrected upper tail dependence coefficient for the survival BB1 copula (BiCopPar2TailDep) + * Minor improvment in BiCopSelect regarding the starting values for parameter estimation - Documentation update From noreply at r-forge.r-project.org Mon Nov 11 12:40:22 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 11 Nov 2013 12:40:22 +0100 (CET) Subject: [Vinecopula-commits] r39 - in pkg: R inst Message-ID: <20131111114022.670DA184BF3@r-forge.r-project.org> Author: etobi Date: 2013-11-11 12:40:21 +0100 (Mon, 11 Nov 2013) New Revision: 39 Modified: pkg/R/BiCopPar2Tau.r pkg/inst/ChangeLog Log: Modified: pkg/R/BiCopPar2Tau.r =================================================================== --- pkg/R/BiCopPar2Tau.r 2013-11-06 11:08:59 UTC (rev 38) +++ pkg/R/BiCopPar2Tau.r 2013-11-11 11:40:21 UTC (rev 39) @@ -95,8 +95,8 @@ } else if(family==9 || family==19) { - theta=par - delta=par2 + #theta=par + #delta=par2 #tau=1-2/(delta*(2-theta))+4/(theta^2*delta)*gamma(delta+2)*gamma((2-2*theta)/(theta)+1)/gamma(delta+3+(2-2*theta)/(theta)) kt<-function(t) {( (1-(1-t)^par)^-par2-1 )/( -par*par2*(1-t)^(par-1)*(1-(1-t)^par)^(-par2-1) )} tau=1+4*integrate(kt,0,1)$value @@ -151,7 +151,7 @@ theta=-par delta=-par2 #tau=1-2/(delta*(2-theta))+4/(theta^2*delta)*gamma(delta+2)*gamma((2-2*theta)/(theta)+1)/gamma(delta+3+(2-2*theta)/(theta)) - kt<-function(t) {( (1-(1-t)^par)^(-par2)-1 )/( -par*par2*(1-t)^(par-1)*(1-(1-t)^par)^(par2-1) )} + kt<-function(t) {( (1-(1-t)^theta)^(-delta)-1 )/( -theta*delta*(1-t)^(theta-1)*(1-(1-t)^theta)^(-delta-1) )} tau=1+4*integrate(kt,0,1)$value tau=-tau } Modified: pkg/inst/ChangeLog =================================================================== --- pkg/inst/ChangeLog 2013-11-06 11:08:59 UTC (rev 38) +++ pkg/inst/ChangeLog 2013-11-11 11:40:21 UTC (rev 39) @@ -20,6 +20,7 @@ The families 204,214,224,234 denote the Tawn copula and their rotated versions in the case of right skewness (Tawn type 2). - Bug fix: + * BiCopPar2Tau: corrected calculation of Kendall's tau of rotated BB7 (Reported by Giampiero Marra. Thanks!) * RVineStructureSelect: Corrected code for the igraph package * RVineTreePlot: Now a 3-dimensional R-vine can be plotted too. * Corrected upper tail dependence coefficient for the survival BB1 copula (BiCopPar2TailDep) From noreply at r-forge.r-project.org Thu Nov 14 15:57:36 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 14 Nov 2013 15:57:36 +0100 (CET) Subject: [Vinecopula-commits] r40 - in pkg: R man Message-ID: <20131114145736.A78BE186284@r-forge.r-project.org> Author: ulf Date: 2013-11-14 15:57:36 +0100 (Thu, 14 Nov 2013) New Revision: 40 Modified: pkg/R/RVineMLE.R pkg/man/VineCopula-package.Rd Log: Typisch: Grad abgeschickt und schon wieder einen Fehler gefunden. Diesmal in der MLE. Wenn man z.B. nur Gauss copulas hat, dann ist er bei der parscale trotzdem in den Fall reingelaufen, dass er zwei-parametrische copulas hat. Modified: pkg/R/RVineMLE.R =================================================================== --- pkg/R/RVineMLE.R 2013-11-11 11:40:21 UTC (rev 39) +++ pkg/R/RVineMLE.R 2013-11-14 14:57:36 UTC (rev 40) @@ -302,11 +302,14 @@ pscale[i] = ifelse(Copula.Types[i] %in% c(1,2,43,44), 0.01, 1) } pscale2=numeric() - for(i in 1:nParams2) + if(nParams2>0) { - pscale2[i] = ifelse(Copula.Types[i] %in% c(104,114,124,134,204,214,224,234), 0.05, 1) - } - pscale=c(pscale,pscale2) + for(i in 1:nParams2) + { + pscale2[i] = ifelse(Copula.Types[i] %in% c(104,114,124,134,204,214,224,234), 0.05, 1) + } + pscale=c(pscale,pscale2) + } if(!exists("factr")) # Toleranz etwas hoch setzen (groeber) factr=1e8 Modified: pkg/man/VineCopula-package.Rd =================================================================== --- pkg/man/VineCopula-package.Rd 2013-11-11 11:40:21 UTC (rev 39) +++ pkg/man/VineCopula-package.Rd 2013-11-14 14:57:36 UTC (rev 40) @@ -81,7 +81,7 @@ Package: \tab VineCopula\cr Type: \tab Package\cr Version: \tab 1.2\cr -Date: \tab 2013-10-11\cr +Date: \tab 2013-11-11\cr License: \tab GPL (>=2)\cr Depends: \tab R (\eqn{\geq 2.11.0}{>= 2.11.0}), MASS, mvtnorm, igraph \cr Suggests: \tab CDVine, TSP, ADGofTest \cr From noreply at r-forge.r-project.org Wed Nov 20 12:51:00 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 20 Nov 2013 12:51:00 +0100 (CET) Subject: [Vinecopula-commits] r41 - pkg/R Message-ID: <20131120115100.9DA84185C26@r-forge.r-project.org> Author: etobi Date: 2013-11-20 12:50:59 +0100 (Wed, 20 Nov 2013) New Revision: 41 Modified: pkg/R/BiCopPar2Tau.r Log: Der zweite Parameter f?\195?\188r die t-family wird zur Berechnung von tau nicht ben?\195?\182tigt und muss in BiCopPar2Tau dementsprechend nicht gesetzt sein. Sicherheitsabfrage entsprechend angepasst. Modified: pkg/R/BiCopPar2Tau.r =================================================================== --- pkg/R/BiCopPar2Tau.r 2013-11-14 14:57:36 UTC (rev 40) +++ pkg/R/BiCopPar2Tau.r 2013-11-20 11:50:59 UTC (rev 41) @@ -1,7 +1,7 @@ BiCopPar2Tau<-function(family,par,par2=0) { if(!(family %in% c(0,1,2,3,4,5,6,7,8,9,10,13,14,16,17,18,19,20,23,24,26,27,28,29,30,33,34,36,37,38,39,40,41,42,51,52,61,62,71,72,104,114,124,134,204,214,224,234))) stop("Copula family not implemented.") - if(c(2,7,8,9,10,17,18,19,20,27,28,29,30,37,38,39,40,42,52,62,72,104,114,124,134,204,214,224,234) %in% family && par2==0) stop("For t-, BB1, BB6, BB7, BB8 and Tawn copulas, 'par2' must be set.") + if(c(7,8,9,10,17,18,19,20,27,28,29,30,37,38,39,40,42,52,62,72,104,114,124,134,204,214,224,234) %in% family && par2==0) stop("For BB1, BB6, BB7, BB8 and Tawn copulas, 'par2' must be set.") if(c(1,3,4,5,6,11,13,14,16,23,24,26,33,34,36,41,51,61,71) %in% family && length(par)<1) stop("'par' not set.") if((family==1 || family==2) && abs(par[1])>=1) stop("The parameter of the Gaussian and t-copula has to be in the interval (-1,1).") From noreply at r-forge.r-project.org Wed Nov 27 16:18:08 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 27 Nov 2013 16:18:08 +0100 (CET) Subject: [Vinecopula-commits] r42 - in pkg: . R man Message-ID: <20131127151808.9C1AA1862D9@r-forge.r-project.org> Author: ben_graeler Date: 2013-11-27 16:18:07 +0100 (Wed, 27 Nov 2013) New Revision: 42 Modified: pkg/DESCRIPTION pkg/R/BiCopSelect.r pkg/R/RVineCopSelect.r pkg/man/BiCopSelect.Rd pkg/man/RVineCopSelect.Rd pkg/man/RVineStructureSelect.Rd Log: - version 1.2-1 - adopted BICs and AICs in BiCopSelect for larger family indicies - added in docs: "families not listed in familyset might be included for limit case handling" Modified: pkg/DESCRIPTION =================================================================== --- pkg/DESCRIPTION 2013-11-20 11:50:59 UTC (rev 41) +++ pkg/DESCRIPTION 2013-11-27 15:18:07 UTC (rev 42) @@ -1,8 +1,8 @@ Package: VineCopula Type: Package Title: Statistical inference of vine copulas -Version: 1.2 -Date: 2013-09-03 +Version: 1.2-1 +Date: 2013-11-27 Author: Ulf Schepsmeier, Jakob Stoeber, Eike Christian Brechmann, Benedikt Graeler Maintainer: Ulf Schepsmeier Depends: R (>= 2.11.0), MASS, mvtnorm, igraph @@ -10,4 +10,3 @@ Description: This package provides functions for statistical inference of vine copulas. It contains tools for bivariate exploratory data analysis, bivariate copula selection and (vine) tree construction. Models can be estimated either sequentially or by joint maximum likelihood estimation. Sampling algorithms and plotting methods are also included. Data is assumed to lie in the unit hypercube (so-called copula data). For C- and D-vines links to the package CDVine are provided. License: GPL (>= 2) LazyLoad: yes -Packaged: 2013-02-07 14:29:57 UTC; Eike Modified: pkg/R/BiCopSelect.r =================================================================== --- pkg/R/BiCopSelect.r 2013-11-20 11:50:59 UTC (rev 41) +++ pkg/R/BiCopSelect.r 2013-11-27 15:18:07 UTC (rev 42) @@ -1,5 +1,4 @@ -BiCopSelect <- function(u1,u2,familyset=NA,selectioncrit="AIC",indeptest=FALSE,level=0.05,weights=NA) -{ +BiCopSelect <- function(u1, u2, familyset=NA, selectioncrit="AIC", indeptest=FALSE, level=0.05, weights=NA) { if(is.null(u1)==TRUE || is.null(u2)==TRUE) stop("u1 and/or u2 are not set or have length zero.") if(length(u1)!=length(u2)) stop("Lengths of 'u1' and 'u2' do not match.") if(length(u1)<2) stop("Number of observations has to be at least 2.") @@ -22,14 +21,17 @@ }else{ - if(!is.na(familyset[1]) && (!any(c(1,2,5,23,24,26:30,33,34,36:40,104,114,204,214) %in% familyset) || !any(c(1:10,13,14,16:20,124,134,224,234) %in% familyset))) stop("'familyset' has to include at least one bivariate copula family for positive and one for negative dependence.") + if(!is.na(familyset[1]) && (!any(c(1,2,5,23,24,26:30,33,34,36:40,104,114,204,214) %in% familyset) || !any(c(1:10,13,14,16:20,124,134,224,234) %in% familyset))) + stop("'familyset' has to include at least one bivariate copula family for positive and one for negative dependence.") + if(is.na(familyset[1])) + familyset <- c(1:10,13,14,16:20,23,24,26:30,33,34,36:40,104,114,124,134,204,214,224,234) emp_tau = fasttau(data1,data2,weights) - if(indeptest == TRUE){ + if(indeptest == TRUE) { out$p.value.indeptest = BiCopIndTest(data1,data2)$p.value - }else{ + } else{ out$p.value.indeptest = NA } @@ -38,14 +40,13 @@ out$family = 0 out$par = c(0,0) - }else{ - + } else { start = list() start[[1]] = sin(pi * emp_tau/2) start[[2]] = c(sin(emp_tau*pi/2),10) start[[3]] = start[[13]] = 2*abs(emp_tau)/(1-abs(emp_tau)) start[[4]] = start[[14]] = 1/(1-abs(emp_tau)) - if(5%in% familyset) start[[5]] = Frank.itau.JJ(emp_tau) else start[[5]] = 0 + if(5 %in% familyset) start[[5]] = Frank.itau.JJ(emp_tau) else start[[5]] = 0 if(any(c(6,16)%in% familyset)) start[[6]] = start[[16]] = Joe.itau.JJ(abs(emp_tau)) else start[[6]] = start[[16]] = 0 start[[7]] = start[[17]] = c(0.5, 1.5) start[[8]] = start[[18]] = c(1.5, 1.5) @@ -58,22 +59,22 @@ start[[28]] = start[[38]] = c(-1.5, -1.5) start[[29]] = start[[39]] = c(-1.5, -0.5) start[[30]] = start[[40]] = c(-1.5,-0.5) - #start[[41]] = start[[51]] = ipsA.tau2cpar(emp_tau) - #start[[61]] = start[[71]] = -ipsA.tau2cpar(emp_tau) - start[[104]] = start[[204]] = start[[114]] = start[[214]] = c(2,0.5) - start[[124]] = start[[224]] = start[[134]] = start[[234]] = c(-2,0.5) + #start[[41]] = start[[51]] = ipsA.tau2cpar(emp_tau) + #start[[61]] = start[[71]] = -ipsA.tau2cpar(emp_tau) + start[[104]] = start[[204]] = start[[114]] = start[[214]] = c(2,0.5) + start[[124]] = start[[224]] = start[[134]] = start[[234]] = c(-2,0.5) if(emp_tau < 0){ todo = c(1,2,5,23,24,26:30,33,34,36:40,124,134,224,234) }else{ todo = c(1:10,13,14,16:20,104,114,204,214) } - if(!is.na(familyset[1])) todo = todo[which(todo %in% familyset)] + todo = todo[which(todo %in% familyset)] optiout = list() if(any(todo == 2)){ - optiout[[2]] = suppressWarnings(BiCopEst(data1,data2,family=2, max.df=30,weights=weights)) + optiout[[2]] = suppressWarnings(BiCopEst(data1, data2, family=2, max.df=30, weights=weights)) optiout[[2]]$par=c(optiout[[2]]$par,optiout[[2]]$par2) if(optiout[[2]]$par[2] >= 30){ todo[todo==2] = 1 @@ -285,80 +286,69 @@ optiout[[40]] = list() } } - - - + + cat(todo, "\n") + for(i in todo[!(todo%in%c(2,7:10,17:20,27:30,37:40,104,114,124,134,204,214,224,234))]){ optiout[[i]] = MLE_intern(cbind(data1,data2),start[[i]],i,weights=weights) } - - for(i in todo[(todo%in%c(104,114,124,134,204,214,224,234))]){ + + for(i in todo[(todo%in%c(104,114,124,134,204,214,224,234))]){ optiout[[i]] = MLE_intern_Tawn(cbind(data1,data2),start[[i]],i) } - if(selectioncrit == "AIC"){ + AICs = rep(Inf, max(todo)) - AICs = rep(Inf,40) - - for(i in todo) - { - if(i %in% c(2,7:10,17:20,27:30,37:40,104,114,124,134,204,214,224,234)) - { - if(any(is.na(weights))){ - ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par[1], optiout[[i]]$par[2]))) - }else{ - ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par[1], optiout[[i]]$par[2]))%*%weights) - } + for(i in todo) { + if(i %in% c(2,7:10,17:20,27:30,37:40,104,114,124,134,204,214,224,234)) { + if(any(is.na(weights))) { + ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par[1], optiout[[i]]$par[2]))) + } else { + ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par[1], optiout[[i]]$par[2]))%*%weights) + } AICs[i] = -2*ll + 4 - } - else - { - if(any(is.na(weights))){ - ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par))) - }else{ - ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par))%*%weights) - } + } else { + if(any(is.na(weights))){ + ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par))) + } else { + ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par))%*%weights) + } AICs[i] = -2*ll + 2 } } out$family = todo[which.min(AICs[todo])] - }else if(selectioncrit == "BIC"){ - - BICs = rep(Inf,40) - - for(i in todo) - { - if(i %in% c(2,7:10,17:20,27:30,37:40,104,114,124,134,204,214,224,234)) - { - if(any(is.na(weights))){ - ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par[1], optiout[[i]]$par[2]))) - }else{ - ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par[1], optiout[[i]]$par[2]))%*%weights) - } - BICs[i] = -2*ll + 2*log(length(data1)) + } else { + if(selectioncrit == "BIC") { + BICs = rep(Inf, max(todo)) + + for(i in todo) { + if(i %in% c(2,7:10,17:20,27:30,37:40,104,114,124,134,204,214,224,234)) { + if(any(is.na(weights))) { + ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par[1], optiout[[i]]$par[2]))) + } else { + ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par[1], optiout[[i]]$par[2]))%*%weights) + } + BICs[i] = -2*ll + 2*log(length(data1)) + } else { + if(any(is.na(weights))) { + ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par))) + } else { + ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par))%*%weights) + } + BICs[i] = -2*ll + log(length(data1)) + } } - else - { - if(any(is.na(weights))){ - ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par))) - }else{ - ll=sum(log(BiCopPDF(data1,data2,i, optiout[[i]]$par))%*%weights) - } - BICs[i] = -2*ll + log(length(data1)) - } + + out$family = todo[which.min(BICs[todo])] } - - out$family = todo[which.min(BICs[todo])] - } - - out$par = optiout[[out$family]]$par - if(!(out$family%in%c(2,7:10,17:20,27:30,37:40,104,114,124,134,204,214,224,234)) ) out$par[2] = 0 - + out$par = optiout[[out$family]]$par + if(!(out$family %in% c(2,7:10,17:20,27:30,37:40,104,114,124,134,204,214,224,234)) ) + out$par[2] = 0 } } @@ -366,5 +356,4 @@ out$par=out$par[1] return(out) - } Modified: pkg/R/RVineCopSelect.r =================================================================== --- pkg/R/RVineCopSelect.r 2013-11-20 11:50:59 UTC (rev 41) +++ pkg/R/RVineCopSelect.r 2013-11-27 15:18:07 UTC (rev 42) @@ -1,23 +1,35 @@ -RVineCopSelect <- function(data,familyset=NA,Matrix,selectioncrit="AIC",indeptest=FALSE,level=0.05,trunclevel=NA){ +RVineCopSelect <- function(data,familyset=NA,Matrix,selectioncrit="AIC",indeptest=FALSE,level=0.05,trunclevel=NA) { n = dim(data)[2] N = nrow(data) - if(dim(Matrix)[1]!=dim(Matrix)[2]) stop("Structure matrix has to be quadratic.") - if(max(Matrix)>dim(Matrix)[1]) stop("Error in the structure matrix.") + if(dim(Matrix)[1]!=dim(Matrix)[2]) + stop("Structure matrix has to be quadratic.") + if(max(Matrix)>dim(Matrix)[1]) + stop("Error in the structure matrix.") - if(N<2) stop("Number of observations has to be at least 2.") - if(n<2) stop("Dimension has to be at least 2.") - if(any(data>1) || any(data<0)) stop("Data has be in the interval [0,1].") - if(!is.na(familyset[1])) for(i in 1:length(familyset)) if(!(familyset[i] %in% c(0,1:10,13,14,16:20,23,24,26:30,33,34,36:40,104,114,124,134,204,214,224,234))) stop("Copula family not implemented.") - if(selectioncrit != "AIC" && selectioncrit != "BIC") stop("Selection criterion not implemented.") - if(level < 0 & level > 1) stop("Significance level has to be between 0 and 1.") + if(N<2) + stop("Number of observations has to be at least 2.") + if(n<2) + stop("Dimension has to be at least 2.") + if(any(data>1) || any(data<0)) + stop("Data has be in the interval [0,1].") + if(!is.na(familyset[1])) { + if(any(!(familyset %in% c(0,1:10,13,14,16:20,23,24,26:30,33,34,36:40,104,114,124,134,204,214,224,234)))) + stop("Copula family not implemented.") + } + if(selectioncrit != "AIC" && selectioncrit != "BIC") + stop("Selection criterion not implemented.") + if(level < 0 & level > 1) + stop("Significance level has to be between 0 and 1.") - if(is.na(trunclevel)) trunclevel = n + if(is.na(trunclevel)) + trunclevel = n types = familyset - if(trunclevel == 0) types = 0 - + if(trunclevel == 0) + types = 0 + M = Matrix Mold = M @@ -41,7 +53,6 @@ V$direct[n,,] = t(data[,n:1]) for(i in (n-1):1){ - for(k in n:(i+1)){ m = MaxMat[k,i] @@ -74,9 +85,10 @@ } } - varnames = rep(0,n) - for(i in 1:n) varnames[i] = paste("V", i, sep="") -print(Types) + varnames = paste("V", 1:n, sep="") + + print(Types) + RVM = RVineMatrix(Mold, family=Types, par=Params, par2=Params2, names=varnames) return(RVM) Modified: pkg/man/BiCopSelect.Rd =================================================================== --- pkg/man/BiCopSelect.Rd 2013-11-20 11:50:59 UTC (rev 41) +++ pkg/man/BiCopSelect.Rd 2013-11-27 15:18:07 UTC (rev 42) @@ -18,7 +18,7 @@ \item{u1,u2}{Data vectors of equal length with values in [0,1].} \item{familyset}{Vector of bivariate copula families to select from (the independence copula MUST NOT be specified in this vector, otherwise it will be selected). - The vector has to include at least one bivariate copula family that allows for positive and one that allows for negative dependence. + The vector has to include at least one bivariate copula family that allows for positive and one that allows for negative dependence. Not listed copula families might be included to better handle limit cases. If \code{familyset = NA} (default), selection among all possible families is performed. Coding of bivariate copula families: \cr \code{1} = Gaussian copula \cr @@ -66,7 +66,7 @@ (default: \code{indeptest = FALSE}; see \code{\link{BiCopIndTest}}). The independence copula is chosen if the null hypothesis of independence cannot be rejected.} \item{level}{Numeric; significance level of the independence test (default: \code{level = 0.05}).} - \item{weights}{Numerical; weights for each observation (opitional).} + \item{weights}{Numerical; weights for each observation (optional).} } \value{ Modified: pkg/man/RVineCopSelect.Rd =================================================================== --- pkg/man/RVineCopSelect.Rd 2013-11-20 11:50:59 UTC (rev 41) +++ pkg/man/RVineCopSelect.Rd 2013-11-27 15:18:07 UTC (rev 42) @@ -16,7 +16,7 @@ \arguments{ \item{data}{An N x d data matrix (with uniform margins).} \item{familyset}{An integer vector of pair-copula families to select from (the independence copula MUST NOT be specified in this vector unless one wants to fit an independence vine!). - The vector has to include at least one pair-copula family that allows for positive and one that allows for negative dependence. + The vector has to include at least one pair-copula family that allows for positive and one that allows for negative dependence. Not listed copula families might be included to better handle limit cases. If \code{familyset = NA} (default), selection among all possible families is performed. The coding of pair-copula families is shown below.} \item{Matrix}{Lower triangular d x d matrix that defines the R-vine tree structure.} Modified: pkg/man/RVineStructureSelect.Rd =================================================================== --- pkg/man/RVineStructureSelect.Rd 2013-11-20 11:50:59 UTC (rev 41) +++ pkg/man/RVineStructureSelect.Rd 2013-11-27 15:18:07 UTC (rev 42) @@ -17,7 +17,7 @@ \arguments{ \item{data}{An N x d data matrix (with uniform margins).} \item{familyset}{An integer vector of pair-copula families to select from (the independence copula MUST NOT be specified in this vector unless one wants to fit an independence vine!). - The vector has to include at least one pair-copula family that allows for positive and one that allows for negative dependence. + The vector has to include at least one pair-copula family that allows for positive and one that allows for negative dependence. Not listed copula families might be included to better handle limit cases. If \code{familyset = NA} (default), selection among all possible families is performed. Coding of pair-copula families: \cr \code{1} = Gaussian copula \cr From noreply at r-forge.r-project.org Wed Nov 27 16:20:16 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 27 Nov 2013 16:20:16 +0100 (CET) Subject: [Vinecopula-commits] r43 - / Message-ID: <20131127152016.1DA4C184D17@r-forge.r-project.org> Author: ben_graeler Date: 2013-11-27 16:20:15 +0100 (Wed, 27 Nov 2013) New Revision: 43 Removed: VineCopula_1.2.zip Log: - removed previous build package Deleted: VineCopula_1.2.zip =================================================================== (Binary files differ) From noreply at r-forge.r-project.org Wed Nov 27 16:59:29 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 27 Nov 2013 16:59:29 +0100 (CET) Subject: [Vinecopula-commits] r44 - pkg/R Message-ID: <20131127155929.EFA35186369@r-forge.r-project.org> Author: ben_graeler Date: 2013-11-27 16:59:29 +0100 (Wed, 27 Nov 2013) New Revision: 44 Modified: pkg/R/BiCopSelect.r Log: - forgot to remove a "cat(todo)" Modified: pkg/R/BiCopSelect.r =================================================================== --- pkg/R/BiCopSelect.r 2013-11-27 15:20:15 UTC (rev 43) +++ pkg/R/BiCopSelect.r 2013-11-27 15:59:29 UTC (rev 44) @@ -287,8 +287,6 @@ } } - cat(todo, "\n") - for(i in todo[!(todo%in%c(2,7:10,17:20,27:30,37:40,104,114,124,134,204,214,224,234))]){ optiout[[i]] = MLE_intern(cbind(data1,data2),start[[i]],i,weights=weights) }