I’ve been having this error in R:
Error in dimnames<-.xts
(*tmp*
, value = dn) : length of ‘dimnames’ [2] not equal to array extent
when running the below
bns_data <- xts(apple_data$log_ret, order.by = apple_data$Date)
colnames(bns_data) <- "Log_ret"
bns_test <- BNSjumpTest(rData = bns_data$Log_ret, IVestimator = "rThresholdCov",IQestimator = "rMedRQuar", type = "linear",
logTransform = FALSE, max = FALSE, alignBy = "minutes" , alignPeriod = 5,
makeReturns = FALSE, alpha = 0.975)```
I've tried pretty much everything I could, the documentation doesn't help much... I found the code for the function and this what the function does under the hood.
BNSjumpTest <- function (rData, IVestimator = “BV”, IQestimator = “TP”, type = “linear”,
logTransform = FALSE, max = FALSE, alignBy = NULL, alignPeriod = NULL,
makeReturns = FALSE, alpha = 0.975) {
if (is.xts(rData) && checkMultiDays(rData)) {
result <-
apply.daily(rData,
function(x) {
tmp <- BNSjumpTest(rData = x, IVestimator = IVestimator, IQestimator = IQestimator, type = type, logTransform = logTransform,
max = max, alignBy = alignBy, alignPeriod = alignPeriod, makeReturns = makeReturns, alpha = alpha)
return(cbind(tmp[[1]], tmp[[2]][1], tmp[[2]][2], tmp[[3]]))
})
colnames(result) <- c("ztest", "lower", "upper", "p-value")
Can someone please help me with that? been couple of days trying to solve this already.
Cheers
Tried to change the parameters of the function, tried to pass a data table with the first column being Date and second column log return. code ran but didn't give me any result, empty list.
Ran only the IVEstimator rThresholdCov function on its own and it worked, so not sure what's wrong
New contributor
user9994 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.