
El objetivo de joinpointR es ajustar modelos de regresión joinpoint por grupos y generar resúmenes en formato tidy del Cambio Porcentual Anual (APC) y del Cambio Porcentual Anual Promedio (AAPC), facilitando el análisis de tendencias en estudios epidemiológicos.
The goal of joinpointR is to fit joinpoint regression models by groups and generate tidy summaries of the Annual Percent Change (APC) and the Average Annual Percent Change (AAPC), facilitating trend analysis in epidemiological studies.
You can install the development version from GitHub / Podés instalar la versión en desarrollo desde GitHub:
# install.packages("pak")
pak::pak("datos-ine/joinpointR")Repository: https://github.com/datos-ine/joinpointR
The package provides a simple and reproducible workflow / El paquete propone un flujo simple y reproducible:
model_jp() → fit joinpoint models by group / ajusta
modelos joinpoint por grupoget_apc() → extract APC by segment / extrae APC por
segmentoget_aapc() → compute AAPC / computa AAPCsummary_jp() → generate summary tables (tibble or
flextable) / genera tablas resumen (tibble o flextable)library(joinpointR)
library(dplyr)
df <- tibble(
year = rep(2000:2010, 2),
rate = c(runif(11, 10, 20), runif(11, 5, 15)),
group = rep(c("Male", "Female"), each = 11)
)
mods <- model_jp(
data = df,
value = "rate",
time = "year",
group = "group"
)
# APC (only works when class segmented lm)
get_apc(mods$Male, digits = 1, time = "year", dec = ".") # Will generate an error
get_apc(mods$Female, digits = 1, time = "year", dec = ".")
# AAPC with 95% CI
get_aapc(mods$Male, show_ci = TRUE)
# AAPC with significance stars
get_aapc(mods$Male, show_ci = FALSE)
# Summary Table
summary_jp(mods)# English (default)
summary_jp(mods, ft = TRUE, lan = "en", var1 = "Sex")
# Spanish
summary_jp(mods, ft = TRUE, lan = "es", var1 = "Sexo")Returns a table ready for reporting (e.g., Word) using flextable. /
Devuelve una tabla lista para exportar a Word o informes mediante
flextable.
The generated table includes / La tabla generada incluye:
# Plot results
mods |>
gg_joinpoint(obs = TRUE, jp = TRUE, facets = FALSE)
# Facets by group
mods |>
gg_jpoint(obs = TRUE, jp = TRUE, facets = TRUE)
# Hide observed
mods |>
gg_jpoint(obs = FALSE, jp = TRUE, facets = FALSE)
# Hide joinpoints
mods |>
gg_jpoint(obs = TRUE, jp = FALSE, facets = FALSE)The package uses / El paquete utiliza:
segmented for fitting jointpoint regression models /
para regresión joinpointdplyr, purrr, tidyr,
tibble for data management / para manipulación de
datosggplot2 for plotting results / para graficar
resultadosflextable for summary tables / para tablas
formateadas(ft = TRUE)MIT License
Tamara Ricardo Instituto Nacional de Epidemiología (INE), Argentina ORCID: https://orcid.org/0000-0002-0921-2611