Package: APCtools 1.0.6

Alexander Bauer

APCtools: Routines for Descriptive and Model-Based APC Analysis

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.

Authors:Alexander Bauer [aut, cre], Maximilian Weigert [aut], Hawre Jalal [aut]

APCtools_1.0.6.tar.gz
APCtools_1.0.6.zip(r-4.5)APCtools_1.0.6.zip(r-4.4)APCtools_1.0.6.zip(r-4.3)
APCtools_1.0.6.tgz(r-4.4-any)APCtools_1.0.6.tgz(r-4.3-any)
APCtools_1.0.6.tar.gz(r-4.5-noble)APCtools_1.0.6.tar.gz(r-4.4-noble)
APCtools_1.0.6.tgz(r-4.4-emscripten)APCtools_1.0.6.tgz(r-4.3-emscripten)
APCtools.pdf |APCtools.html
APCtools/json (API)
NEWS

# Install 'APCtools' in R:
install.packages('APCtools', repos = c('https://bauer-alex.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/bauer-alex/apctools/issues

Datasets:
  • drug_deaths - Drug deaths of white men in the United States
  • travel - Data from the German Reiseanalyse survey

On CRAN:

5.88 score 13 stars 59 scripts 338 downloads 12 exports 74 dependencies

Last updated 6 months agofrom:c97d6fcd80. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKOct 27 2024
R-4.5-winOKOct 27 2024
R-4.5-linuxOKOct 27 2024
R-4.4-winOKOct 27 2024
R-4.4-macOKOct 27 2024
R-4.3-winOKOct 27 2024
R-4.3-macOKOct 27 2024

Exports:create_APCsummarycreate_modelSummaryplot_1Dsmoothplot_APCheatmapplot_APChexamapplot_densityplot_densityMatrixplot_jointMarginalAPCeffectsplot_linearEffectsplot_marginalAPCeffectsplot_partialAPCeffectsplot_variable

Dependencies:abindbackportsbootbroomcarcarDatacheckmateclicolorspacecorrplotcowplotcpp11DerivdoBydplyrevaluatefansifarverFormulagenericsggplot2ggpubrggrepelggsciggsignifgluegridExtragtablehighrisobandknitrlabelinglatticelifecyclelme4magrittrMASSMatrixMatrixModelsmgcvmicrobenchmarkminqamodelrmunsellnlmenloptrnnetnumDerivpbkrtestpillarpkgconfigpolynompurrrquantregR6RColorBrewerRcppRcppEigenrlangrstatixscalesSparseMstringistringrsurvivaltibbletidyrtidyselectutf8vctrsviridisLitewithrxfunyaml

APC Analysis with APCtools

Rendered frommain_functionality.Rmdusingknitr::rmarkdownon Oct 27 2024.

Last update: 2022-04-12
Started: 2021-11-22

Readme and manuals

Help Manual

Help pageTopics
Internal helper to calculate the (group-specific) density of a variablecalc_density
Internal function to capitalize the first letter of a charactercapitalize_firstLetter
Internal helper to compute marginal APC effects and their confidence intervalscompute_marginalAPCeffects
Internal helper to tilt the x-axis for the hexamap plotcompute_xCoordinate
Internal helper to tilt the x-axis for the hexamap plotcompute_yCoordinate
Create a summary table for multiple estimated GAM modelscreate_APCsummary
Internal helper to create a group variable as base for a density matrixcreate_groupVariable
Internal helper to create a dataset for ggplot2 to highlight diagonalscreate_highlightDiagonalData
Create model summary tables for multiple estimated GAM modelscreate_modelSummary
Internal helper to create a summary table for one estimated GAM modelcreate_oneAPCsummaryTable
Drug deaths of white men in the United Statesdrug_deaths
Internal helper for gg_addReferenceLines to keep diagonal lines in the plot rangeensure_segmentsInPlotRange
Internal helper to extract summary of linear effects in a gam modelextract_summary_linearEffects
Extract returned values of plot.gam() while suppressing creation of the plotget_plotGAMobject
Internal helper to add reference lines in an APC heatmapgg_addReferenceLines
Internal helper to add the diagonal highlighting to a ggplotgg_highlightDiagonals
Plot 1D smooth effects for 'gam' modelsplot_1Dsmooth
Heatmap of an APC surfaceplot_APCheatmap
Hexamap of an APC surfaceplot_APChexamap
Plot the density of one metric or categorical variableplot_density
Internal helper to plot a categorical densityplot_density_categorical
Internal helper to plot a metric densityplot_density_metric
Create a matrix of density plotsplot_densityMatrix
Joint plot to compare the marginal APC effects of multiple modelsplot_jointMarginalAPCeffects
Plot linear effects of a gam in an effect plotplot_linearEffects
Plot of marginal APC effects based on an estimated GAM modelplot_marginalAPCeffects
Partial APC plots based on an estimated GAM modelplot_partialAPCeffects
Distribution plot of one variable against one APC dimensionplot_variable
Data from the German Reiseanalyse surveytravel