Skip to contents

About bmmtools

bmmtools bmmtools-package
bmmtools: validate cognitive measurement models fitted with bmm

Simulate

Data sets and the truth that produced them.

simulate_recovery()
Simulate data from a bmm model with known parameters
cors_from_factors()
Build a correlation matrix from factor loadings
recovery_formula()
The default recovery formula: every free parameter gets a random intercept
recovery_component()
Describe one model of a multi-model simulation
simulate_components()
Simulate several models for the same simulated people

Fit and run a study

Cached fitting, the convergence gate and the design grid.

fit_cached()
Fit a bmm model once and reuse it while nothing has changed
fit_components()
Fit every component of a simulation set, each on its own
fit_ml()
Subject-wise maximum likelihood estimates of a bmm model
check_convergence()
Check whether a fit passes the convergence gate
recovery_grid()
Run a parameter-recovery grid
grid_tasks()
Split a grid's cells into tasks for separate processes
collect_grid()
Read a finished recovery grid from its cell files
run_info()
The machine and package versions this session runs on

Score recovery

Estimates against generating values, per fit and per parameter.

recover() recover_subjects()
Score parameter recovery against known generating values
summary(<bmmtools_recovery>) summary(<bmmtools_recovery_summary>)
Summarise a recovery object into per-parameter metrics
smallest_design()
Find the smallest design that meets a target
format(<bmmtools_smallest_design>) print(<bmmtools_smallest_design>)
Print the read-off as sentences
recovery_ccc()
Concordance between recovered and generating values
prior_sd_table()
Prior standard deviations from a fit's priors
extract_estimates()
Extract a tidy table of parameter estimates from a fit
recover_correlations()
Score recovered correlations against the generating ones
summary(<bmmtools_cor_recovery>) summary(<bmmtools_cor_recovery_summary>)
Summarise a correlation recovery into per-pair metrics
extract_correlations()
Extract between-subject correlations from a fit
extract_subject_draws()
Extract subject-level posterior draws as an array
subject_table()
True and estimated subject values, one row per subject
inverse_link()
Transform values from the link scale to the natural scale

Prior predictive checks

What the priors imply on the observable scale.

prior_check()
Check what the priors say the data should look like
summary(<bmmtools_prior_check>) summary(<bmmtools_prior_check_summary>)
Compare prior sets on the observable scale

Correctness

Estimates against what is already known.

cross_check()
Compare a fit's estimates with a reference
summary(<bmmtools_cross_check>) summary(<bmmtools_cross_check_summary>)
Summarise a cross-check into per-parameter metrics
sbc()
Check that a model's implementation is calibrated

Validate a model

One plan per model, run stage by stage into a directory, judged against criteria printed beside every verdict.

validation_plan() experimental
Plan the validation of a bmm model
validation_defaults() experimental
Validation defaults for a model
write_plan() read_plan()
Write a validation plan to a file and read it back
run_validation() experimental
Run a validation plan
card_numbers() experimental
The numbers of a validation, one per row
verdict_table() experimental
The verdict of every stage against the plan's criteria
compare_validations() experimental
Compare the numbers of two validations
render_card() experimental
Render the validation card of a result

Benchmark

What an implementation costs, in units that name their phase.

benchmark()
Compare implementations on the same data, in interleaved runs
benchmark_metrics()
Measure one fit: compile, per-chain time, ESS per second, gradient cost
benchmark_compile()
Time the compile step on its own
summary(<bmmtools_benchmark>)
Spread beside the centre, and the ratio with an interval

Plot

plot_recovery()
Plot recovered estimates against their generating values
plot_design()
Plot recovery across the designs of a grid
plot_prior_check()
Plot what the priors say the data should look like

Example objects

Precomputed results, so examples run without Stan.

recovery_mixture2p
Example recovery object: a mixture2p grid
prior_check_sdt_yn
Example prior check: two priors for sdt_yn

Object methods

Printing, subsetting and dplyr support for the result classes.

format(<bmmtools_cor_recovery>) print(<bmmtools_cor_recovery>) print(<bmmtools_cor_recovery_summary>)
Format and print a correlation recovery
format(<bmmtools_cross_check>) print(<bmmtools_cross_check>) format(<bmmtools_cross_check_summary>) print(<bmmtools_cross_check_summary>)
Format and print a cross-check
format(<bmmtools_ml>) print(<bmmtools_ml>)
Format and print subject-wise ML estimates
format(<bmmtools_prior_check>) print(<bmmtools_prior_check>) print(<bmmtools_prior_check_summary>)
Format and print a prior check
format(<bmmtools_recovery>) print(<bmmtools_recovery>) print(<bmmtools_recovery_summary>)
Format and print a recovery object
format(<bmmtools_smallest_design>) print(<bmmtools_smallest_design>)
Print the read-off as sentences
format(<bmmtools_validation>) print(<bmmtools_validation>)
Format and print a validation result
format(<bmmtools_validation_plan>) print(<bmmtools_validation_plan>)
Format and print a validation plan
`[`(<bmmtools_recovery>)
Subset a recovery object
`[`(<bmmtools_cor_recovery>)
Subset a correlation-recovery object
`[`(<bmmtools_cross_check>)
Subset a cross-check object
`[`(<bmmtools_prior_check>)
Subset a prior-check object
`[`(<bmmtools_ml>)
Subset an ML estimates object
`[`(<bmmtools_benchmark>)
Subset a benchmark
print(<bmmtools_benchmark>) print(<bmmtools_benchmark_summary>)
Print a benchmark or its summary
dplyr_reconstruct(<bmmtools_benchmark>)
Keep the class only while the contract holds
dplyr_reconstruct(<bmmtools_recovery>)
Keep the class only while the contract holds