我一直在尝试使用Twitter的AnomalyDetection软件包来识别可疑的数据,但我无法使用选项" direction =' NEG'&#34 ;.当我运行以下示例(取自here)时,我只得到一个带有0个观察值的data.frame,并且该结果为NULL结果:
devtools::install_github("twitter/AnomalyDetection") # install twitter's AnomalyDetection
library(AnomalyDetection)
library(fpp) # for 'ausair' data
library(lubridate)
myTS <- ausair # initialise data
myPeriod <- "year" # set the period
ymth <- paste(start(myTS), collapse="/")
startDate <- as.Date(paste(ymth, "1", sep="/"), format="%Y/%m/%d") # start date
eymth <- paste(end(myTS), collapse="/")
endDate <- as.Date(paste(eymth, "1", sep="/"), format="%Y/%m/%d") # end date
Dates <- seq.Date(startDate, endDate, by=myPeriod) # create the dates
Dates <- ymd(Dates) # convert to POSIXct
Dates <- as.POSIXct(Dates)
myData <- data.frame(Dates, myTS) # cast as a data.frame
AnomalyDetectionTs(myData, max_anoms = 0.2, direction='pos', plot=TRUE) # this works!
AnomalyDetectionTs(myData, max_anoms = 0.2, direction='neg', plot=TRUE) # this doesn't
有没有办法使用&#34; direction =&#39; neg&#39;&#34;选项?
答案 0 :(得分:0)
对此的简单回答可能是没有任何负异常现象。我看到这种情况发生在我的分析中。尝试放宽max_anoms参数,您的模型会对它们更加敏感。