MyNixOS website logo
Description

Capability-Ecological Developmental Model (CEDM) Analysis.

Implements the Capability-Ecological Developmental Model (CEDM) for longitudinal and multilevel data. The package supports estimation and interpretation of models examining how socioeconomic status (SES), health indicators, and contextual factors jointly relate to academic outcomes. Functionality includes: (1) classification of ecological capability regimes (amplifying, neutral, compensatory); (2) estimation of moderated multilevel models with higher-order interaction terms; (3) causal mediation analysis using doubly robust estimation; (4) random-effects within-between (REWB) decomposition; (5) nonlinear moderation using restricted cubic splines; (6) clustering of longitudinal health trajectories; and (7) sensitivity analysis using the impact threshold for a confounding variable (ITCV) and robustness-to-replacement (RIR) measures. The package is designed for use with general longitudinal multilevel datasets.

CEDMr

R-CMD-check License: MIT Lifecycle: experimental

Overview

CEDMr implements the Capability-Ecological Developmental Model (CEDM) (Hait, 2025), a theoretical framework for studying how socioeconomic status (SES), health indicators (e.g., BMI), and ecological contexts jointly shape academic achievement across childhood.

The package operationalizes all five CEDM theoretical propositions into directly callable R functions and is designed to work with any longitudinal multi-level dataset, including ECLS-K:2011 and similar national surveys.


The Five CEDM Propositions

#PropositionFunction
1Capability-Conversion Production Function — SES converts to achievement through health as a moderating capability constraintcedm_production()
2Ecological Regime Heterogeneity — Three regimes (amplifying, neutral, compensatory) govern the SES × health interactionclassify_regime(), cedm_production()
3Developmental Recursion — Chronic between-child health differences (not transient fluctuations) drive achievement gapscedm_rewb(), cedm_trajectory()
4Weak Mediation, Strong Moderation — Health mediates SES effects weakly but moderates them stronglycedm_mediation()
5Capability Stability — Robustness of SES–achievement effects to unmeasured confoundingcedm_sensitivity()

Installation

# Install from GitHub
# install.packages("remotes")
remotes::install_github("causalfragility-lab/CEDMr")

Quick Start

Simulate CEDM data

library(CEDMr)

# Simulate 3000 observations across three ecological regimes
sim <- cedm_simulate(n = 3000, n_waves = 5, seed = 42)
table(sim$regime)
#>
#>   amplifying compensatory      neutral
#>         1000         1000         1000

Classify ecological capability regimes

sim <- classify_regime(sim, ses_var = "SES", ses_tertiles = TRUE)
table(sim$cedm_regime)

Fit the CEDM production function

# Base model: SES × health interaction
base_model <- cedm_production(
  data        = sim,
  outcome_var = "achievement",
  ses_var     = "SES",
  health_var  = "health",
  model       = "base",
  center      = TRUE
)
print(base_model)

# Full regime model: SES × health × regime (three-way interaction)
regime_model <- cedm_production(
  data        = sim,
  outcome_var = "achievement",
  ses_var     = "SES",
  health_var  = "health",
  regime_var  = "cedm_regime",
  model       = "regime",
  center      = TRUE
)
print(regime_model)

Causal mediation analysis (Proposition 4)

med <- cedm_mediation(
  data        = sim,
  outcome_var = "achievement",
  ses_var     = "SES",
  health_var  = "health",
  n_boot      = 500,
  seed        = 42
)
print(med)

Within-between decomposition (Proposition 3)

rewb <- cedm_rewb(
  data        = sim,
  outcome_var = "achievement",
  health_var  = "health",
  id_var      = "id",
  time_var    = "wave",
  ses_var     = "SES"
)
print(rewb)

Health trajectory clustering (Proposition 3)

traj <- cedm_trajectory(
  data        = sim,
  health_var  = "health",
  id_var      = "id",
  time_var    = "wave",
  k           = 3,
  outcome_var = "achievement",
  ses_var     = "SES"
)
print(traj)
traj$plot

Sensitivity analysis (Proposition 5)

sens <- cedm_sensitivity(base_model, term = "SES")
print(sens)

Run the full pipeline in one call

pipeline <- cedm_full_pipeline(
  data        = sim,
  outcome_var = "achievement",
  ses_var     = "SES",
  health_var  = "health",
  id_var      = "id",
  time_var    = "wave",
  n_boot      = 200,
  seed        = 42
)
print(pipeline)
pipeline$plots$regimes
pipeline$plots$interaction

Function Reference

FunctionDescription
cedm_simulate()Simulate data from the CEDM data-generating process
classify_regime()Classify observations into amplifying / neutral / compensatory regimes
cedm_production()Fit the CEDM capability-conversion production function
cedm_mediation()Doubly robust causal mediation analysis
cedm_rewb()Random-effects within-between (REWB) decomposition
cedm_trajectory()Longitudinal health trajectory clustering
cedm_spline_moderation()Nonlinear moderation via restricted cubic splines
cedm_sensitivity()Sensitivity analysis using Frank's ITCV and RIR
cedm_full_pipeline()Run all CEDM analyses in a single call
plot_regimes()Plot SES × health scatter by ecological regime
plot_cedm_interaction()Plot predicted achievement by SES level and regime

Citation

If you use CEDMr in your research, please cite:

Hait, S. (2026). Socioeconomic Status, Health, and Academic Achievement:
A Capability-Ecological Developmental Model. Manuscript under review.
Hait, S. (2026). CEDMr: Capability-Ecological Developmental Model (CEDM)
Analysis Toolkit. R package version 0.1.0.
https://github.com/causalfragility-lab/CEDMr

License

MIT © 2026 Subir Hait.

Metadata

Version

0.1.0

License

Unknown

Platforms (80)

    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
  • arc-linux
  • 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
  • sh4-linux
  • 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