I am running time series data, but I encountered an unexpected date change while running the HoltWinters
function. The original data has a date range from 2013 to 2017, but the implementation of HoltWinters turns the date into 2014-2018.
This is also the code:
fs<- HoltWinters(ts(tss$Average_sales, start = as.yearmon(tss$date[1]), freq = 12))
Here is the reproducible tss data:
structure(list(year = c(2013, 2013, 2013, 2013, 2013, 2013, 2013,
2013, 2013, 2013, 2013, 2013, 2014, 2014, 2014, 2014, 2014, 2014,
2014, 2014, 2014, 2014, 2014, 2014, 2015, 2015, 2015, 2015, 2015,
2015, 2015, 2015, 2015, 2015, 2015, 2015, 2016, 2016, 2016, 2016,
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2017, 2017, 2017,
2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017), date = structure(c(15706,
15737, 15765, 15796, 15826, 15857, 15887, 15918, 15949, 15979,
16010, 16040, 16071, 16102, 16130, 16161, 16191, 16222, 16252,
16283, 16314, 16344, 16375, 16405, 16436, 16467, 16495, 16526,
16556, 16587, 16617, 16648, 16679, 16709, 16740, 16770, 16801,
16832, 16861, 16892, 16922, 16953, 16983, 17014, 17045, 17075,
17106, 17136, 17167, 17198, 17226, 17257, 17287, 17318, 17348,
17379, 17410, 17440, 17471, 17501), class = "Date"), Average_sales = c(29.3486451612903,
32.8155, 39.8310967741935, 45.4849333333333, 49.2414193548387,
53.0398, 55.2207741935484, 49.4684516129032, 45.9938, 42.3604516129032,
46.1762, 32.6843225806452, 33.9346451612903, 37.7940714285714,
45.4387741935484, 52.5942666666667, 56.9598064516129, 60.4561333333333,
63.8070967741935, 57.1352258064516, 52.3416, 48.9601935483871,
53.3855333333333, 37.2934193548387, 35.646, 39.3797857142857,
47.1581290322581, 54.9644666666667, 59.8001290322581, 62.4789333333333,
66.9258064516129, 59.3807096774194, 54.8888, 51.4356774193548,
55.1763333333333, 39.1981935483871, 38.8670322580645, 42.4108275862069,
51.0245806451613, 60.13, 63.7890322580645, 68.1776, 73.4656774193548,
63.3221935483871, 59.7887333333333, 55.7185161290323, 59.4298666666667,
42.8007096774194, 39.8261935483871, 44.3835, 53.0752903225806,
62.5908, 65.8507096774194, 70.9749333333333, 75.5737419354839,
66.2195483870968, 62.3508666666667, 57.4941935483871, 61.9224666666667,
44.8496774193548)), row.names = c(NA, -60L), groups = structure(list(
year = c(2013, 2014, 2015, 2016, 2017), .rows = structure(list(
1:12, 13:24, 25:36, 37:48, 49:60), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), row.names = c(NA, -5L), class = c("tbl_df",
"tbl", "data.frame"), .drop = TRUE), class = c("grouped_df",
"tbl_df", "tbl", "data.frame"))