seasonal icon indicating copy to clipboard operation
seasonal copied to clipboard

iofile.est not found?

Open addison-grant opened this issue 2 years ago • 2 comments

I am not sure if I am doing something wrong, or if this is the right place to post this. I am trying to run seas on a small dataset, but running into this error message:

> m <- seas(tdata)
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file 'C:/Users/addis_wig9kwg/Documents/TEMP\Rtmpq0AnX3\x1354d8331e35b4/iofile.est': No such file or directory

tdata can be reproduced from this:

au_data_3.csv:

"","x"
"1",52604.81
"2",53141.78
"3",59271.6
"4",54476.88
"5",66938.94
"6",65500.01
"7",71684.73
"8",63713.29
"9",58863.21
"10",63600.67
"11",73312.29
"12",72956.85
"13",64393.54
"14",63106.64
"15",62815.14
"16",84729.49
"17",108466.78
"18",117980.63
"19",125717.44
"20",125629.39
"21",102390.65
"22",121348.14
"23",169331.13
"24",134011.12
"25",120678.75
"26",116665.94
"27",119349.04
"28",111402.42
"29",125400.23
"30",139325.92
"31",145616.87
"32",166295.89
"33",162347.97
"34",155599.53
"35",188771.92
"36",135550.8
"37",119277.33
"38",106787.06
"39",126194.51
"40",125725.55
"41",149677.71
"42",153743.23
"43",148186.37
"44",158082.96
"45",162852.29

Failing script:

csvdata <- read.csv("au_data_3.csv")
tdata <- ts(csvdata$x, start=c(2019,1), frequency=12)
m <- seas(tdata)

Alternative data loading method:

tdata <- structure(c(52604.81, 53141.78, 59271.6, 54476.88, 66938.94, 
65500.01, 71684.73, 63713.29, 58863.21, 63600.67, 73312.29, 72956.85, 
64393.54, 63106.64, 62815.14, 84729.49, 108466.78, 117980.63, 
125717.44, 125629.39, 102390.65, 121348.14, 169331.13, 134011.12, 
120678.75, 116665.94, 119349.04, 111402.42, 125400.23, 139325.92, 
145616.87, 166295.89, 162347.97, 155599.53, 188771.92, 135550.8, 
119277.33, 106787.06, 126194.51, 125725.55, 149677.71, 153743.23, 
148186.37, 158082.96, 162852.29), tsp = c(2019, 2022.66666666667, 
12), class = "ts")
m <- seas(tdata)

Failure:

Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file 'C:/Users/addis_wig9kwg/Documents/TEMP\Rtmpq0AnX3\x1354d8331e35b4/iofile.est': No such file or directory

addison-grant avatar Oct 06 '22 23:10 addison-grant

Can you do dput(tdata)? And include the data into the example. See: https://github.com/christophsax/seasonal/wiki/Creating-a-Reproducible-Example

Thanks!

christophsax avatar Oct 07 '22 08:10 christophsax

Okay, I updated the script to contain the data. Thanks for looking into this!

addison-grant avatar Oct 07 '22 21:10 addison-grant

The same error reported here: https://stackoverflow.com/questions/75378090/library-seasonal-x-13arima-error-between-36-and-62-points

MRE:

library(seasonal)
Test.ts <- ts(rnorm(62), start = 2019, frequency = 12) 
seas(Test.ts) 

robjhyndman avatar Feb 07 '23 23:02 robjhyndman

It appears x13 does not write the .est file under certain conditions and seasonal attempts to read it without any checks. Should be pretty straight forward to fix in https://github.com/christophsax/seasonal/blob/main/R/read_est.R#L8

It looks like the length of the series is not the only factor as suggested in the SO post though:

library(seasonal)
s <- window(AirPassengers, end = 1954)
length(s)
#> [1] 61
seas(s)
#> 
#> Call:
#> seas(x = s)
#> 
#> Coefficients:
#> MA-Nonseasonal-01     MA-Seasonal-12  
#>            0.4693             0.9986

HomoCodens avatar Feb 15 '23 09:02 HomoCodens

The issue seems to persist for my data set as follows:

