APCtools

R build status Codecov test coverage MIT license

Routines for Descriptive and Model-Based APC Analysis

Aim of this Package

Age-Period-Cohort (APC) analysis aims to determine relevant drivers for long-term developments and is used in many fields of science. The main focus is on disentangling the interconnected effects of age, period, and cohort. Long-term developments of some characteristic can either be associated with changes in a person’s life cycle (age), macro-level developments over the years that simultaneously affect all age groups (period), or the generational membership of an individual, shaped by similar socialization processes and historical experiences (cohort). The critical challenge in APC analysis is the linear dependency of the components age, period, and cohort (cohort = period - age). Accordingly, flexible methods and visualization techniques are needed to properly disentangle observed temporal association structures.

In contrast to other software packages, APCtools builds on a flexible and robust semiparametric regression approach to circumvent this identification problem. The package includes modern visualization techniques and general routines to facilitate the interpretability of the estimated temporal structures and simplify the workflow of an APC analysis.

Main Functionality

Sophisticated functions are available both for descriptive and regression model-based analyses. For the former, we use density (or ridgeline) matrices, classical heatmaps and hexamaps (hexagonally binned heatmaps) as innovative visualization techniques building on the concept of Lexis diagrams. Model-based analyses build on the separation of the temporal dimensions based on generalized additive models, where a tensor product interaction surface (usually between age and period) is utilized to represent the third dimension (usually cohort) on its diagonal. Such tensor product surfaces can also be estimated while accounting for further covariates in the regression model.

Documentation and Useful Materials

Installation

The most current version from GitHub can be installed via

devtools::install_github("bauer-alex/APCtools")

How to Contribute

If you encounter problems with the package, find bugs or have suggestions for additional functionalities please open a GitHub issue. Alternatively, feel free to contact us directly via email.

Contributions (via pull requests or otherwise) are welcome. Before you open a pull request or share your updates with us, please make sure that all unit tests pass without errors or warning messages. You can run the unit tests by calling

devtools::test()

References

Bauer, A., Weigert, M., and Jalal, H. (2022). APCtools: Descriptive and Model-based Age-Period-Cohort Analysis. Journal of Open Source Software, 7(73), 4056, https://doi.org/10.21105/joss.04056.

Weigert, M., Bauer, A., Gernert, J., Karl, M., Nalmpatian, A., Küchenhoff, H., and Schmude, J. (2021). Semiparametric APC analysis of destination choice patterns: Using generalized additive models to quantify the impact of age, period, and cohort on travel distances. Tourism Economics. https://doi.org/10.1177/1354816620987198.

Jalal, H., Burke, D. (2020). Hexamaps for Age–Period–Cohort Data Visualization and Implementation in R. Epidemiology, 31 (6), e47-e49. doi: https://doi.org/10.1097/EDE.0000000000001236.