[Blotter-commits] r185 - pkg/RTAQ/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jan 19 19:55:04 CET 2010
Author: jonathan
Date: 2010-01-19 19:55:03 +0100 (Tue, 19 Jan 2010)
New Revision: 185
Modified:
pkg/RTAQ/R/volatility.R
Log:
MinRV, MedRV correction
Modified: pkg/RTAQ/R/volatility.R
===================================================================
--- pkg/RTAQ/R/volatility.R 2010-01-19 14:58:00 UTC (rev 184)
+++ pkg/RTAQ/R/volatility.R 2010-01-19 18:55:03 UTC (rev 185)
@@ -52,9 +52,9 @@
return(rbpvar);
}
-#MinRV
+#MinRV:
MinRV = function(a){
- q = xts(abs(as.numeric(a)),index(a)); #absolute value
+ q = as.zoo(abs(as.numeric(a))); #absolute value
q = as.numeric(rollapply(q, width=2, FUN=min,by = 1, align="left"));
N = length(q)+1; #number of obs
minrv = (pi/(pi-2))*(N/(N-1))*sum(q^2);
@@ -63,7 +63,7 @@
#MedRV
MedRV = function(a){
- q = xts(abs(as.numeric(a)),index(a)); #absolute value
+ q = abs(as.numeric(a)); #absolute value
q = as.numeric(rollmedian(q, k=3, align="center"));
N = length(q) + 2;
minrv = (pi/(6-4*sqrt(3)+pi))*(N/(N-2))*sum(q^2);
More information about the Blotter-commits
mailing list