Package: EMC2 3.1.0

Niek Stevenson

EMC2: Bayesian Hierarchical Analysis of Cognitive Models of Choice

Fit Bayesian (hierarchical) cognitive models using a linear modeling language interface using particle Metropolis Markov chain Monte Carlo sampling with Gibbs steps. The diffusion decision model (DDM), linear ballistic accumulator model (LBA), racing diffusion model (RDM), and the lognormal race model (LNR) are supported. Additionally, users can specify their own likelihood function and/or choose for non-hierarchical estimation, as well as for a diagonal, blocked or full multivariate normal group-level distribution to test individual differences. Prior specification is facilitated through methods that visualize the (implied) prior. A wide range of plotting functions assist in assessing model convergence and posterior inference. Models can be easily evaluated using functions that plot posterior predictions or using relative model comparison metrics such as information criteria or Bayes factors. References: Stevenson et al. (2024) <doi:10.31234/osf.io/2e4dq>.

Authors:Niek Stevenson [aut, cre], Michelle Donzallaz [aut], Andrew Heathcote [aut], Steven Miletić [ctb], Raphael Hartmann [ctb], Karl C. Klauer [ctb], Steven G. Johnson [ctb], Jean M. Linhart [ctb], Brian Gough [ctb], Gerard Jungman [ctb], Rudolf Schuerer [ctb], Przemyslaw Sliwa [ctb], Jason H. Stover [ctb]

EMC2_3.1.0.tar.gz
EMC2_3.1.0.zip(r-4.5)EMC2_3.1.0.zip(r-4.4)EMC2_3.1.0.zip(r-4.3)
EMC2_3.1.0.tgz(r-4.5-x86_64)EMC2_3.1.0.tgz(r-4.5-arm64)EMC2_3.1.0.tgz(r-4.4-x86_64)EMC2_3.1.0.tgz(r-4.4-arm64)EMC2_3.1.0.tgz(r-4.3-x86_64)EMC2_3.1.0.tgz(r-4.3-arm64)
EMC2_3.1.0.tar.gz(r-4.5-noble)EMC2_3.1.0.tar.gz(r-4.4-noble)
EMC2_3.1.0.tgz(r-4.4-emscripten)EMC2_3.1.0.tgz(r-4.3-emscripten)
EMC2.pdf |EMC2.html
EMC2/json (API)
NEWS

