[Returnanalytics-commits] r2382 - pkg/PerformanceAnalytics/sandbox/Shubhankit

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 19 19:53:12 CEST 2013


Author: shubhanm
Date: 2013-06-19 19:53:12 +0200 (Wed, 19 Jun 2013)
New Revision: 2382

Added:
   pkg/PerformanceAnalytics/sandbox/Shubhankit/GLMSmoothIndex.R
Log:


Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/GLMSmoothIndex.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/GLMSmoothIndex.R	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/GLMSmoothIndex.R	2013-06-19 17:53:12 UTC (rev 2382)
@@ -0,0 +1,36 @@
+GLMSmoothIndex<-
+  function(R = NULL, ...)
+  {
+    columns = 1
+    columnnames = NULL
+    #Error handling if R is not NULL
+    if(!is.null(R)){
+      x = checkData(R)
+      columns = ncol(x)
+      n = nrow(x)
+      count = q
+        x=edhec
+        columns = ncol(x)
+        columnnames = colnames(x)
+        
+        # Calculate AutoCorrelation Coefficient
+        for(column in 1:columns) { # for each asset passed in as R
+          y = checkData(edhec[,column], method="vector", na.rm = TRUE)
+          
+          acflag6 = acf(y,plot=FALSE,lag.max=6)[[1]][2:7]
+          values = sum(acflag6*acflag6)/(sum(acflag6)*sum(acflag6))
+          
+          if(column == 1) {
+            result.df = data.frame(Value = values)
+            colnames(result.df) = columnnames[column]
+          }
+          else {
+            nextcol = data.frame(Value = values)
+            colnames(nextcol) = columnnames[column]
+            result.df = cbind(result.df, nextcol)
+          }
+        }
+        return(result.df)
+      
+    }  
+  }
\ No newline at end of file



More information about the Returnanalytics-commits mailing list