'Error in betaM[[lag0]] : attempt to select less than one element in get1index

I run this code in R and I get the following error:

Error in betaM[[lag0]] : 
  attempt to select less than one element in get1index

Can you help me?

Code:

knitr::opts_chunk$set(eval = FALSE, echo = TRUE, warning = FALSE,
                      message = FALSE, comment = NA)

library(psymonitor)  # For testting for bubble monitoring
library(ggplot2)     # To handle plots
library(knitr)       # for nice looking tables

data(chart)
chart$`Sales USD` <- 1/chart$`Sales USD`
# snp$pd <-  1/snp$value
head(chart)

y        <- chart$`Sales USD`
obs      <- length(y)
r0       <- 0.01 + 1.8/sqrt(obs)
swindow0 <- floor(r0*obs)
dim      <- obs - swindow0 + 1
IC       <- 2
adflag   <- 6
yr       <- 2
Tb       <- 12*yr + swindow0 - 1
nboot    <- 99

bsadf          <- PSY(y, swindow0, IC, adflag)
quantilesBsadf <- cvPSYwmboot(y, swindow0, IC, adflag, Tb, nboot, nCores = 2)
r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source