[Returnanalytics-commits] r3627 - pkg/PerformanceAnalytics/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 25 14:16:56 CET 2015


Author: peter_carl
Date: 2015-03-25 14:16:56 +0100 (Wed, 25 Mar 2015)
New Revision: 3627

Modified:
   pkg/PerformanceAnalytics/R/chart.ACFplus.R
Log:
- replaces standard plot with barplot for easier reading


Modified: pkg/PerformanceAnalytics/R/chart.ACFplus.R
===================================================================
--- pkg/PerformanceAnalytics/R/chart.ACFplus.R	2015-03-23 23:54:52 UTC (rev 3626)
+++ pkg/PerformanceAnalytics/R/chart.ACFplus.R	2015-03-25 13:16:56 UTC (rev 3627)
@@ -29,7 +29,7 @@
     if (is.null(maxlag)) 
         maxlag = ceiling(10 + sqrt(num))
     ACF = acf(data, maxlag, plot = FALSE)$acf[-1]
-    PACF = pacf(data, maxlag, plot = FALSE)$acf
+    PACF = t(as.matrix(pacf(data, maxlag, plot = FALSE)$acf))
     Lag = 1:length(ACF)/frequency(data)
     minA = min(ACF)
     minP = min(PACF)
@@ -47,16 +47,16 @@
 
     # ACF chart
     par(mar=c(0.5,4,4,2) + 0.1)
-    plot(Lag, ACF, type = "h", ylim = c(minu,1), main = main, axes = FALSE, ...)
+    barplot(ACF, ylim = c(minu,1), main = main, axes = FALSE, ylab="acf", ...)
     box(col=elementcolor)
     axis(2, col = elementcolor, cex.axis = 0.8)
     abline(h=c(0,L,U), lty=c(1,2,2), col=c(1,4,4))
 
     # PACF chart
     par(mar=c(4,4,0.5,2)+ 0.1)
-    plot(Lag, PACF, type = "h", ylim = c(minu,1), axes = FALSE, ...)
+    barplot(PACF, ylim = c(minu,1), axes = FALSE, ylab="pacf", ...)
     box(col=elementcolor)
-    axis(1, col = elementcolor, cex.axis = 0.8)
+    axis(1, col = elementcolor, cex.axis = 0.8, xlab="lag")
     axis(2, col = elementcolor, cex.axis = 0.8)
     abline(h=c(0,L,U), lty=c(1,2,2), col=c(1,4,4))
 



More information about the Returnanalytics-commits mailing list