Error in `[.xts`(data, , 2) : subscript out of bounds

Hi,

Please could you help regarding the following error:
Error in [.xts(data, , 2) : subscript out of bounds

This error appears in the package 'highfrequency' after running even the package's example from the documentation:

data("sample_5minprices_jumps");
data = sample_5minprices_jumps[,1];
data = makeReturns(data); #Get the high-frequency return data
x = harModel(data, periods = c(1,5,10), periodsJ=c(1,5,10),

  •               RVest = c("rCov","rBPCov"), type="HARRVCJ",
    
  •               transform="sqrt");
    

Thank you,
Ioana

I am not familiar with this package but I notice that the code you posted is not exactly the same as the code in the package documentation for the harModel() function. In particular, sample_5minprices_jumps[,1] may not result in the same thing as sample_5minprices_jumps$stock1. Please run the following. You made need to precede it with data("sample_5minprices_jumps").

dat <- sample_5minprices_jumps$stock1
dat <- makeReturns(dat) #Get the high-frequency return data

x <- harModel(dat, periods = c(1,5,10), periodsJ = c(1,5,10),
                 RVest = c("rCov","rBPCov"),type = "HARRVCJ",
                 transform = "sqrt", inputType = "returns")
2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

Thank you. It works. Have a nice day.