[Highfrequency-commits] r130 - in pkg/highfrequency: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 1 01:36:08 CEST 2015


Author: payseur
Date: 2015-06-01 01:36:07 +0200 (Mon, 01 Jun 2015)
New Revision: 130

Modified:
   pkg/highfrequency/DESCRIPTION
   pkg/highfrequency/R/highfrequencyGSOC.R
   pkg/highfrequency/R/realized.R
Log:
Changed the explicit call of plot.zoo to plot.xts. 

Changed require... to requireNamespace.

Modified: pkg/highfrequency/DESCRIPTION
===================================================================
--- pkg/highfrequency/DESCRIPTION	2015-05-21 20:08:20 UTC (rev 129)
+++ pkg/highfrequency/DESCRIPTION	2015-05-31 23:36:07 UTC (rev 130)
@@ -1,13 +1,11 @@
-Package: highfrequency
-Version: 0.4
-Date: 2014-11-25
-Title: Tools For Highfrequency Data Analysis 
-Author: Kris Boudt [aut, cre], Jonathan Cornelissen [aut], Scott Payseur [aut], Giang Nguyen [ctb], Maarten Schermer [ctb] 
-Maintainer: Kris Boudt
-        <Kris.Boudt at econ.kuleuven.be>
-Description: Provide functionality to manage, clean and match highfrequency trades and quotes data, calculate various liquidity measures, estimate and forecast volatility, and investigate microstructure noise and intraday periodicity. 
-License: GPL (>= 2)
-Depends: R (>= 2.12.0), xts, zoo
-Suggests: robustbase, cubature, mvtnorm, chron, timeDate,
-        quantmod, MASS, sandwich, numDeriv, FKF, BMS, rugarch
-LazyLoad: yes
+Package: highfrequency
+Version: 0.41
+Date: 2014-05-31
+Title: Tools For Highfrequency Data Analysis 
+Author: Kris Boudt [aut, cre], Jonathan Cornelissen [aut], Scott Payseur [aut], Giang Nguyen [ctb], Maarten Schermer [ctb] 
+Maintainer: Kris Boudt <Kris.Boudt at econ.kuleuven.be>
+Description: Provide functionality to manage, clean and match highfrequency trades and quotes data, calculate various liquidity measures, estimate and forecast volatility, and investigate microstructure noise and intraday periodicity. 
+License: GPL (>= 2)
+Depends: R (>= 2.12.0), xts, zoo
+Suggests: robustbase, cubature, mvtnorm, chron, timeDate, quantmod, MASS, sandwich, numDeriv, FKF, BMS, rugarch
+LazyLoad: yes

Modified: pkg/highfrequency/R/highfrequencyGSOC.R
===================================================================
--- pkg/highfrequency/R/highfrequencyGSOC.R	2015-05-21 20:08:20 UTC (rev 129)
+++ pkg/highfrequency/R/highfrequencyGSOC.R	2015-05-31 23:36:07 UTC (rev 130)
@@ -1429,7 +1429,7 @@
 
 .SEheavyModel = function( paramsvector, data, p, q, backcast, LB, UB, compconst=FALSE, ...)
 {
-  require(numDeriv)
+  requireNamespace('numDeriv')
   K    = ncol(data);  #Number of series to model
   
   # Set lower and upper-bound if not specified:
@@ -1539,7 +1539,7 @@
       
     }
     
-    require(sandwich);
+    requireNamespace('sandwich');
     fm = lm(m ~ 0); 
     It = try(sandwich::vcovHAC(fm))
     
@@ -1556,7 +1556,7 @@
   
   invJ = try(solve(Jt))
   if( class(invJ) == "try-error"){
-    require("MASS")
+    requireNamespace("MASS")
     print("-1*Hessian is not invertible - generalized inverse is used")
     invJ = MASS::ginv(Jt)
   }

