Reputation: 124
I am working with the tsoutliers
package in R for outlier detection in time series data. Both functions, locate.outliers()
and tso()
, are used for detecting outliers, but I am observing different results (means table of detected outliers) between the two functions, even though the inputs appear to be the same.
Here is the code I used:
# Using locate.outliers()
m_opt <- Arima(x, order = c(8, 1, 0),
seasonal = list(order = c(1, 1, 1), period = 7),
xreg = fourier(x, K = 3))
resid <- residuals(m_opt) # residuals
pars <- coefs2poly(m_opt) # collapses the polynomials of an ARIMA model
outliers <- locate.outliers(resid, pars, types = c("TC", "AO", "LS"), cval = 3.77)
print(outliers) # result
# Using tso()
tso_opt <- tso(x, types = c("TC", "AO", "LS"), xreg = fourier(x, K = 3),
tsmethod = "arima",
args.tsmethod = list(order = c(8, 1, 0),
seasonal = list(order = c(1, 1, 1), period = 7)),
cval = 3.77)
print(tso_opt$outliers) # result
The results from locate.outliers()
include more detected outliers compared to tso()
.
I would like to understand:
locate.outliers()
detect more outliers than tso()
in this
scenario?cval
), or outlier
types? I've checked and the resulting ARIMA model and cval
is the same in the output.Upvotes: 0
Views: 39