README.md

antedep

antedep fits antedependence models for longitudinal data:

Installation

# install.packages("remotes")
remotes::install_github("TanchyKing/antedep")

Production-Readiness Matrix

| Model | Data type | Complete-data fit/logLik | Missing-data fit/logLik | Notes | |---|---|---|---|---| | AD | Continuous | Ready | Ready (fit_gau, logL_gau) | Missing-data fit uses EM or observed-data likelihood modes | | INAD | Counts | Ready | Ready (fit_inad, logL_inad) | Missing-data fit supports na_action = "marginalize" | | CAT | Categorical states | Ready | Ready (fit_cat, logL_cat) | Missing-data fit supports orders 0, 1, 2 |

Quick Start

Included datasets:

AD example (continuous)

library(antedep)
set.seed(1)

y <- simulate_gau(n_subjects = 80, n_time = 5, order = 1)
fit <- fit_gau(y, order = 1)
fit$log_l

Missing-data workflow

library(antedep)
set.seed(1)

y <- simulate_inad(n_subjects = 60, n_time = 5, order = 1)
y[sample(length(y), 20)] <- NA

# Fit observed-data likelihood under MAR
fit_miss <- fit_inad(y, order = 1, na_action = "marginalize")
fit_miss$log_l

CAT missing-data workflow

library(antedep)
set.seed(1)

y_cat <- simulate_cat(n_subjects = 80, n_time = 5, order = 1, n_categories = 3)
y_cat[sample(length(y_cat), 30)] <- NA

# Observed-data likelihood (orders 0/1/2)
fit_cat_marg <- fit_cat(y_cat, order = 1, na_action = "marginalize")

# EM (orders 0/1) via explicit entry point or fit_cat dispatch
fit_cat_em1 <- em_cat(y_cat, order = 1, max_iter = 80)
fit_cat_em2 <- fit_cat(y_cat, order = 1, na_action = "em", em_max_iter = 80)

If EM becomes unstable or converges slowly, try increasing epsilon, increasing max_iter, and using safeguard = TRUE.

Known Limitations

Vignette

Source vignette: vignettes/antedep-intro.Rmd. Rendered site article: docs/articles/antedep-intro.html. Integrated function reference: docs/reference/index.html.

Function Reference Site (pkgdown)

Local Check Guide



Try the antedep package in your browser

Any scripts or data that you put into this service are public.

antedep documentation built on April 25, 2026, 1:06 a.m.