[Vinecopula-commits] r16 - in pkg: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mo Aug 5 09:08:56 CEST 2013
Author: ulf
Date: 2013-08-05 09:08:55 +0200 (Mon, 05 Aug 2013)
New Revision: 16
Modified:
pkg/R/RVineMatrix.R
pkg/man/RVineMatrix.Rd
Log:
Ich habe RVM.print()n ein wenig erweitert. Wenn man nun print(RVM, detail=TRUE) eingibt, bekommt man eine detailierte ?\195?\156bersicht ?\195?\188ber die Copulas, deren Familie und Parameter. Dies kann hilfreich sein f?\195?\188r Leute, die die Matrizen nicht so gut lesen k?\195?\182nnen.
Modified: pkg/R/RVineMatrix.R
===================================================================
--- pkg/R/RVineMatrix.R 2013-07-11 13:00:22 UTC (rev 15)
+++ pkg/R/RVineMatrix.R 2013-08-05 07:08:55 UTC (rev 16)
@@ -100,7 +100,7 @@
NextMethod("dim")
}
-print.RVineMatrix = function(x, ...){
+print.RVineMatrix = function(x, detail=FALSE, ...){
RVine=x
message("R-vine matrix:")
print(RVine$Matrix, ...)
@@ -114,8 +114,61 @@
}
}
#NextMethod("print")
+
+ d=dim(RVine)
+ if(detail==TRUE || detail==T)
+ {
+ message("")
+ message("Tree 1:")
+ for(i in 1:(d-1))
+ {
+ a=paste(RVine$names[[RVine$Matrix[i,i]]],",",RVine$names[[RVine$Matrix[d,i]]],sep="")
+ a=paste(a,": ", BiCopName(RVine$family[d,i], short=FALSE),sep="")
+ if(RVine$family[d,i]!=0)
+ {
+ a=paste(a," with par=", round(RVine$par[d,i],2), sep="")
+ if(RVine$family[d,i]%in%c(2,7,8,9,10,17,18,19,20,27,28,29,30,37,38,39,40))
+ {
+ a=paste(a," and par2=", round(RVine$par2[d,i],2), sep="")
+ }
+ a=paste(a, " (tau=", round(BiCopPar2Tau(RVine$family[d,i],RVine$par[d,i],RVine$par2[d,i]),2), ")", sep="")
+ }
+ message(a)
+ }
+ for(j in 2:(d-1))
+ {
+ message("")
+ a=paste("Tree ",j,":",sep="")
+ message(a)
+ for(i in 1:(d-j))
+ {
+ a=paste(RVine$names[[RVine$Matrix[i,i]]],",",RVine$names[[RVine$Matrix[d-j+1,i]]],sep="")
+ a=paste(a,"|",sep="")
+ conditioningSet=(d-j+2):d
+ for(k in 1:length(conditioningSet))
+ {
+ if(k>1){ a=paste(a,",",sep="")}
+ a=paste(a,RVine$names[[RVine$Matrix[conditioningSet[k],i]]],sep="")
+ }
+ a=paste(a,": ", BiCopName(RVine$family[d-j+1,i], short=FALSE),sep="")
+ if(RVine$family[d-j+1,i]!=0)
+ {
+ a=paste(a," with par=", round(RVine$par[d-j+1,i],2), sep="")
+ if(RVine$family[d-j+1,i]%in%c(2,7,8,9,10,17,18,19,20,27,28,29,30,37,38,39,40))
+ {
+ a=paste(a," and par2=", round(RVine$par2[d-j+1,i],2), sep="")
+ }
+ a=paste(a, " (tau=", round(BiCopPar2Tau(RVine$family[d-j+1,i],RVine$par[d-j+1,i],RVine$par2[d-j+1,i]),2), ")", sep="")
+ }
+ message(a)
+ }
+ }
+
+ }
}
+
+
createMaxMat = function(Matrix){
if(dim(Matrix)[1]!=dim(Matrix)[2]) stop("Structure matrix has to be quadratic.")
Modified: pkg/man/RVineMatrix.Rd
===================================================================
--- pkg/man/RVineMatrix.Rd 2013-07-11 13:00:22 UTC (rev 15)
+++ pkg/man/RVineMatrix.Rd 2013-08-05 07:08:55 UTC (rev 16)
@@ -69,6 +69,12 @@
\item{par2}{Second pair-copula parameter matrix with parameters necessary for pair-copula families with two parameters.}
}
+\note{
+The \code{print} function writes the R-vine matrix defined by \code{Matrix}. A detailed output is given by \code{print(RVM, detail=TRUE)},
+where \code{RVM} is the \code{\link{RVineMatrix}} object. \cr
+The \code{\link{RVineMatrix}} function automatically checks if the given matrix is a valid R-vine matrix (see \code{\link{RVineMatrixCheck}}).
+}
+
\references{
Dissmann, J. F., E. C. Brechmann, C. Czado, and D. Kurowicka (2013).
Selecting and estimating regular vine copulae and application to financial returns.
@@ -77,7 +83,7 @@
\author{Jeffrey Dissmann}
-\seealso{\code{\link{RVineMLE}}, \code{\link{RVineSim}}, \code{\link{C2RVine}}, \code{\link{D2RVine}}}
+\seealso{\code{\link{RVineMatrixCheck}}, \code{\link{RVineMLE}}, \code{\link{RVineSim}}, \code{\link{C2RVine}}, \code{\link{D2RVine}}}
\examples{
# define 5-dimensional R-vine tree structure matrix
@@ -99,4 +105,7 @@
# define RVineMatrix object
RVM = RVineMatrix(Matrix=Matrix,family=family,par=par,par2=par2,
names=c("V1","V2","V3","V4","V5"))
+
+# Print detailed information
+print(RVM, detail=TRUE)
}
Mehr Informationen über die Mailingliste Vinecopula-commits