# Install 'EMC2' in R:
install.packages('EMC2', repos = c('https://ampl-psych.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/ampl-psych/emc2/issues

Pkgdown site:https://ampl-psych.github.io

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:

On CRAN:

Conda:

cpp

8.25 score 13 stars 392 scripts 254 downloads 51 exports 35 dependencies

Last updated 1 days agofrom:f1994fb234. Checks:12 OK. Indexed: yes.

TargetResultLatest binary
Doc / VignettesOKMar 10 2025
R-4.5-win-x86_64OKMar 10 2025
R-4.5-mac-x86_64OKMar 10 2025
R-4.5-mac-aarch64OKMar 10 2025
R-4.5-linux-x86_64OKMar 10 2025
R-4.4-win-x86_64OKMar 10 2025
R-4.4-mac-x86_64OKMar 10 2025
R-4.4-mac-aarch64OKMar 10 2025
R-4.4-linux-x86_64OKMar 10 2025
R-4.3-win-x86_64OKMar 10 2025
R-4.3-mac-x86_64OKMar 10 2025
R-4.3-mac-aarch64OKMar 10 2025

Exports:auto_thinchain_ncheckcomparecompare_subjectcontr.anovacontr.bayescontr.decreasingcontr.increasingcrediblecredintDDMdesigness_summaryfitgd_summaryget_BayesFactorget_dataget_designget_parsget_priorhypothesisinit_chainsLBALNRmake_datamake_emcmake_random_effectsmapped_parsmerge_chainsmodel_averagingpairs_posteriorparametersplot_cdfplot_densityplot_designplot_parsplot_relationsplot_sbc_ecdfplot_sbc_histplot_statpriorprior_helpprofile_plotRDMrecoveryrun_bridge_samplingrun_emcrun_sbcsampled_parsupdate2version

Dependencies:abindBrobdingnagclicodacolorspacecorpcorcorrplotexpmfansigenericsglueGPArotationlatticelifecyclelpSolvemagicmagrittrMASSMatrixmatrixcalcmnormtmsmmvtnormnlmepillarpkgconfigpsychRcppRcppArmadillorlangsurvivaltibbleutf8vctrsWienR

Simulation-based Calibration

Rendered fromSimulation-based-Calibration.Rmdusingknitr::rmarkdownon Mar 10 2025.

Last update: 2025-03-06
Started: 2024-10-14

Readme and manuals

Help Manual

Help pageTopics
Automatically Thin an emc Objectauto_thin auto_thin.emc
MCMC Chain Iterationschain_n
Convergence Checks for an emc Objectcheck check.emc
Information Criteria and Marginal Likelihoodscompare
Information Criteria For Each Participantcompare_subject
Anova Style Contrast Matrixcontr.anova
Contrast Enforcing Equal Prior Variance on each Levelcontr.bayes
Contrast Enforcing Decreasing Estimatescontr.decreasing
Contrast Enforcing Increasing Estimatescontr.increasing
Posterior Credible Interval Testscredible credible.emc
Posterior Quantilescredint credint.emc credint.emc.prior
The Diffusion Decision ModelDDM
Specify a Design and Modeldesign
Effective Sample Sizeess_summary ess_summary.emc
Model Estimation in EMC2fit fit.emc
Forstmann et al.'s Dataforstmann
Gelman-Rubin Statisticgd_summary gd_summary.emc
Bayes Factorsget_BayesFactor
Get Dataget_data get_data.emc
Get Designget_design get_design.emc get_design.emc.prior
Filter/Manipulate Parameters from emc Objectget_pars
Get Priorget_prior get_prior.emc
Within-Model Hypothesis Testinghypothesis hypothesis.emc
Initialize Chainsinit_chains
The Linear Ballistic Accumulator modelLBA
The Log-Normal Race ModelLNR
Simulate Datamake_data
Make an emc Objectmake_emc
Generate Subject-Level Parametersmake_random_effects
Parameter Mapping Back to the Design Factorsmapped_pars mapped_pars.emc mapped_pars.emc.design mapped_pars.emc.prior
Merge Samplesmerge_chains
Model Averagingmodel_averaging
Plot Within-Chain Correlationspairs_posterior
Return Data Frame of Parametersparameters parameters.emc parameters.emc.prior
Plot Defective Cumulative Distribution Functionsplot_cdf
Plot Defective Densitiesplot_density
Plot Designplot_design plot_design.emc plot_design.emc.design plot_design.emc.prior
Plots Density for Parametersplot_pars
Plot Group-Level Relationsplot_relations
Plot the ECDF Difference in SBC Ranksplot_sbc_ecdf
Plot the Histogram of the Observed Rank Statistics of SBCplot_sbc_hist
Plot Statistics on Dataplot_stat
Plot Function for emc Objectsplot.emc
Plot method for emc.design objectsplot.emc.design
Plot a priorplot.emc.prior
Generate Posterior/Prior Predictivespredict.emc predict.emc.prior
Specify Priors for the Chosen Modelprior
Prior Specification Informationprior_help
Likelihood Profile Plotsprofile_plot
The Racing Diffusion ModelRDM
Recovery Plotsrecovery recovery.emc
Estimating Marginal Likelihoods Using WARP-III Bridge Samplingrun_bridge_sampling
Custom Function for More Controlled Model Estimationrun_emc
Simulation-Based Calibrationrun_sbc
Get Model Parameters from a Designsampled_pars sampled_pars.emc sampled_pars.emc.design sampled_pars.emc.prior
LNR Model of Forstmann Data (First 3 Subjects)samples_LNR
Shorten an emc Objectsubset.emc
Summary Statistics for emc Objectssummary.emc
Summary method for emc.design objectssummary.emc.design
Summary method for emc.prior objectssummary.emc.prior
Update EMC Objects to the Current Versionupdate2version