christophsax / seasonal

R interface to X-13ARIMA-SEATS
www.seasonal.website
120 stars 27 forks source link

The function `seas()` fails, complaining of errors in the data, for no good reason #287

Open jhmaindonald opened 2 years ago

jhmaindonald commented 2 years ago

A fit on the monthly series 1910 to March 2022 fails, with the error "Error: X-13 run failed". The file generated for the X-13 run appears fine. Data in file reads into R using read.table(), with finite range of values.

When the series is split into two parts, 1910 to 1949, and 1950 to 2022, there is no problem.

Details are in the attached PDF.

FitTOmonthlySeries1910to2022.pdf

christophsax commented 2 years ago

Could you give a reproducible example? See here for how to provide one.

This may be a X13 limitation. I have some vague memories that I had troubles with very long time series too.

jhmaindonald commented 2 years ago

Run the following code to reproduce the error. A check is needed on the "number of years spanned by the forecast augmented series" (must be <=85) before writing the series to disk for input to X13.

library(seasonal)
y <- structure(c(27.48, 28.71, 25.86, 21.24, 7.72, 15.21, 15.42, 15.93, 
            18.15, 23.72, 25.68, 26.58, 26.99, 27.15, 24.65, 20.49, 7.88, 
            15.09, 13.86, 15.81, 19.29, 21.7, 24.5, 26.32, 30.21, 26.31, 
            25.37, 21.14, 8.15, 14.15, 13.63, 16.35, 19.16, 21, 25.55, 26.79, 
            27.45, 26.41, 26.82, 21.88, 7.37, 15.08, 14.8, 14.52, 18.87, 
            23.23, 24.61, 25.41, 27.59, 26.19, 26.75, 21.13, 8.2, 14.14, 
            14.78, 16.22, 19.68, 21.37, 24.68, 26.14, 27.02, 26.37, 24.98, 
            20.7, 6.44, 14.11, 14.14, 16.73, 18.81, 23.12, 25.71, 26.92, 
            27.56, 27.02, 24.82, 20.66, 8.15, 13.54, 14.91, 16.96, 18.09, 
            22.91, 25.4, 27, 26.75, 26.35, 24.95, 20.17, 7.6, 13.96, 13.72, 
            17.12, 19.95, 24.27, 26.4, 28.26, 27.56, 26.83, 27, 22.92, 9.89, 
            15, 14.02, 15.45, 19.27, 24.73, 27.43, 28.39, 31.6, 28.57, 25.28, 
            21.96, 9.3, 15.04, 13.06, 15.28, 18.08, 21.51, 24.37, 26.2, 28.91, 
            26.57, 27.31, 21.68, 6.75, 14.65, 14.29, 16.22, 19.73, 24.62, 
            24.76, 28.19, 25.07, 25.56, 23.51, 22.62, 7.39, 14.85, 14.2, 
            15.15, 19.69, 21.98, 26.96, 27.51, 29.53, 26.21, 26.01, 22.33, 
            9.07, 16.2, 14.76, 16.62, 19.39, 22.34, 25.13, 27.16, 26.7, 27.15, 
            27.17, 20.47, 7.11, 13.36, 13.36, 14.06, 18.81, 22.52, 24.11, 
            26.52, 28.83, 26.29, 25.25, 19.69, 6.14, 14.17, 14.41, 15.72, 
            20.05, 23.3, 27.79, 27.63, 28.33, 26.22, 24.24, 21.31, 7.62, 
            16.81, 13.37, 16.71, 18.69, 21.8, 25.64, 28.42, 29.24, 27.56, 
            23.28, 19.97, 7.79, 13.14, 14.73, 15.75, 18.53, 21.56, 27.02, 
            27.72, 29.15, 27.22, 24.98, 20.92, 9.19, 14.95, 14.11, 15.41, 
            18.84, 21.52, 23.66, 25.95, 25.6, 28.01, 23.66, 21.04, 6.32, 
            14.88, 13.25, 16.16, 19.38, 21.88, 25.18, 27.79, 26.7, 25.72, 
            25.15, 20.16, 6.87, 12.97, 14.16, 15.86, 18.85, 22.86, 24.27, 
            26.97, 27.5, 25.81, 24.89, 21.27, 8.07, 14.84, 15.74, 15.9, 19.74, 
            21.87, 24.12, 27.5, 27.43, 27.14, 26.61, 19.63, 7.36, 16.04, 
            14.37, 14.46, 19.86, 22.05, 24.85, 26.99, 29.51, 26.71, 25.4, 
            20.65, 7.24, 15.04, 13.68, 15.99, 19.05, 22.05, 23.72, 26.92, 
            27.19, 25.33, 26.06, 22.95, 7.54, 14.72, 14.24, 14.97, 19, 22.09, 
            24.59, 28.23, 27.36, 25.03, 24.44, 23.02, 7.45, 14.95, 15.01, 
            16.68, 19.07, 22.83, 25.13, 27.19, 27.82, 27.1, 26.25, 22.56, 
            6.8, 15.64, 13.54, 16.22, 19.65, 22.67, 23.69, 25.1, 26.31, 27.04, 
            25.67, 21.22, 6.98, 14.26, 14.43, 14.4, 17.31, 20.37, 22.53, 
            25.69, 27.95, 26.74, 24.6, 22.46, 7.06, 17.68, 12.91, 16.1, 18.66, 
            23.16, 25.97, 29.19, 27.68, 26.83, 25.63, 23.28, 10.13, 15.26, 
            14.36, 16.62, 17.49, 22.02, 26.41, 26.31, 28.34, 26.91, 25.52, 
            22.13, 7.36, 15.44, 14.58, 16.86, 19.36, 21.8, 27.9, 25.89, 29.6, 
            26.96, 25.76, 22.14, 6.21, 13.76, 14.66, 14.51, 18.69, 22.77, 
            23.24, 27.08, 27.92, 26.96, 25.01, 22.62, 6.99, 15.34, 13.95, 
            15.65, 19.77, 24.65, 26.01, 27.05, 26.91, 26.44, 25.01, 21.47, 
            6.43, 16.28, 15.27, 15.65, 19, 21.84, 26.18, 25.93, 26.23, 27.07, 
            25.97, 21.52, 9.05, 15.08, 13.71, 16.22, 19.12, 23.17, 24.71, 
            27.33, 27.28, 26, 25.6, 22.27, 7.35, 15.17, 14.68, 15.85, 19.73, 
            20.61, 25.14, 24.86, 27.02, 28.32, 25.77, 20.97, 8.2, 14.98, 
            13.41, 16.75, 21.37, 24.66, 25.52, 28.19, 28.17, 26.69, 25.16, 
            22.09, 6.87, 14.72, 13.5, 15.46, 18.73, 21.71, 25.11, 26.52, 
            28.16, 28.11, 23.94, 22.73, 8.21, 17.15, 14.31, 15.13, 19.07, 
            24.81, 25.86, 26.04, 28.48, 28.58, 26.77, 23.97, 6.79, 14.47, 
            13.36, 15.44, 18.32, 22.71, 25.26, 26.19, 29.78, 28.35, 25.59, 
            21.69, 7.49, 14.65, 15.57, 17.02, 16.56, 23.61, 24.32, 26.08, 
            26.91, 27.72, 24.1, 22.34, 6.56, 15.47, 13.83, 15.26, 17.56, 
            22.64, 24.66, 26.67, 27.49, 26.82, 26.27, 22.45, 7.55, 14.51, 
            13.57, 15.85, 19.12, 22.45, 23.64, 26.68, 26.16, 25.77, 24.81, 
            21.56, 8.47, 15.35, 14.19, 17.2, 20.63, 23.44, 25.68, 29, 30.06, 
            27.39, 25.58, 23.13, 8.89, 15.72, 16.5, 16.67, 20.05, 23.44, 
            24.88, 27.27, 27.22, 26.3, 26.65, 22.79, 8.63, 15.02, 14.66, 
            15.74, 17.47, 21.63, 23.29, 26.63, 26.86, 27.09, 24.61, 21.55, 
            9.07, 15.22, 16.47, 16.29, 20.48, 21.71, 26.05, 28.02, 26.48, 
            26.33, 25.19, 21.3, 7.77, 15.2, 14.5, 15.44, 18.15, 20.62, 24.26, 
            27.14, 27.84, 28.09, 24.9, 21.2, 8.15, 14.54, 13.57, 17.36, 18.68, 
            24.21, 26.56, 28.24, 27.89, 27.71, 26.12, 21.61, 9, 15.15, 13.92, 
            15.01, 18.43, 21.8, 24.45, 25.68, 30.56, 27.89, 26, 22.12, 7.36, 
            16.51, 14.34, 16, 19.56, 22.52, 26.96, 29.02, 27.62, 27.94, 26.1, 
            23.22, 9.37, 15.36, 14.61, 16.97, 20.65, 24.46, 27.31, 28.27, 
            30.81, 29.3, 24.78, 23.07, 8.63, 15.13, 14.71, 15.46, 20.77, 
            23.08, 24.58, 27.84, 29.54, 28.57, 25.81, 22.27, 8.06, 13.48, 
            13.26, 18.35, 19.27, 22.5, 28.04, 28.76, 27.72, 30.19, 27.31, 
            20.5, 8.99, 14.89, 13.84, 16.33, 20.31, 23.11, 24.36, 27.02, 
            25.55, 26.19, 24.09, 21.46, 7.99, 15.78, 14.06, 16.4, 17.51, 
            22.39, 25.79, 26.78, 28.19, 27.31, 26.8, 22.19, 8.93, 14.48, 
            14.72, 16.42, 18.25, 22.6, 25.17, 26.21, 26.73, 27.27, 27.62, 
            23.03, 9.04, 14.72, 14.55, 15.83, 19.49, 21.14, 24.78, 25.78, 
            27.68, 27.71, 23.96, 22.92, 8.37, 16.54, 14.04, 16.76, 19.53, 
            22.24, 25.77, 27.62, 29.51, 25.95, 25.43, 22.63, 9.41, 15.77, 
            15.83, 16.72, 20.22, 24.72, 25.16, 28.36, 26.9, 27.15, 26.64, 
            22.88, 9.85, 14.64, 14.03, 14.38, 18.81, 22.66, 25.65, 27.54, 
            29.42, 26.77, 26.52, 22.49, 8.67, 14.92, 15.17, 15.31, 19.25, 
            22.98, 26.91, 29.53, 28.82, 28.73, 25.72, 21.84, 8.97, 17.91, 
            14.53, 16.11, 19.49, 24.67, 25.93, 26.39, 27.02, 26.48, 26.52, 
            22.86, 8.4, 15.06, 15.02, 15.77, 17.96, 22.59, 23.45, 26.32, 
            28.96, 27.7, 25.18, 23.56, 9.18, 15.15, 16.61, 17.29, 19.29, 
            21.96, 25.82, 26.22, 28.38, 27.09, 23.54, 21.98, 8.22, 15.97, 
            14.8, 15.33, 18.62, 23.15, 25.92, 29.29, 27.89, 26.7, 25.04, 
            20.25, 8.83, 16.09, 14.3, 17.98, 19.88, 23.18, 26.28, 26.14, 
            27.76, 25.75, 25.53, 20.8, 8.98, 16.99, 14.99, 16.7, 19.72, 23.2, 
            24.41, 27.04, 27.52, 29.57, 24.76, 22.23, 8.87, 15.45, 14.09, 
            15.79, 20.09, 23.6, 27.69, 28.93, 29.02, 28.04, 27.37, 22.18, 
            8.46, 15.48, 14.59, 17.59, 20.77, 22.15, 24.61, 28.01, 30.32, 
            27.28, 25.79, 20.45, 9.46, 15.8, 15.91, 17.02, 21.25, 24.23, 
            23.25, 25.56, 26.48, 28.18, 26.51, 22.65, 7.7, 14.94, 15.05, 
            16.31, 21.55, 22.7, 26.35, 27.95, 30.97, 29.15, 25.44, 22.64, 
            7.88, 16.48, 15.1, 16.36, 21.02, 21.76, 24.7, 26.77, 27.95, 26.57, 
            26.05, 24.06, 8.47, 16.02, 14.98, 17.01, 20.98, 24.02, 28.63, 
            28.28, 30.09, 28.5, 25.02, 22.66, 9.18, 16.47, 15.35, 16.43, 
            20.16, 21.48, 26.33, 29.43, 28.3, 29.44, 26.11, 23.61, 7.52, 
            15.87, 14.66, 16.79, 19.63, 24.18, 25.86, 27.38, 28.94, 27, 25.4, 
            25.37, 8.88, 17.11, 15.93, 16.67, 20.16, 24.31, 26.8, 28.91, 
            31.66, 29.3, 27.12, 21.15, 6.77, 14.62, 15.38, 16.95, 21.28, 
            25.12, 27.47, 27.89, 29.36, 29.51, 27.42, 23.75, 10.71, 14.05, 
            14.47, 18.16, 20.54, 25, 26.99, 27.6, 28.75, 25.49, 25.93, 20.96, 
            8.45, 17.25, 14.97, 15.11, 20.71, 24.68, 25.92, 27.3, 29.77, 
            28.49, 26.38, 22.53, 8.75, 16.59, 15.5, 18.68, 20.72, 23.26, 
            30.33, 28.65, 29.31, 27.88, 25.62, 23.32, 8.38, 15.61, 15.27, 
            15.63, 19.36, 22.49, 24.83, 26, 29.07, 28.09, 25.32, 21.67, 6.94, 
            15.62, 14.79, 18.04, 20.32, 23.35, 27.39, 25.78, 27.73, 26.21, 
            24.45, 22.38, 7.39, 15.28, 14.98, 16.07, 20.24, 23.19, 27.71, 
            28.82, 30.61, 27.85, 26.24, 22.58, 8.85, 16.25, 16.57, 17.65, 
            22.79, 23.96, 25.85, 28.53, 30.07, 28.94, 26.33, 23.52, 9.98, 
            16.44, 14.97, 16.42, 20.29, 25.47, 28.7, 28.57, 28.1, 28.98, 
            26.4, 21.72, 8.58, 15.95, 14.4, 16.36, 19.39, 27.21, 27.87, 29.27, 
            28.9, 28.74, 28.28, 24.88, 10.01, 16.19, 15.97, 16.52, 19.01, 
            21.62, 25.71, 29.23, 31.19, 29.51, 28.11, 22.36, 8.78, 15.63, 
            15.67, 16.48, 20.93, 24.77, 26.94, 29.12, 31.17, 28.83, 27.18, 
            25.39, 8.62, 15.63, 15.54, 16.54, 20.24, 25.22, 26.63, 30.07, 
            33.3, 28.78, 27.65, 23.96, 9.04, 15.82, 16.21, 16.22, 20.53, 
            24.97, 26.44, 30.52, 30.96, 27.61, 25.31, 22.18, 7.38, 15.72, 
            15.18, 16.3, 21.42, 24.2, 28.82, 27.65, 28.23, 27.18, 25.03, 
            21.4, 8.3, 16.04, 15.38, 17.44, 20.24, 23, 24.9, 27.5, 29.74, 
            27.05, 26.83), .Tsp = c(1930, 2022.16666666667, 12), class = "ts")
m <- seas(y)
## Complaint is that there is a problem reading file .../iofile.dta 
y2 <- window(y, start=c(1940,1))
m2 <- seas(y2)
## Complaint now makes a great deal more sense:
## "Number of years spanned by the forecast augmented series (86) exceeds
## program limit (85)"