Hello, My programming is as follows. library(highfrequency) library(data.table) library(xts) tm<-seq.POSIXt(from = as.POSIXct("2020-08-20 09:30:00"),to = as.POSIXct("2020-08-20 15:59:00"),by='min') data<-xts(x=data$PRICE,order.by=tm) data <- as.data.table(data) setnames(data,c('index'),c('DT')) setnames(data,c('V1'),c('PRICE')) LMtest <- intradayJumpTest(pData = data,volEstimator = "RM", driftEstimator = "none",RM = "bipower", lookBackPeriod = 20,on = 'minutes', k = 5, marketOpen = "09:30:00",marketClose = "15:59:00") plot(LMtest) However, the error is that ''Error in xy.coords(x, y, setLab = FALSE) : 'x' and 'y' lengths differ''. I don't know how to correct it. [[alternative HTML version deleted]]
Hi, I tried running your code but it is not complete. When you create the xts you refer to data$PRICE but this has never been defined. I generated synthetic data and used that to create the xts object as follows: x <- runif( length(tm), min=90, max=110 ) data<-xts(x=x,order.by=tm) When I used this modified code the program executed with no problem. I hope that helps, Eric On Sat, Oct 10, 2020 at 3:13 AM Zixuan Qi <zixuan.qi at duke.edu> wrote:> Hello, > > My programming is as follows. > > library(highfrequency) > library(data.table) > library(xts) > tm<-seq.POSIXt(from = as.POSIXct("2020-08-20 09:30:00"),to > as.POSIXct("2020-08-20 15:59:00"),by='min') > data<-xts(x=data$PRICE,order.by=tm) > data <- as.data.table(data) > setnames(data,c('index'),c('DT')) > setnames(data,c('V1'),c('PRICE')) > LMtest <- intradayJumpTest(pData = data,volEstimator = "RM", > driftEstimator = "none",RM = "bipower", lookBackPeriod = 20,on = 'minutes', > k = 5, marketOpen = "09:30:00",marketClose = "15:59:00") > plot(LMtest) > > However, the error is that ''Error in xy.coords(x, y, setLab = FALSE) : > 'x' and 'y' lengths differ''. I don't know how to correct it. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Hello, The error is not reproducible, the second code line gives: data<-xts(x=data$PRICE,order.by=tm) #Error in data$PRICE : object of type 'closure' is not subsettable Please post a data example in dput format. dput(head(data, 30)) # post the output of this or similar Hope this helps, Rui Barradas ?s 01:13 de 10/10/20, Zixuan Qi escreveu:> Hello, > > My programming is as follows. > > library(highfrequency) > library(data.table) > library(xts) > tm<-seq.POSIXt(from = as.POSIXct("2020-08-20 09:30:00"),to = as.POSIXct("2020-08-20 15:59:00"),by='min') > data<-xts(x=data$PRICE,order.by=tm) > data <- as.data.table(data) > setnames(data,c('index'),c('DT')) > setnames(data,c('V1'),c('PRICE')) > LMtest <- intradayJumpTest(pData = data,volEstimator = "RM", driftEstimator = "none",RM = "bipower", lookBackPeriod = 20,on = 'minutes', k = 5, marketOpen = "09:30:00",marketClose = "15:59:00") > plot(LMtest) > > However, the error is that ''Error in xy.coords(x, y, setLab = FALSE) : 'x' and 'y' lengths differ''. I don't know how to correct it. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >