Converts the output of `simdiff()` or `simshocks()` (typically a `ts` object or matrix) into a `zoo` time series with proper calendar-based indexing.

sim_to_zoo(sim_data, start_ = NULL, frequency = NULL, end_ = NULL)

Arguments

sim_data

A time series (`ts`), matrix, or vector representing the simulation output.

start_

Optional. The starting point of the time index, as a `Date` string (`"YYYY-MM-DD"`) or a numeric cycle (`c(year, period)`). If `sim_data` is a `ts` object and `start_` is `NULL`, the function will attempt to infer the start date automatically.

frequency

Optional. The frequency of the time series. Can be numeric (e.g., `12`, `4`, `260`) or character (`"monthly"`, `"quarterly"`, `"daily"`, etc.). Inferred from `sim_data` if missing.

end_

Optional. A date string or cycle indicating the end of the time series. If provided, it overrides the number of observations used to construct the time index.

Value

A `zoo` object with the same data as `sim_data` and a time index based on calendar dates.

Details

The function supports flexible time specification using either a `Date` string (e.g. `"2025-01-01"`) or a cycle notation (e.g. `c(2025, 4)` for 4th quarter of 2025), along with a frequency that can be numeric (e.g. `12`, `4`, `260`) or string-based (`"monthly"`, `"quarterly"`, etc.).