medfit: Infrastructure for Mediation Model Fitting and Extraction

Provides S7-based infrastructure for fitting mediation models, extracting path coefficients, and performing bootstrap inference. Designed as a foundation package for the mediation analysis ecosystem, supporting 'probmed', 'RMediation', and 'medrobust' packages. Implements unified interfaces for model fitting across different engines (generalized linear models, linear mixed models for cluster-randomized designs, and a maximum-likelihood structural equation engine; Bayesian methods are planned), standardized extraction of mediation paths from various model types, and robust bootstrap inference methods. Mediation methods are described in MacKinnon, Lockwood and Williams (2004) <doi:10.1207/s15327906mbr3901_4>, Preacher and Hayes (2008) <doi:10.3758/brm.40.3.879>, Tofighi and MacKinnon (2011) <doi:10.3758/s13428-011-0076-x>, and VanderWeele (2014) <doi:10.1097/EDE.0000000000000121>.

Version: 0.21.3
Depends: R (≥ 4.1.0)
Imports: S7 (≥ 0.1.0), stats, methods, checkmate, generics, lifecycle, MASS, nloptr (≥ 1.0.4), rlang
Suggests: knitr, lavaan (≥ 0.7-3), lme4, numDeriv, OpenMx, pbkrtest, regmedint, RMediation, sandwich, testthat (≥ 3.0.0), tibble, withr, yaml
Published: 2026-11-28
DOI: 10.32614/CRAN.package.medfit
Author: Davood Tofighi ORCID iD [aut, cre, cph]
Maintainer: Davood Tofighi <dtofighi at gmail.com>
BugReports: https://github.com/data-wise/medfit/issues
License: GPL (≥ 3)
URL: https://data-wise.github.io/medfit/, https://github.com/data-wise/medfit
NeedsCompilation: no
Language: en-US
Citation: medfit citation info
Materials: NEWS
CRAN checks: medfit results

Documentation:

Reference manual: medfit.html , medfit.pdf

Downloads:

Package source: medfit_0.21.3.tar.gz
Windows binaries: r-devel: medfit_0.3.2.zip, r-release: medfit_0.3.2.zip, r-oldrel: medfit_0.3.2.zip
macOS binaries: r-release (arm64): medfit_0.3.2.tgz, r-oldrel (arm64): medfit_0.3.2.tgz, r-release (x86_64): medfit_0.3.2.tgz, r-oldrel (x86_64): medfit_0.3.2.tgz
Old sources: medfit archive

Reverse dependencies:

Reverse suggests: RMediation

Linking:

Please use the canonical form https://CRAN.R-project.org/package=medfit to link to this page.