Skip to contents

Model fitting

The main entry points: fit a single Bayesian factor model, or fit across a range of K under the peak-plus-Sivula protocol.

fit_bayesian()
Fit a Bayesian Q-methodology factor model
run_bayes() select_k_peak() select_k_sivula()
Fit the model across a range of K
matchalign()
MatchAlign post-processing for Bayesian factor draws

Posterior summaries

Tidy summaries of loadings, factor z-scores, and scalar hyperparameters.

compute_loadings()
Posterior summary of participant factor loadings
compute_zscores()
Posterior summary of statement factor z-scores
compute_factor_array()
Factor arrays on the forced Q-sort distribution
compute_posterior_scalars()
Posterior summary of scalar hyperparameters

Probabilistic factor membership

Posterior probabilities replacing the classical z-score tests and Brown-threshold flags.

compute_threshold_prob() compute_dominant_prob() compute_dominant_sign() compute_divergence() classify_membership()
Probabilistic factor-membership and divergence summaries
critical_delta()
Reliability-adjusted critical difference (default delta)
suggest_delta()
Suggested separation delta from the forced distribution

Plots (base R)

Every view reads a quantity the fit already carries; no new dependencies required.

plot(<bayesqm_fit>)
Factor-score dotchart for a bayesqm_fit
plot_loading_posterior()
Loading forest with 50 and 95 percent credible intervals
plot_zscore_posterior()
Per-statement factor-score posterior across factors
plot_membership()
Dominant-factor posterior-probability heatmap
plot_elpd()
ELPD across K with peak and Sivula annotations
plot_ppc()
Posterior predictive check on the correlation-matrix RMSE
plot_tucker()
MatchAlign Tucker's phi distribution by factor
plot_dist_cons()
Distinguishing/consensus divergence forest
plot_hyper()
Hyperparameter posterior densities

ggplot2 figure renderers

Publication-grade ggplot2 figures for bayesqm_run and bayesqm_fit: the ELPD curve, the dominant-factor panel, and the PPC ridgeline. Also reachable through ggplot2::autoplot().

make_elpd_diff()
Delta-ELPD plot with Sivula band, peak, and adopted-K annotations
make_dominant_panel()
Probabilistic dominant-factor panel
make_ppc_ridge()
Posterior predictive RMSE ridgeline across K
autoplot.bayesqm_fit()
ggplot2 renderings of a bayesqm_fit
autoplot.bayesqm_run()
ggplot2 renderings of a bayesqm_run

Theming and export

Palette control, figure export, and ready-to-paste captions.

bayesqm_colors() bayesqm_set_colors()
Get or set the bayesqm colour scheme
save_bayesqm_plot()
Save a bayesqm plot to file
caption_bayesqm()
Dynamic figure caption for a bayesqm_fit
rename_factors()
Rename factors consistently across a bayesqm_fit

Standard accessors for a bayesqm_fit

coef(), fitted(), residuals(), and the rstantools generics.

Data: import and construction

Readers for CSV/Excel/PQMethod/Ken-Q/KADE/HTMLQ and the qsort_data object.

Simulation helpers

Data-generating functions and assessment utilities.

demo_fit()
A synthetic bayesqm_fit for examples and tutorials
demo_run()
A synthetic bayesqm_run for examples and tutorials
generate_data() generate_loadings() generate_noise() discretize_to_grid() get_distribution()
Simulate Q-sort data
assess_recovery() assess_classification()
Simulation-study assessment helpers
tucker_congruence() procrustes_rotation()
Tucker's congruence and orthogonal Procrustes rotation