> dput(dat)
structure(list(month = structure(c(17987, 18017, 18048, 18078, 
18109, 18140, 18170, 18201, 18231, 18262, 18293, 18322, 18353, 
18383, 18414, 18444, 18475, 18506, 18536, 18567, 18597, 18628, 
18659, 18687, 18718, 18748, 18779, 18809, 18840, 18871, 18901, 
18932, 18962, 18993, 19024, 19052, 19083, 19113, 19144, 19174, 
19205, 19236, 19266, 19297, 19327, 19358, 19389, 19417), class = c("yearmonth", 
"vctrs_vctr")), A = c(27443.48645, 31165.11159, 38869.79185, 
38979.8978, 27022.54772, 31888.62613, 25296.83239, 23127.71895, 
18246.83932, 20697.74995, 23826.7046, 33571.8692, 14352.26774, 
17146.68522, 18521.96467, 28704.80724, 22920.54158, 39512.20632, 
30397.21227, 30285.58444, 27060.92314, 32123.12422, 24372.63913, 
34482.0204, 24024.71094, 24995.79541, 28397.55315, 34148.14114, 
31706.28797, 36113.10711, 27979.57334, 27112.8924, 19472.17909, 
25668.32985, 26353.51978, 27947.88973, 21924.70249, 29113.46011, 
28619.64996, 33977.23429, 39401.93584, 30464.92729, 30134.05679, 
25125.15026, 18097.40143, 19209.22628, 23019.37255, 27301.439
), B = c(1335.3376, 1618.08641, 2329.86421, 2233.91925, 3050.13616, 
3189.43123, 1409.79606, 274.05088, 818.0346, 682.29664, 594.42619, 
734.52513, 538.85038, 166.44451, 427.79796, 663.10388, 1607.96279, 
959.57398, 388.79872, 56.87124, 140.95291, 1861.97095, 218.36189, 
550.45639, 896.39526, 1443.17664, 2119.47711, 2356.36296, 967.00592, 
5326.84403, 1785.9024, 1141.08663, 371.26397, 107.88308, 890.24639, 
153.29625, 329.62198, 1401.47995, 1975.76786, 2709.29474, 2520.28111, 
1324.66156, 1546.1552, 710.64584, 352.42383, 1042.78611, 236.54685, 
2128.37251), C = c(14235.83178, 12573.60324, 11480.67145, 16447.87426, 
7226.00589, 13520.138, 6712.47313, 11308.95441, 7212.96925, 8262.72671, 
11400.04049, 11443.55383, 4455.51825, 5794.6118, 8417.60095, 
8296.24941, 8000.51262, 16528.66321, 16092.69015, 13677.17976, 
10658.44887, 16235.6568, 8993.55309, 10239.49987, 4563.08961, 
5748.84282, 4589.50465, 8223.85934, 7983.57168, 5249.58807, 4893.05016, 
3071.631, 1821.81204, 8547.84656, 4979.2571, 3443.16887, 4444.74169, 
5088.66803, 4292.89958, 4816.93981, 7572.59272, 6778.34237, 8607.32244, 
8839.3874, 6510.65071, 3127.12781, 5035.74817, 9302.72028), D = c(4929.06448, 
2584.1925, 2992.80895, 4036.11239, 2690.27137, 2466.96608, 3099.33316, 
3542.75332, 4118.99808, 2050.27389, 2605.32059, 3101.40223, 3750.01811, 
3484.18412, 2146.96072, 7097.96545, 3881.85715, 7340.32959, 5752.06586, 
5470.5361, 8361.04846, 5137.79752, 5892.63377, 10135.23175, 7205.01746, 
5198.07488, 6231.54788, 4939.51904, 5556.93983, 7023.39728, 5596.30786, 
5607.97021, 5831.27483, 5680.06097, 10142.12679, 7328.59621, 
5125.97292, 5035.52359, 3987.68178, 4289.94724, 3253.98544, 2961.20392, 
2019.39289, 2501.81891, 2317.27967, 4908.91273, 4895.35146, 3196.44638
), E = c(765.10124, 1127.46007, 1474.86533, 2437.30699, 3811.60761, 
2466.17861, 2949.05559, 1489.3138, 1846.49067, 1964.70855, 1318.58933, 
4612.98169, 1620.74237, 1826.23391, 1407.22555, 2691.70593, 957.22898, 
989.26682, 1134.53158, 2543.99908, 496.78523, 962.02811, 1356.85178, 
3095.9385, 3036.03671, 4084.45252, 4839.97944, 4393.40755, 4232.90637, 
3696.35409, 3791.93124, 3007.02851, 2682.40238, 2655.93974, 2319.04251, 
5694.93186, 3495.21046, 4612.05349, 6634.46829, 8131.48711, 7845.01421, 
8965.19959, 6410.90205, 6709.76365, 4767.42146, 4120.67863, 5074.74263, 
6439.65637), F = c(4442.98917, 7085.08912, 5487.90551, 6133.75573, 
6472.06571, 6508.06965, 7717.84637, 4637.3112, 3108.1677, 4563.10122, 
3511.55357, 8726.49873, 3268.38036, 4443.36285, 5112.33241, 7416.96522, 
5680.10085, 7828.08891, 4290.78891, 6475.77625, 5839.7562, 6903.36315, 
6902.94507, 10008.31182, 7943.39557, 8052.54019, 10432.36137, 
14101.88017, 12930.34109, 14634.47137, 11846.37788, 13138.71626, 
8761.63684, 8652.59206, 7977.12193, 11093.1931, 7979.68289, 11708.95936, 
10000.88222, 12333.30174, 15659.44125, 10045.07153, 10474.37671, 
6160.43259, 4129.3468, 5959.65702, 7709.1714, 6144.90808)), class = c("tbl_ts", 
"tbl_df", "tbl", "data.frame"), row.names = c(NA, -48L), key = structure(list(
    .rows = structure(list(1:48), ptype = integer(0), class = c("vctrs_list_of", 
    "vctrs_vctr", "list"))), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -1L)), index = structure("month", ordered = TRUE), index2 = "month", interval = structure(list(
    year = 0, quarter = 0, month = 1, week = 0, day = 0, hour = 0, 
    minute = 0, second = 0, millisecond = 0, microsecond = 0, 
    nanosecond = 0, unit = 0), .regular = TRUE, class = c("interval", 
"vctrs_rcrd", "vctrs_vctr")))

lyh970817 avatar Aug 21 '23 07:08 lyh970817

I'm also encountering the same issue, but even after using dput(), the error persists. Does anyone know how to resolve this?

qizhengyan avatar Apr 30 '24 10:04 qizhengyan

I think this is fixed in the dev version but not on CRAN. Can you try:

remotes::install_github("christophsax/seasonal")

This works for me, afterwards:

library(seasonal)
s <- window(AirPassengers, end = 1954)
length(s)
#> [1] 61
seas(s)

christophsax avatar May 10 '24 06:05 christophsax