R: Time Series and Panel Series

time-series-panel-series {collapse} | R Documentation

## Time Series and Panel Series

### Description

collapse provides a flexible and powerful set of functions and classes to work with time-dependent data:

- `findex_by/iby` creates an 'indexed_frame': a flexible structure that can be imposed upon any data-frame like object and facilitates indexed (time-aware) computations on time series and panel data. Indexed frames are composed of 'indexed_series', which can also be created from vector and matrix-based objects using the `reindex` function. Further functions `findex/ix`, `unindex`, `is_irregular` and `to_plm` help operate these classes, check for irregularity, and ensure plm compatibility. Methods are defined for various time series, data transformation and data manipulation functions in collapse.

- `timeid` efficiently converts numeric time sequences, such as 'Date' or 'POSIXct' vectors, to a time-factor / integer id, where a unit-step represents the greatest common divisor of the underlying sequence.

- `flag`, and the lag- and lead- operators `L` and `F` are S3 generics to efficiently compute sequences of lags and leads on regular or irregular / unbalanced time series and panel data.

- Similarly, `fdiff`, `fgrowth`, and the operators `D`, `Dlog` and `G` are S3 generics to efficiently compute sequences of suitably lagged / leaded and iterated differences, log-differences and growth rates. `fdiff/D/Dlog` can also compute quasi-differences of the form x_t - ρ x_{t-1}.

- `fcumsum` is an S3 generic to efficiently compute cumulative sums on time series and panel data. In contrast to `cumsum`, it can handle missing values and supports both grouped and indexed / ordered computations.

- `psmat` is an S3 generic to efficiently convert panel-vectors / 'indexed_series' and data frames / 'indexed_frame's to panel series matrices and 3D arrays, respectively (where time, individuals and variables receive different dimensions, allowing for fast indexation, visualization, and computations).

- `psacf`, `pspacf` and `psccf` are S3 generics to compute estimates of the auto-, partial auto- and cross- correlation or covariance functions for panel-vectors / 'indexed_series', and multivariate versions for data frames / 'indexed_frame's.

### Table of Functions

S3 Generic |  | Methods |  | Description
`findex_by/iby`, `findex/ix`, `reindex`, `unindex`, `is_irregular`, `to_plm` |  | For vectors, matrices and data frames / lists. |  | Fast and flexible time series and panel data classes 'indexed_series' and 'indexed_frame'.
`timeid` |  | For time sequences represented by integer or double vectors / objects. |  | Generate integer time-id/factor
`flag/L/F` |  | `default, matrix, data.frame, pseries, pdata.frame, grouped_df` |  | Compute (sequences of) lags and leads
`fdiff/D/Dlog` |  | `default, matrix, data.frame, pseries, pdata.frame, grouped_df` |  | Compute (sequences of lagged / leaded and iterated) (quasi-)differences or log-differences
`fgrowth/G` |  | `default, matrix, data.frame, pseries, pdata.frame, grouped_df` |  | Compute (sequences of lagged / leaded and iterated) growth rates (exact, via log-differencing, or compounded)
`fcumsum` |  | `default, matrix, data.frame, pseries, pdata.frame, grouped_df` |  | Compute cumulative sums
`psmat` |  | `default, pseries, data.frame, pdata.frame` |  | Convert panel data to matrix / array
`psacf` |  | `default, pseries, data.frame, pdata.frame` |  | Compute ACF on panel data
`pspacf` |  | `default, pseries, data.frame, pdata.frame` |  | Compute PACF on panel data
`psccf` |  | `default, pseries, data.frame, pdata.frame` |  | Compute CCF on panel data

### See Also

Collapse Overview, Data Transformations

[Package collapse version 1.8.6 Index]