APCtools1.0.8 package

Routines for Descriptive and Model-Based APC Analysis

calc_density

Internal helper to calculate the (group-specific) density of a variabl...

capitalize_firstLetter

Internal function to capitalize the first letter of a character

compute_marginalAPCeffects

Internal helper to compute marginal APC effects and their confidence i...

compute_xCoordinate

Internal helper to tilt the x-axis for the hexamap plot

compute_yCoordinate

Internal helper to tilt the x-axis for the hexamap plot

create_APCsummary

Create a summary table for multiple estimated GAM models

create_groupVariable

Internal helper to create a group variable as base for a density matri...

create_highlightDiagonalData

Internal helper to create a dataset for ggplot2 to highlight diagonals

create_modelSummary

Create model summary tables for multiple estimated GAM models

create_oneAPCsummaryTable

Internal helper to create a summary table for one estimated GAM model

ensure_segmentsInPlotRange

Internal helper for gg_addReferenceLines to keep diagonal lines in the...

extract_summary_linearEffects

Internal helper to extract summary of linear effects in a gam model

get_plotGAMobject

Extract returned values of plot.gam() while suppressing creation of th...

gg_addReferenceLines

Internal helper to add reference lines in an APC heatmap

gg_highlightDiagonals

Internal helper to add the diagonal highlighting to a ggplot

plot_1Dsmooth

Plot 1D smooth effects for gam models

plot_APCheatmap

Heatmap of an APC surface

plot_APChexamap

Hexamap of an APC surface

plot_density_categorical

Internal helper to plot a categorical density

plot_density_metric

Internal helper to plot a metric density

plot_density

Plot the density of one metric or categorical variable

plot_densityMatrix

Create a matrix of density plots

plot_jointMarginalAPCeffects

Joint plot to compare the marginal APC effects of multiple models

plot_linearEffects

Plot linear effects of a gam in an effect plot

plot_marginalAPCeffects

Plot of marginal APC effects based on an estimated GAM model

plot_partialAPCeffects

Partial APC plots based on an estimated GAM model

plot_variable

Distribution plot of one variable against one APC dimension

Age-Period-Cohort (APC) analyses are used to differentiate relevant drivers for long-term developments. The 'APCtools' package offers visualization techniques and general routines to simplify the workflow of an APC analysis. Sophisticated functions are available both for descriptive and regression model-based analyses. For the former, we use density (or ridgeline) matrices and (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. See Weigert et al. (2021) <doi:10.1177/1354816620987198> for methodological details.

  • Maintainer: Alexander Bauer
  • License: MIT + file LICENSE
  • Last published: 2025-06-18