There is not much more to explain than to show what works and what does not in the following reproducible example:
# WORK
auto.adam(data = zoo(AirPassengers), lags = c(12), distribution = 'dgamma') # The "true" period
auto.adam(data = zoo(AirPassengers), lags = c(23), distribution = 'dgamma') # Double period -1
auto.adam(data = zoo(AirPassengers), lags = c(25), distribution = 'dgamma') # Double period +1
auto.adam(data = zoo(AirPassengers), lags = c(36), distribution = 'dgamma') # Triple period
# FAIL
auto.adam(data = zoo(AirPassengers), lags = c(24), distribution = 'dgamma') # Double period
auto.adam(data = zoo(AirPassengers), lags = c(48), distribution = 'dgamma') # Quadruple period
The failure is with this error and warning (and the warning does not appear in the working cases):
Error in if (doShifts) { : argument is of length zero
In addition: Warning message:
This function only works with classes zoo and POSIXt. Cannot extract DST observations.
The failing cases work if AirPassengers is not converted to zoo, but that is, I think, beside the point.
(The distribution argument is not necessary to trigger the issue; it is only there to speed up execution).
Finding this might seem very random: the context in which it came up was automatically determining periodicity prior to fitting; then checking double the dominant frequency after the first fit is worth a try.
There is not much more to explain than to show what works and what does not in the following reproducible example:
The failure is with this error and warning (and the warning does not appear in the working cases):
The failing cases work if AirPassengers is not converted to zoo, but that is, I think, beside the point. (The
distribution
argument is not necessary to trigger the issue; it is only there to speed up execution).Finding this might seem very random: the context in which it came up was automatically determining periodicity prior to fitting; then checking double the dominant frequency after the first fit is worth a try.