I have a time series in R that initially spans from January 2021 to July 2023 with a frequency of 12 (indicating monthly data). I'm interested in subsetting this time series and changing its frequency. My subset starts from April 2021 and ends in December 2022, and I set its frequency to 6. This results in a series with 11 observations. However, when I run stats::cycle() on this new subset, I get unexpected seasonal indices.
Here's a minimal example to demonstrate:
original_ts <- ts(1:31, start = c(2021, 1), end = c(2023, 7), frequency = 12)
TSstudio::ts_info(original_ts)
>The original_ts series is a ts object with 1 variable and 31 observations
Frequency: 12
Start time: 2021 1
End time: 2023 7
subset_ts <- window(original_ts, start = c(2021, 4), end = c(2022, 12), frequency = 6)
TSstudio::ts_info(subset_ts)
>The subset_ts series is a ts object with 1 variable and 11 observations
Frequency: 6
Start time: 2021.25
End time: 2022.91666666667
cycle(subset_ts)
>Time Series:
Start = 2021.25
End = 2022.91666666667
Frequency = 6
[1] 3 4 5 6 1 2 3 4 5 6 1
Could anyone please help me understand why cycle() returns an index of 3 for the first observation, and how I should interpret these seasonal indices?