[Returnanalytics-commits] r2744 - pkg/FactorAnalytics/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 8 20:22:08 CEST 2013


Author: chenyian
Date: 2013-08-08 20:22:07 +0200 (Thu, 08 Aug 2013)
New Revision: 2744

Modified:
   pkg/FactorAnalytics/R/plot.TimeSeriesFactorModel.r
Log:
debug 

Modified: pkg/FactorAnalytics/R/plot.TimeSeriesFactorModel.r
===================================================================
--- pkg/FactorAnalytics/R/plot.TimeSeriesFactorModel.r	2013-08-08 18:11:07 UTC (rev 2743)
+++ pkg/FactorAnalytics/R/plot.TimeSeriesFactorModel.r	2013-08-08 18:22:07 UTC (rev 2744)
@@ -201,13 +201,13 @@
         w[k] = w[k-1]/decay.factor 
       }   
       w <- w/sum(w)
-      rollReg <- function(data.z, formula,w) {
+      rollReg.w <- function(data.z, formula,w) {
         coef(lm(formula,weights=w, data = as.data.frame(data.z)))  
       }
       reg.z = zoo(fit.lm$model[-length(fit.lm$model)], as.Date(rownames(fit.lm$model)))
       factorNames = colnames(fit.lm$model)[c(-1,-length(fit.lm$model))]
       fit.formula = as.formula(paste(asset.name,"~", paste(factorNames, collapse="+"), sep=" "))
-      rollReg.z = rollapply(reg.z, FUN=rollReg, fit.formula,w, width=24, by.column = FALSE, 
+      rollReg.z = rollapply(reg.z, FUN=rollReg.w, fit.formula,w, width=24, by.column = FALSE, 
                             align="right")
       plot(rollReg.z, main=paste("24-month rolling regression estimates:", asset.name, sep=" ")) 
     } 



More information about the Returnanalytics-commits mailing list