[Returnanalytics-commits] r2512 - pkg/PerformanceAnalytics/sandbox/Shubhankit
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jul 7 00:31:12 CEST 2013
Author: shubhanm
Date: 2013-07-07 00:31:01 +0200 (Sun, 07 Jul 2013)
New Revision: 2512
Added:
pkg/PerformanceAnalytics/sandbox/Shubhankit/chart.Autocorrelation.R
Log:
Week 3: Stack Bar Plot of Autocorrelation Lag Factors
Status : Backtested
Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/chart.Autocorrelation.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/chart.Autocorrelation.R (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/chart.Autocorrelation.R 2013-07-06 22:31:01 UTC (rev 2512)
@@ -0,0 +1,47 @@
+#' Stacked Bar Plot of Autocorrelation Lag Coefficients
+#'
+#' A wrapper to create box and whiskers plot of comparitive inputs
+#'
+#' We have also provided controls for all the symbols and lines in the chart.
+#' One default, set by \code{as.Tufte=TRUE}, will strip chartjunk and draw a
+#' Boxplot per recommendations by Burghardt, Duncan and Liu(2013)
+#'
+#' @param R an xts, vector, matrix, data frame, timeSeries or zoo object of
+#' asset returns
+#' @return Stack Bar plot of lagged return coefficients
+#' @author R
+#' @seealso \code{\link[graphics]{boxplot}}
+#' @references Burghardt, Duncan and Liu(2013) \emph{It's the autocorrelation, stupid}. AlternativeEdge Note November, 2012 }
+#' @keywords Autocorrelation lag factors
+#' @examples
+#'
+#' data(edhec)
+#' chart.Autocorrelation(edhec)
+#'
+#'
+#' @export
+chart.Autocorrelation <-
+ function (R, ...)
+ { # @author R
+
+ # DESCRIPTION:
+ # A wrapper to create box and whiskers plot, of autocorrelation lag coeffiecients
+ # of the First six factors
+
+ R = checkData(R, method="xts")
+
+# Graph autos with adjacent bars using rainbow colors
+
+aa= table.Autocorrelation(R)
+barplot(as.matrix(aa), main="Auto Correlation Lag", ylab= "Value of Coefficient",
+ , xlab = "Fund Type",beside=TRUE, col=rainbow(6))
+
+ # Place the legend at the top-left corner with no frame
+ # using rainbow colors
+ legend("topright", c("1","2","3","4","5","6"), cex=0.6,
+ bty="n", fill=rainbow(6));
+
+
+
+
+}
\ No newline at end of file
More information about the Returnanalytics-commits
mailing list