Package: EMC2 2.0.2

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], Jochen Voss [ctb], Andreas Voss [ctb]

EMC2_2.0.2.tar.gz
EMC2_2.0.2.tar.gz(r-4.5-noble)EMC2_2.0.2.tar.gz(r-4.4-noble)
EMC2_2.0.2.tgz(r-4.4-emscripten)EMC2_2.0.2.tgz(r-4.3-emscripten)
EMC2.pdf |EMC2.html
EMC2/json (API)

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

Peer review:

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:
  • forstmann - Forstmann et al.'s data
  • samples_LNR - An emc object of an LNR model of the Forstmann dataset using the first three subjects

This package does not link to any Github/Gitlab/R-forge repository. No issue tracker or development information is available.

47 exports 0.09 score 36 dependencies 310 scripts

Last updated 7 days agofrom:ca5ca16786. Checks:OK: 2. Indexed: yes.

TargetResultDate
Doc / VignettesOKSep 11 2024
R-4.5-linux-x86_64OKSep 11 2024

Exports:chain_ncheckcomparecompare_subjectcontr.anovacontr.bayescontr.decreasingcontr.increasingcredibleDDMdesigness_summaryfitgd_summaryget_BayesFactorget_dataget_parsget_prior_blockedget_prior_diagget_prior_factorget_prior_SEMget_prior_singleget_prior_standardhypothesisinit_chainsLBALNRmake_datamake_emcmake_random_effectsmapped_parmerge_chainspairs_posteriorparametersplot_defective_densityplot_fitplot_parsplot_priorplot_relationsposterior_summarypriorprofile_plotRDMrecoveryrun_bridge_samplingrun_emcsampled_p_vector

Dependencies:abindBrobdingnagclicodacolorspacecorpcorcorrplotevdexpmfansigenericsglueGPArotationgsllatticelifecyclelpSolvemagicmagrittrMASSMatrixmatrixcalcmnormtmsmmvtnormnlmepillarpkgconfigpsychRcpprlangrtdistssurvivaltibbleutf8vctrs

Readme and manuals

Help Manual

Help pageTopics
Augments parameter matrix or vector p with constant parameters (also used in data)add_constants
Runs burn-in for emc.auto_burn
chain_n()chain_n
Convergence checks for an emc objectcheck check.emc
Information criteria and marginal likelihoodscompare
Calculate a table of model probabilities based for a list of samples objects based on samples of marginal log-likelihood (MLL) added to these objects by run_IS2. Probabilities estimated by a bootstrap ath picks a vector of MLLs, one for each model in the list randomly with replacement nboot times, calculates model probabilities and averagescompare_MLL
Information criteria for each participantcompare_subject
Anova style contrast matrixcontr.anova
Contrast to enforce equal prior variance on each levelcontr.bayes
Contrast to enforce decreasing estimatescontr.decreasing
Contrast to enforce increasing estimatescontr.increasing
Posterior credible interval testscredible credible.emc
The Diffusion Decision ModelDDM
Diffusion decision model with t0 on the natural scaleDDMt0natural
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
Filter/manipulate parameters from emc objectget_pars
Prior specification or prior sampling for blocked estimationget_prior_blocked
Prior specification or prior sampling for diagonal estimationget_prior_diag
Prior specification and prior sampling for factor estimationget_prior_factor
Prior specification or prior sampling for SEM estimation.get_prior_SEM
Prior specification or prior sampling for single subject estimationget_prior_single
Prior specification or prior sampling for standard estimation.get_prior_standard
Within-model hypothesis testinghypothesis hypothesis.emc
Calculate information criteria (DIC, BPIC), effective number of parameters and constituent posterior deviance (D) summaries (meanD = mean of D, Dmean = D for mean of posterior parameters and minD = minimum of D).IC
Initialize chainsinit_chains
The Linear Ballistic Accumulator modelLBA
The Log-Normal Race ModelLNR
Simulate datamake_data
Make an emc objectmake_emc
Factor diagram plotmake_factor_diagram
make_missingmake_missing
Make random effectsmake_random_effects
Parameter mapping back to the design factorsmapped_par
Merge samplesmerge_chains
Plot within-chain correlationspairs_posterior
Returns a parameter type from an emc object as a data frame.parameters parameters.emc
Plot defective densities for each subject and cellplot_defective_density
Posterior predictive checksplot_fit
Plots choice dataplot_fit_choice
Plot MCMCplot_mcmc
Plot MCMC.listplot_mcmc_list
Plots density for parametersplot_pars
Titleplot_prior
Plot relationsplot_relations
Plot function for emc objectsplot.emc
Posterior quantilesposterior_summary posterior_summary.emc
Generate posterior predictivespredict.emc
Prior specificationprior
Gaussian Signal Detection Theory Modelprobit
Likelihood profile plotsprofile_plot
The Racing Diffusion ModelRDM
Recovery plotsrecovery recovery.emc
Runs adapt stage for emc.run_adapt
Estimating Marginal likelihoods using WARP-III bridge samplingrun_bridge_sampling
Custom function for more controlled model estimationrun_emc
Runs IS2 from Tran et al. 2021 on a list of emcrun_IS2
Runs sample stage for emc.run_sample
Get model parameters from a designsampled_p_vector
An emc object of an LNR model of the Forstmann dataset using the first three subjectssamples_LNR
Standardized factor loadingsstandardize_loadings
Shorten an emc objectsubset.emc
Summary statistics for emc objectssummary.emc