[Highfrequency-commits] r64 - pkg/highfrequency/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Oct 21 20:15:26 CEST 2013
Author: kboudt
Date: 2013-10-21 20:15:25 +0200 (Mon, 21 Oct 2013)
New Revision: 64
Modified:
pkg/highfrequency/R/highfrequencyGSOC.R
Log:
Modified: pkg/highfrequency/R/highfrequencyGSOC.R
===================================================================
--- pkg/highfrequency/R/highfrequencyGSOC.R 2013-10-21 11:41:01 UTC (rev 63)
+++ pkg/highfrequency/R/highfrequencyGSOC.R 2013-10-21 18:15:25 UTC (rev 64)
@@ -316,19 +316,19 @@
JOjumptest= function(pdata, power=4,...)
{
- R = .simre(pdata)
- r = makeReturns(pdata)
+ R = as.zoo(.simre(pdata));
+ r = as.zoo(makeReturns(pdata));
N = length(pdata)-1
bv = RBPVar(r)
rv = RV(r)
- SwV = 2*sum(R-r)
+ SwV = 2*sum(R-r,na.rm = TRUE)
mu1 = 2^(6/2)*gamma(1/2*(6+1))/gamma(1/2)
##mupower:
if(power==4)
{
- q = abs(rollapply(r, width = 4, FUN = prod, align = "left"))
+ q = abs(rollapply(r, width = 4, FUN = prod, align = "left",na.rm = TRUE))
mu2 = 2^((6/4)/2)*gamma(1/2*(6/4+1))/gamma(1/2)
av = mu1/9 * N^3*(mu2)^(-4)/(N-4-1)*sum(q^(6/4),na.rm= TRUE) ##check formula
JOtest = N*bv/sqrt(av)*(1- rv/SwV)
@@ -342,7 +342,7 @@
if(power==6)
{
- q=abs(rollapply(r, width = 6, FUN = prod, align = "left"))
+ q=abs(rollapply(r, width = 6, FUN = prod, align = "left",na.rm = TRUE))
mu2= 2^((6/6)/2)*gamma(1/2*(6/6+1))/gamma(1/2)
av=mu1/9 * N^3*(mu2)^(-6)/(N-6-1)*sum(q^(6/6),na.rm= TRUE) ##check formula
JOtest= N*bv/sqrt(av)*(1- rv/SwV)
@@ -1013,7 +1013,7 @@
##Preaverage return:
.hatreturn= function(pdata,kn)
{
- rdata=makeReturns(pdata)
+ rdata= as.zoo(makeReturns(pdata));
kn=as.numeric(kn)
if(kn == 1){ hatre = rdata}
else{
More information about the Highfrequency-commits
mailing list