Modified: pkg/highfrequency/R/realized.R
===================================================================
--- pkg/highfrequency/R/realized.R	2015-05-21 20:08:20 UTC (rev 129)
+++ pkg/highfrequency/R/realized.R	2015-05-31 23:36:07 UTC (rev 130)
@@ -83,7 +83,7 @@
 
 #Realized Outlyingness Weighted Variance (ROWVar):
 univariateoutlyingness = function(rdata,...){
-    require('robustbase');
+    requireNamespace('robustbase');
     if(hasArg(data)){ rdata = data }
     #computes outlyingness of each obs compared to row location and scale
     location = 0;
@@ -97,9 +97,9 @@
 
 ROWVar = function(rdata, seasadjR = NULL, wfunction = "HR" , alphaMCD = 0.75, alpha = 0.001,...) 
 {
-    require('robustbase');
+    requireNamespace('robustbase');
     if(hasArg(data)){ rdata = data }
-    require(robustbase)
+    
     if (is.null(seasadjR)) {
         seasadjR = rdata;
     }
@@ -350,7 +350,7 @@
 }
 
 cfactor_RTSCV = function(eta=9){
-    require('cubature'); require('mvtnorm')
+    requireNamespace('cubature'); requireNamespace('mvtnorm')
     # rho = 1
     c1 = pchisq(eta,df=1)/pchisq(eta,df=3) 
     # 
@@ -1188,7 +1188,7 @@
     if( n > 1 ){ 
         rdatacheck(rdata,multi=TRUE);
         
-        require(robustbase)
+        requireNamespace('robustbase')
         rdata = as.matrix(rdata); seasadjR = as.matrix(seasadjR);
         intraT = nrow(rdata)
         N = ncol(rdata)
@@ -2018,7 +2018,10 @@
     g_range[1] = 0.95*g_range[1]; g_range[2]= 1.05 * g_range[2]; 
     #ind = seq(1,length(fitted),length.out=5);
     title = paste("Observed and forecasted RV based on HAR Model:",type);
-    plot.zoo(observed,col="red",lwd=2,main=title, ylim=g_range,xlab="Time",ylab="Realized Volatility"); 
+    #plot.xts(observed,col="red",lwd=2,main=title, ylim=g_range,xlab="Time",ylab="Realized Volatility"); 
+    
+    # There is an error in plot.xts that prevents colors from being passed.
+    plot.xts(observed,main=title, ylim=g_range,xlab="Time",ylab="Realized Volatility"); 
     #  axis(1,time(b)[ind], format(time(b)[ind],), las=2, cex.axis=0.8); not used anymore
     #  axis(2);
     lines(fitted,col="blue",lwd=2);
@@ -2229,7 +2232,7 @@
 convert = function(from, to, datasource, datadestination, trades = TRUE, 
                    quotes = TRUE, ticker, dir = FALSE, extension = "txt", header = FALSE, 
                    tradecolnames = NULL, quotecolnames = NULL, format = "%Y%m%d %H:%M:%S", onefile=FALSE){  
-  require("timeDate")
+  requireNamespace("timeDate")
   
   #############  1.A the data is in the "RTAQ folder" sturcture ##############
   if( onefile == FALSE ){
@@ -2339,7 +2342,7 @@
 uniTAQload = function(ticker,from,to,trades=TRUE,quotes=FALSE,datasource=NULL,variables=NULL){
   ##Function to load the taq data from a certain stock 
   #From&to (both included) should be in the format "%Y-%m-%d" e.g."2008-11-30"
-  require("timeDate")
+  requireNamespace("timeDate")
   dates = timeDate::timeSequence(as.character(from),as.character(to), format = "%Y-%m-%d", FinCenter = "GMT")
   dates = dates[timeDate::isBizday(dates, holidays = timeDate::holidayNYSE(1960:2040))];
   
@@ -2634,7 +2637,7 @@
  ###### Liquidity functions formerly in in RTAQ  ######
 .check_data = function(data){ 
   # FUNCTION sets column names according to RTAQ format using quantmod conventions, such that all the other functions find the correct information.
-  require('quantmod');
+  requireNamespace('quantmod');
   # First step: assign the xts attributes:
   data = set.AllColumns(data);
   
@@ -3100,7 +3103,7 @@
 
 
 tradesCleanup = function(from,to,datasource,datadestination,ticker,exchanges,tdataraw=NULL,report=TRUE,selection="median",...){
-  require('timeDate')
+  requireNamespace('timeDate')
   nresult = rep(0, 5)
   if(!is.list(exchanges)){ exchanges = as.list(exchanges)}
   if (is.null(tdataraw)) {



More information about the Highfrequency-commits mailing list