[Blotter-commits] r246 - pkg/RTAQ/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Feb 15 19:38:28 CET 2010
Author: jonathan
Date: 2010-02-15 19:38:28 +0100 (Mon, 15 Feb 2010)
New Revision: 246
Modified:
pkg/RTAQ/R/volatility.R
Log:
addition: treshold covariance estimator (mancini & gobbi)
Modified: pkg/RTAQ/R/volatility.R
===================================================================
--- pkg/RTAQ/R/volatility.R 2010-02-15 10:45:40 UTC (rev 245)
+++ pkg/RTAQ/R/volatility.R 2010-02-15 18:38:28 UTC (rev 246)
@@ -167,6 +167,21 @@
return(cov)
}
+tresholdcov = function(ts) {
+ n=dim(ts)[1]; #number of observations
+ delta = 1/n;
+ rbpvars = apply(ts,2,FUN=RBPVar); #bipower variation per stock
+ tresholds = 3*sqrt(rbpvars)*(delta^(0.49)); #treshold per stock
+ tresmatrix = matrix(rep(tresholds,n),ncol=length(tresholds),nrow=n,byrow=TRUE);
+ condition = ts>tresmatrix;
+ ts[condition] = 0;
+ cov = RCov(ts);
+
+return(cov);
+ }
+
+
+
#Realized Correlation (RCor)
RCor = function(ts){
ts = na.locf(ts,na.rm=FALSE);
More information about the Blotter-commits
mailing list