bayesqm-package: bayesqm: Bayesian Q Methodology: Probabilistic Factor...

bayesqm-packageR Documentation

bayesqm: Bayesian Q Methodology: Probabilistic Factor Analysis

Description

A Bayesian factor-analytic framework for Q methodology. Fits a low-rank factor model to Q-sort data with a Student-t likelihood and a hierarchical normal prior on loadings, samples the posterior with Stan, resolves rotational ambiguity via the MatchAlign post-processing of Poworoznek et al. (2025) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/25-BA1544")}, and returns posterior summaries including credible intervals for loadings and factor scores, probabilistic dominant-factor membership, distinguishing and consensus statements, and PSIS-LOO-based factor enumeration following Vehtari et al. (2017) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11222-016-9696-4")} with the Sivula et al. (2025) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/25-BA1569")} parsimony rule.

A Bayesian factor-analytic framework for Q methodology. Fits a low-rank factor model to Q-sort data with a Student-t likelihood and a hierarchical normal prior on loadings, samples the posterior with Stan, resolves rotational ambiguity via MatchAlign post-processing, and returns posterior summaries including credible intervals for loadings and factor scores, probabilistic dominant-factor membership, distinguishing and consensus statements, and PSIS-LOO-based factor enumeration.

Details

The typical workflow is:

  1. Import data. read_qsort() auto-detects CSV, Excel, PQMethod .DAT, Ken-Q JSON / multi-sheet Excel, KADE ZIP, or Easy-HTMLQ Firebase JSON. qsort_data() constructs the object directly from a matrix.

  2. Fit the model. fit_bayesian() returns a bayesqm_fit object. run_bayes() fits the model for a range of K and returns a bayesqm_run object carrying the ELPD comparison table and the peak-plus-Sivula protocol verdict.

  3. Summarise the posterior. compute_loadings(), compute_zscores(), compute_factor_array(), compute_dominant_prob(), compute_threshold_prob(), compute_divergence(), classify_membership(), and compute_posterior_scalars().

  4. Use standard R accessors. coef(), fitted(), residuals(), sigma(), family(), nobs(), as.matrix(), as.array(), as.data.frame(), update(), plus rstantools::posterior_interval() and rstantools::prior_summary() work directly on the fit.

Draws extraction works with the posterior package (as_draws_df(), as_draws_matrix(), as_draws_array()), which in turn makes the fit usable with bayesplot and tidybayes through their standard conventions.

Relationship to the qmethod package

The bayesqm_fit object parallels qmethod::qmethod output where that is meaningful, so scripts written against qmethod largely keep working:

  • Slot names match: ⁠$dataset⁠, ⁠$loa⁠, ⁠$zsc⁠, ⁠$zsc_n⁠, ⁠$f_char⁠, ⁠$qdc⁠, ⁠$flagged⁠.

  • ⁠$qdc⁠ is the Bayesian divergence table (per-viewpoint grid and z-score with 95% CrI, then D_j with 95% CrI, pi_D, pi_C), not the classical significance-label vocabulary.

  • Dotted reader aliases (import.pqmethod(), import.htmlq(), import.kenq(), import.easyhtmlq()) forward to the ⁠read_*⁠ readers.

Intentional Bayesian divergences:

  • ⁠$f_char$characteristics⁠ omits the classical test-theory columns (av_rel_coef, reliability, se_fscores, sd_dif). Factor-score uncertainty is already quantified by the posterior credible intervals in ⁠$ci_lower⁠ and ⁠$ci_upper⁠, so Spearman-Brown composite reliability is not the right construct.

  • ⁠$flagged⁠ is a logical ⁠N x K⁠ matrix defined as ⁠P(argmax_k |Lambda[i, k]| = k) > 0.5⁠ rather than Brown's (1980) significance-based rule. The posterior probability makes the Bayesian analogue direct.

  • ⁠$brief⁠ uses K, N, J (not nfactors, nqsort, nstat) and includes Bayesian-specific fields (family, prob, priors, backend).

Author(s)

Maintainer: Raymond Dacosta Azadda rdazadda@alaska.edu

Authors:

  • Raymond Dacosta Azadda rdazadda@alaska.edu

  • AK-ACE Team

  • Karsten Hueffer

  • Taa'aii Peter

  • Stacy Rasmus

References

Poworoznek, E., Anceschi, N., Ferrari, F., & Dunson, D. (2025). Efficiently Resolving Rotational Ambiguity in Bayesian Matrix Sampling with Matching. Bayesian Analysis.

Sivula, T., Magnusson, M., Matamoros, A. A., & Vehtari, A. (2025). Uncertainty in Bayesian Leave-One-Out Cross-Validation Based Model Comparison. Bayesian Analysis.

Vehtari, A., Gelman, A., & Gabry, J. (2017). Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and Computing, 27(5), 1413-1432.

See Also

Useful links:


bayesqm documentation built on June 18, 2026, 1:07 a.m.