[Returnanalytics-commits] r1946 - pkg/PortfolioAnalytics/sandbox

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 10 00:04:54 CEST 2012


Author: braverock
Date: 2012-05-10 00:04:54 +0200 (Thu, 10 May 2012)
New Revision: 1946

Modified:
   pkg/PortfolioAnalytics/sandbox/script.workshop2012.R
Log:
- subset multivariate garch moments to remove bootstrap dates 

Modified: pkg/PortfolioAnalytics/sandbox/script.workshop2012.R
===================================================================
--- pkg/PortfolioAnalytics/sandbox/script.workshop2012.R	2012-05-09 19:31:19 UTC (rev 1945)
+++ pkg/PortfolioAnalytics/sandbox/script.workshop2012.R	2012-05-09 22:04:54 UTC (rev 1946)
@@ -1015,14 +1015,23 @@
 #        forecast.length = 186, refit.every = 3, refit.window = "moving",
 #        solver = "solnp", fit.control = list(), solver.control = ctrl)
 
+###
+# garch moments
+# mu
 dccmu<-fitted(dccfit1)
 colnames(dccmu)<-colnames(edhec.R)
 rownames(dccmu)<-as.character(index(bs.data)[-1])
 dccmu<-xts(dccmu,order.by=as.Date(rownames((dccmu))))
+dccmu<-dccmu[index(edhec.R)]
+
+# sigma
 dccsigma<-sigma(dccfit1)
 colnames(dccsigma)<-colnames(edhec.R)
 rownames(dccsigma)<-as.character(index(bs.data)[-1])
 dccsigma<-xts(dccsigma,order.by=as.Date(rownames((dccsigma))))
+dccsigma<-dccsigma[index(edhec.R)]
+
+# conditional covariance
 dcccova<-rcov(dccfit1)
 dcccovl<-list()
 for(i in 1:dim(dcccova)[3]) { dcccovl[[i]]<- dcccova[,,i]; colnames(dcccovl[[i]])<-colnames(edhec.R); rownames(dcccovl[[i]])<-colnames(edhec.R)}
@@ -1030,6 +1039,8 @@
 dcccovls<-dcccovl[1:444] #subset out only the real data
 dcccovls<-dcccovls[263:444] # dump the zero junk from the end
 all.equal(names(dcccovls),as.character(index(edhec.R)))
+
+# conditional correlation
 dcccora<-rcor(dccfit1)
 dcccorl<-list()
 for(i in 1:dim(dcccora)[3]) { dcccorl[[i]]<- dcccora[,,i]; colnames(dcccorl[[i]])<-colnames(edhec.R); rownames(dcccorl[[i]])<-colnames(edhec.R)}



More information about the Returnanalytics-commits mailing list