MyNixOS website logo
Description

Tidy Intensive Longitudinal Data Analysis.

A reproducible, tidyverse-style framework for intensive longitudinal data analysis in R, with built-in methodological safeguards, provenance tracking, and reporting tools. Encodes time structure, enforces within-between decomposition, provides spacing-aware lags, and integrates diagnostics and visualization. Use ild_prepare(), ild_center(), ild_lag(), and related functions for a unified pipeline from raw EMA/diary data to interpretable models.

tidyILD

A reproducible, tidyverse-style framework for intensive longitudinal data (ILD) analysis in R, with built-in methodological safeguards, provenance tracking, and reporting tools.
Author: Alex Litovchenko.

Install

remotes::install_github("alitovchenko/tidyILD")

Quick start

library(tidyILD)

# Prepare: validate time structure, add .ild_* columns and metadata
d <- data.frame(
  id = rep(1:3, each = 5),
  time = rep(as.POSIXct(0:4 * 3600, origin = "1970-01-01"), 3),
  mood = rnorm(15)
)
x <- ild_prepare(d, id = "id", time = "time", gap_threshold = 7200)

# Inspect (summary tibble + list)
ild_summary(x)

# Within-between decomposition
x <- ild_center(x, mood)

# Spacing-aware lags (max_gap from metadata if omitted)
x <- ild_lag(x, mood, mode = "gap_aware", max_gap = 7200)

# Missingness (summary tibble + plot + by_id)
ild_missing_pattern(x, vars = "mood")

# Fit and report: tidy fixed effects, fitted vs observed, residual ACF + QQ
fit <- ild_lme(mood ~ 1 + (1 | id), data = x, ar1 = FALSE, warn_no_ar1 = FALSE)
tidy_ild_model(fit)
ild_plot(fit, type = "fitted")
diag <- ild_diagnostics(fit); diag; plot_ild_diagnostics(diag)

Pipeline

  • ild_prepare() — encode longitudinal structure, spacing, gaps
  • ild_summary() — one-shot summary
  • ild_center() — person-mean centering (WP/BP)
  • ild_lag() — index, gap-aware, or time-window lags (supports lubridate::hours(2) etc.)
  • ild_decomposition() — WP/BP variance and ratio; optional WP vs BP density plot
  • ild_check_lags() — lag validity (valid/invalid, pct_invalid, lag order)
  • ild_crosslag() — one-call cross-lag: lag predictor, check lags, fit outcome ~ lag
  • ild_acf() — ACF on a variable or on residuals (pre-model check for AR1)
  • ild_spacing_class() — regular-ish vs irregular-ish
  • ild_spacing() — spacing diagnostics (median/IQR, large gaps %, CV) and AR1/CAR1 recommendation
  • ild_design_check() — aggregate spacing, WP/BP, missingness, and recommendations
  • ild_center_plot() — standalone WP vs BP density plot
  • ild_missing_pattern() — missingness by person/variable
  • ild_missing_bias() — test if missingness is associated with a predictor (informative missingness)
  • ild_align() — align secondary stream (e.g. wearables) to primary ILD within a time window
  • ild_lme() — mixed-effects model (lmer or nlme with AR1/CAR1)
  • ild_robust_se() — cluster-robust variance (clubSandwich); tidy_ild_model(fit, se = "robust") for robust SE/CI/p
  • ild_missing_model() — model missingness from covariates; ild_ipw_weights() and ild_ipw_refit() for IPW sensitivity
  • ild_tvem() — time-varying effects (GAM); ild_tvem_plot() for the coefficient curve
  • ild_person_model() — fit model per person (N-of-1); ild_person_distribution() — plot distribution of estimates
  • ild_diagnostics() — residual ACF, residuals vs fitted/time (use print() for summary)
  • plot_ild_diagnostics() — build diagnostic plots from an ild_diagnostics object
  • ild_plot() — trajectory, heatmap, gaps, fitted vs observed, residual ACF
  • ild_heatmap(), ild_spaghetti() — aliases for heatmap and trajectory plots
  • ild_circadian() — variable by hour of day (when time is POSIXct)
  • augment_ild_model() — tibble with .ild_id, .ild_time, outcome, .fitted, .resid
  • tidy_ild_model() — fixed-effect table (estimate, SE, CI, p); use se = "robust" for cluster-robust inference
  • ild_simulate() — simulated ILD (n_id, n_time/n_obs_per, ar1, wp_effect, bp_effect, irregular)
  • ild_power() — simulation-based power for a fixed effect (ild_simulate → ild_lme → effect recovery)
  • ema_example — built-in dataset (data(ema_example))
  • broom: Load broom.mixed for tidy(fit) and augment(fit) on ild_lme fits.

Vignettes

  • From raw data to model: full pipeline with ild_prepare() through ild_lme() and ild_plot().
  • Short analysis report: fit, tidy fixed effects, fitted vs observed, residual ACF and Q-Q.
  • Within-between decomposition and irregular spacing: centering and gap-aware lags.
  • Glossary and quick-start: function glossary and checklist.

pkgdown site

Documentation and vignettes are built with pkgdown. From the package root: pkgdown::build_site(). Config: _pkgdown.yml.

License

MIT.

Metadata

Version

0.3.0

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows