apabayes 0.1.0
fix: every formatter rounds by apabayes’s own rule instead of the C library’s, so the same value prints the same string on every platform. The number is rounded as it is written, with ties going away from zero (
apa_num(0.005)is0.01,apa_num(2.675)is2.68), andformatC()only lays the rounded number out. Measured: the first CI run printed.00on Windows where macOS and Linux printed.01, because Windows rounds the 15-significant-digit decimal with ties to even while the others round the stored double. Values whose double sits just below the written midpoint now round up on macOS and Linux as well (0.145prints0.15, was0.14), and an exact binary tie goes away from zero rather than to even (0.125prints0.13, was0.12). A value that rounds to zero still prints without a sign (.00, never-.00), unchanged on every platform and now asserted directly rather than through a seed helper that keeps the sign. The regime boundaries ofapa_bf()andapa_er()use the same rounding, so a value is put in the regime it is printed in.fix: the
modelbasedexample guards onmarginaleffectsandcollapseas well, the live test guards on the call itself, andmarginaleffects (>= 0.29.0)joinsSuggests.estimate_contrasts()does its work through marginaleffects, which is a Suggests of modelbased rather than a dependency, and marginaleffects does this path’s through collapse, so an installed modelbased was not enough: on a machine without either, the example run ofR CMD checkERRORed.internal: a machine that cannot build a model now reports the live-fit tests as not run rather than as failing.
test_brms_fit(),test_bmm_fit()andtest_blavaan_fit()skip with the condition message when the fit itself errors, because apabayes fits nothing and a failure insidebrm()orbcfa()says something about the environment and not about the package —skip_on_cran()andskip_if_not_installed()cannot see a missing C++ toolchain. The runjags test takes the JAGS binary from the PATH instead of a hardcoded Homebrew path, and the blavaan cmdstan-target test guards its fit the same way.internal:
apa_tidy_sem_fit(fit_ci_level =)is tested by the property it promises — that the bounds are the HDI at the level asked for, computed from the same indices — rather than by a strict inequality between two bounds that the draws can make equal, which is how it failed on Windows.feat:
apa_value()reads one value out of a tidy table. It addresses a row exactly asapa_inline()does — by term, by label, by the two sides of a structural-equation path, by a correlation’s pair in either order — and returns the number rather than the string, for a value that goes into arithmetic, into a comparison, or into wording the author formats themselves.columnnames the column and defaults to the value the table’s type is about (estimate,elpd_diffon alootable,bfon a Bayes-factor one); a column that isNAon every addressed row is an error, becauseNAreaching a manuscript is the defect the refusal exists to stop. It replaces the hand-rolled lookup helper that indexes by position and reports the wrong row the day the table changes: 29 of the 43 sites that stayed hand-rolled in a real manuscript conversion were that request.feat:
apa_tidy()on aloo::loo_compare()result takesreference =, the model the ELPD differences are taken from. loo signs every difference against the model with the highest ELPD, so a sentence reporting how far a baseline trails had to flip the sign by hand; under a new reference the model loo referenced prints a positiveΔELPD. Naming loo’s own reference changes nothing — measured, re-deriving the differences moves them by up to 1.2e-14, and loo’s numbers are the ones to report. The standard errors that survive are the ones loo measured:0on the reference row, loo’s ownse_diffon the model that was loo’s reference (the same pair, read the other way round),NAelsewhere, because acompare.looobject does not carry the pointwise ELPDs another pair would need.p_worseanddiag_diffqualify a difference against loo’s reference and becomeNAfor the same reason.feat:
apa_inline(ci_label = NULL)drops the separator with the label, so an estimate and its interval print as−5.39 [−6.95, −3.78]— the shape a sentence listing several estimates needs, and the one?apa_inlinealready described. A row whoseci_levelisNAstill prints the brackets after a comma: that is the table’s silence about its own interval, not something the caller asked for.fix:
apabayes_tidy(type = "sem_fit")requires at least one fit index. The"sem_fit"contract asked only for amodelcolumn, which a LOO comparison also has, so a model-comparison table was accepted as a table of fit indices with every indexNA, andapa_inline()then reportedNAinto a manuscript instead of refusing. The check is the constructor’s, where the caller chooses the label; a subset of a valid table stays valid.docs: the package’s own claims are checked against the package. The
Descriptionfield and the README no longer nameperformanceas a source of numbers — it is called nowhere inR/and is in neitherImportsnorSuggests— and no longer say every number comes from easystats, which six deliberate non-easystats sources contradict (posterior::summarise_draws(),lavaan::fitMeasures(),blavaan::blavFitIndices(),blavaan::standardizedPosterior(),rstan::get_sampler_params(), and brms’s own hypothesis table). The README’s worked example is now an evaluated chunk reading a stored object, so its output is the package’s rather than hand-written: the block had printed an ASCII hyphen where apabayes emits U+2212, and the same unevaluated block had carried a call to a function that never existed. The README also gained theapabayes_tidy()stored-summary path, which the acceptance test called its single most useful discovery, a sentence saying that a plain numeric data frame is read as draws, and the apaquarto 6.0.0 precondition for Typst.internal:
table_parameters()builds its*pd*and% in ROPEcolumns throughshare_columns(), the helper the contrasts and correlations tables already used, so a ROPE-formatting change cannot reach one table and miss the most-used one. No output changes. The short-draws guard in the draws route carries a comment naming the upstream string it matches and the test that fails loudly if bayestestR rewords it.fix: a brms fit on which
parameters::model_parameters()fails upstream now re-raises namingapa_tidy(brms::as_draws_df(fit))as the route that reads the draws directly and does not hit the failure, the same shape as the blavaan re-raise below. The trigger is any brms model with a matrix response and atrials()term (family = multinomial(), and so every bmm M3 fit): insight 1.5.4’sget_data()compares a two-name response with&&, an error since R 4.3.0, and every easystats entry point goes through it. Measured on a real bmm M3 fit, a fresh 40-rowbrm()without bmm, and a real bmm diffusion (CSWald) fit, which is unaffected and reportscomponentas the bmm model parameter with no bmm code. bmm fits are now in the test suite (bmm in Suggests).fix:
apa_tidy_diagnostics()andapa_convergence()count divergent transitions on a brms fit sampled through cmdstanr. brms stores such a fit as astanfitwhose method is named"sample"(cmdstan’s word) where rstan writes"sampling", and the reader took the difference for “no sampler record” and returnedNA. bmm samples through cmdstanr whenever it is installed, so every bmm fit reported no record.fix:
apa_tidy()refuses a data frame or matrix too short to be a real posterior instead of reporting a confident but meaningless estimate.bayestestR::describe_posterior()already warns “the posterior is too short, returning NAs” in this case; that warning is now promoted to an error, because a 2-draw posterior cannot produce a reportable interval and the caller was getting an estimate anyway (the mean of the “draws”). Found converting a real manuscript, where a stored 2 x 6 matrix of per-model convergence summaries (max R-hat, min ESS) was silently read as posterior draws.fix:
apa_bf()honoursdigitsinstyle = "auto"’s scientific regime; it always printed a one-decimal mantissa there regardless ofdigits.apa_bf(4.975034e14, digits = 2)now returns4.98 × 10^14^, not5.0 × 10^14^. This makesapa_bf()a true drop-in for a caller’s own two-decimal Bayes-factor formatter with nostyle =needed.feat:
apa_pd(operator = TRUE)prepends"= "unless the value already opens with its own relation from the floor or the cap (.956becomes= .956;> .999is unchanged), so the result reads inside a sentence that already names the statistic (*pd* {x}) without the caller re-deriving which branch fired.fix: a blavaan fit on which
parameters::model_parameters()fails upstream now re-raises namingstandardize = TRUEas the path that reads the posterior directly and does not hit the failure, rather than passing the upstream message through unnamed.docs:
?apa_tablestates its scope explicitly — one row per parameter, no pivot, no second estimate column — and the vignette “Reporting brms models in apaquarto” gained a worked example carryingapa_table()output throughtidyr::pivot_wider()into a cross-tabulated design table, plus a section naming five gapsapa_inline()andapabayes_tidy()do not yet cover. All measured converting a real manuscript (miniQmetrics) rather than invented.feat: apabayes ships an apaquarto example and a vignette, and the test suite gained a gate that renders a document.
inst/apaquarto-example/holds a minimal apaquarto manuscript with a README naming the two commands that render it, and the vignette “Reporting brms models in apaquarto” walks throughapa_tidy(),apa_inline(),apa_table()andapa_note(). Both build from stored posterior summaries ininst/extdata, so neither needs a compiler or a fit.test-render.Rrenders every contract type to all four apaquarto formats and reads the output back; it is opt-in behindAPABAYES_RENDER_TESTand skips, with its reason, wherever the toolchain is absent. The reason it exists: the word-joiner defect below was in committed code at 100 % coverage withR CMD checkclean, because nothing this project ran rendered a document.feat: Typst joins the promised formats.
apaquarto-typstcompiles from apaquarto 6.0.0, where it previously did not compile at all, so all four apaquarto formats are now rendered and read by the render test. On apaquarto 5.x Typst still fails, for reasons that are apaquarto’s and not apabayes’s.fix: the
sem_fittable header for Bayesian gamma-hat isBGammaHat, notBΓ̂. The rendering font does not compose a combining circumflex over Greek capital Gamma in a table cell: it substitutes a spacing glyph that swallows the following space, in both PDF engines, so the header printed asBΓˆ[90% HDI]. The characters were correct, which is why reading the extracted text did not show it.apa_inline()is unchanged and still saysBΓ̂, which composes correctly in running text. The table note follows the header, so it now readsBGammaHat = Bayesian gamma-hat.fix: every bracket a table prints opens with a word joiner (U+2060), so an apaquarto PDF renders its intervals. apa7 writes each run of a cell as
\fontspec{Times New Roman} <text>, and fontspec reads\fontspec{font}[options], so a run beginning with[had the interval taken for a font option list: silently where the brackets balanced, and as! Argument of \fontspec has an extra }.where a split left them unbalanced. Either way the interval was lost, in every table that has one. The joiner is invisible, sits on the bracket rather than the cell so that a level or label prefix cannot strand it, and changes nothing else: the bounds keep their,, the columns keep their widths. Notes andapa_inline()keep plain brackets, being prose rather than cells.feat:
apa_table()reports the last three contract types, so every tableapa_tidy()produces can be tabulated. Asem_fittable has one row per model:Modelwhen any row names one, then*χ*^2^,*df*and*p*where the fit records them, and one column per fit index, each index whose interval the table records carrying that interval in the cell (RMSEA [90% CI],.092 [.071, .114]) as a comparison table carries its standard error. The default shows the indices the table has a value for, so a lavaan fit gives the frequentist set and a blavaan fit PPP, BRMSEA and BΓ̂ with no argument, and the two stacked give both. Acontraststable hasContrast,Groupwhen the contrasts were computed within one, the estimate and its interval,*pd*and% in ROPE. Acorrelationstable names each pair inVariable 1andVariable 2rather than repeating lavaan’s~~, then*r*, its interval,*pd*,*BF*~10~and the pairwise*n*, which can differ between rows of one table.fix: a frequentist interval column is headed
95% CI (Wald)or95% CI (bootstrap)rather than95% CI, and an interval whose method the table does not record is headed95% Interval. apa7 reads any header ending in<digits>% CIas a confidence-interval column of its own and re-formats it: a row with no bounds had its empty cell rewritten toNA.apa_inline()still writes95% CIin running text, which apa7 never sees. Aci_labelthat would produce such a header is refused, naming it.feat:
apa_table()also reports hypotheses, model comparisons, Bayes factor tables and inclusion Bayes factors. Ahypothesestable hasHypothesis,Groupwhen some row has one, the estimate and its interval as on a parameters table, and*BF*~10~, withERand*P*(H)on request. Alootable hasModel,ΔELPD (*SE*),ELPD (*SE*)— the standard error travels inside the cell —*p*~loo~and*w*, withLOOICon request, and the note names the model the differences are taken from. Abf_modelstable hasModel,*BF*~10~against the denominator model (which prints1.00) andError (%), withlog(*BF*~10~)and*P*(M | D)on request. Abf_inclusiontable hasTerm,*P*(incl),*P*(incl | D)and*BF*~incl~, or*BF*~excl~underbf_direction = "01". A defaultstatsis the reporting set, not every transform of the same evidence. Whereapa_inline()refuses a Bayes factor it cannot print as a number, a table keeps the row: an overflowed or underflowed one leaves its cell empty and brings in a log column, a missing or infinite inclusion Bayes factor leaves its cell empty, and the note names the terms and says why. Every header is the string the inline layer prints, so a table reads like the sentence beside it.fix:
apa_p(),apa_pd()andapa_prob()accept a probability that misses[0, 1]by floating-point rounding error — bayestestR returns a posterior inclusion probability of1 + 2.2e-16— instead of refusing it. A value genuinely outside the range is still an error.feat:
apa_table()turns a parameters or diagnostics table, or any objectapa_tidy()accepts, into the tibbleapa7::apa_flextable()renders as it is: every value formatted to text and decimal-aligned, every header its APA markdown (PredictororPath,*Mdn*,95% CrI,*pd*,% in ROPE,*BF*~10~,*p*,*R̂*,ESS~bulk~,ESS~tail~), and the options ofapa_inline()(stats,interval,ci_label,digits,digits_prob,leading_zero,bf,bf_direction). R-hat and ESS are opt-in on a parameters table;group_rows = TRUEadds aComponentcolumn forapa_flextable(row_title_column = ). No header is a column name apa7 would re-format, so the numericCI_low/CI_highpath of apa7 0.1.3, which aborts, is never reached.apa_note()returns the table note — the abbreviations the table shows, the interval’s kind, the ROPE range, a count of divergent transitions, never a verdict — for the apaquarto chunk option#| apa-note: !expr apa_note(tab), with the table made in an earlier chunk. Fit-index, contrast and correlation tables are refused by name for now.apa_table()shares its name withpapaja::apa_table(): whichever package is attached last masks the other.docs:
?apa_pand?apa_numstate that apa7 and papaja export functions of the same names and that the package attached last masks the others.apa7::apa_p()prints two decimals whereapa_p()prints three;papaja::apa_num()prints a hyphen for the minus sign.feat:
apa_tidy()reports aBayesFactorobject (ttestBF(),anovaBF(),regressionBF(),correlationBF(),contingencyTableBF(), …) as abf_modelstable read from the object itself: the denominator first, then each numerator, labelled as BayesFactor prints them ("Intercept only","wt + hp","Alt., r=0.707"), with the formula or full description inname, the method BayesFactor used ("JZS (BayesFactor)","Jeffreys-beta* (BayesFactor)") and its proportional error.bayestestR::bayesfactor_models()on the same object keeps the numbers but calls every method JZS, relabels contingency models wrongly and drops the error. A numerator that is the denominator model is listed once. Thebf_modelscontract gains anerrorcolumn, andapa_inline(stats = c("bf", "error"))prints*BF*~10~ = 4.5 × 10^6^ ± 1.3%.feat:
apa_tidy()onBayesFactor::posterior()output reports the posterior through the draws route, without posterior’s warning about the S4 class. ABFBayesFactorListis refused (report a column,x[, j]), and so is aparameters::model_parameters()table of a BayesFactor object, which summarises only the first numerator and can misalign its Bayes factors.feat:
apa_tidy()reports inclusion Bayes factors frombayestestR::bayesfactor_inclusion()as a newbf_inclusiontable (term,p_prior,p_posterior,bf,log_bf; attributes for matched-model averaging and custom prior odds). The object does not record how the underlying Bayes factors were computed.apa_inline()prints*BF*~incl~ = 1.9 × 10^4^,*BF*~excl~underbf_direction = "01", and the prior and posterior inclusion probabilities on request; a row with no finite inclusion Bayes factor (a term in every model, or a probability rounded to 1) is refused rather than printed as∞.papaja::apa_print()works on the class.feat:
apa_tidy()reports Bayesian correlations fromcorrelation::correlation()orcorrelation::cor_test()(withbayesian = TRUE) as a newcorrelationstable: one row per pair, namedmpg~~wt, withvar1,var2, the posterior estimate, its interval, pd, the ROPE share, the Bayes factor and the pairwisen, all read from the table, plus the method and prior columns. The table records neither its interval nor its centrality, soci(default"hdi") andcentrality(default"median") name them, matching correlation’s own defaults; apabayes cannot check them. correlation records itsciargument without applying it (the bounds are always 95 %), so a table labelled with any other level is refused. Frequentist tables and tables with diagonal rows (redundant = TRUE) are refused.apa_inline()prints a row as*r* = −.82, 95% HDI [−.92, −.66], *pd* > .999, *BF*~10~ = 1.3 × 10^7^, without the leading zero;statsadds"rope"and"n". A row is addressed by its pair in either order (apa_inline(x, "wt", "mpg")), by its term, or by one variable when only one row has it.papaja::apa_print()works on the class.correlationandBayesFactorjoin Suggests.feat:
apa_tidy()reports a table frommodelbased::estimate_contrasts()ormodelbased::estimate_means()on a Bayesian fit as acontraststable, the contract the emmeans route fills. Rows are named as modelbased names them (6 - 4,6, auto - 4, auto, a mean by its row values), abyvariable’s values fillgroup, and every number, the ROPE share and its bounds included, is read from the table. The table records its interval only in its call, soci = NULLreads it there (modelbased’s equal-tailed default when noci_methodwas passed); when the call givesci_methodas a variable,ci = "eti"or"hdi"names it, and acithat contradicts the call is refused. Tables frombackend = "emmeans"(whose estimate column does not say which centrality it holds) and from frequentist models are refused.papaja::apa_print()works on both classes.modelbasedjoins Suggests.fix:
apa_tidy()no longer reads any data frame as draws. A plain data frame, tibble or data.table of numeric columns still is; a data frame with a class of its own (a modelbased or easystats table, abayesfactor_modelsobject) or a column that is not numeric is refused with a message naming the class or the columns, whereposterior::as_draws_df()had silently turned it into a nonsense parameters table.feat:
apa_tidy()reports an emmeans grid from a Bayesian fit — the contrasts ofemmeans::contrast()orpairs(), or the marginal means ofemmeans::emmeans()— as acontraststable: the contrast string (on a means grid, the row label as emmeans writes it,cyl_f4,cyl_f4 auto), the posterior median or mean, the interval, pd and on request the ROPE share, all fromparameters::model_parameters().ci = "hdi", the default, is the highest-density intervalsummary(emmGrid)prints (emmeans’s HPD), reproduced bit for bit and labelledHDI, the same name as on every other route;ci = "eti"gives the equal-tailed one. Abyvariable’s values fill the contract’s newgroupcolumn and its name thebyattribute; the contract also gainedrope_pct. Every grid variable is kept as an extra column. A grid without posterior draws (a frequentist fit) and anemm_list(emmeans(fit, pairwise ~ f), two tables of different kinds) are refused with a message.emmeansjoins Suggests.feat:
apa_inline()reports acontrastsrow like a parameters row,4.28, 95% HDI [1.38, 7.01], *pd* = .998, with the ROPE share when the table carries one and no symbol unlesssymbolgives one. A row is addressed by its contrast string, and bygroupwhen the contrast repeats acrossbygroups. papaja’s ownapa_print.emmGrid()is left alone; a Bayesian grid is reported throughapa_print(apa_tidy(grid)).feat:
apa_tidy()reports a LOO model comparison fromloo::loo_compare()as alootable: per model the ELPD difference to the best model and its SE, the model’s ELPD and SE,p_loo, LOOIC and loo’s ownp_worseand diagnostic flags. Both shapes are read: the data frame loo 2.10.0 and later return and the matrix of earlier versions, which keeps the models in its row names. The comparison carries no weights, soweights =takes aloo::loo_model_weights()result (its kind, stacking, pseudo-BMA+ or pseudo-BMA, goes into theweight_methodattribute) or a numeric vector named by model, matched by name.loojoins Suggests.feat:
apa_tidy()reports a Bayes-factor model comparison frombayestestR::bayesfactor_models()as abf_modelstable:bf, the natural-loglog_bfnext to it, the denominator row, the method (bridge sampling, the BIC approximation, BayesFactor’s JZS) andpost_prob, the posterior model probability under equal prior odds, computed by log-sum-exp so that it stays finite whereexp()overflows.modelis the model as bayestestR names it; the new columnnameis the argument it was passed as. An object whose denominator index no longer points at its denominator row (bayestestR keeps the index through[) is refused. Before this method such an object fell through to the draws route and came back as a meaningless parameters table.feat:
apa_inline()reports both tables. Aloorow printsΔELPD = −0.97, *SE* = 0.35(the best model’s0.00included), withelpd,p_loo,looicandweighton request; abf_modelsrow prints*BF*~10~ = 6.38against the denominator model, withlog_bfandpost_prob(*P*(M | D)) on request. A Bayes factor beyond whatexp()can represent prints as its log, never as∞or0. Rows are addressed bymodel, and a Bayes-factor row also byname.feat:
papaja::apa_print()works oncompare.looandbayesfactor_modelsobjects, named by model.feat:
papaja::apa_print()works onbrmsfit,stanreg,lavaan,blavaanandbrmshypothesisobjects and on storedapabayes_tidytables (Milestone 3, third slice). The methods are registered when papaja is installed, which stays optional, and callapa_inline(). Without a term the result has papaja’s shape:estimate,statisticandfull_resultare named lists, one string per row, named by papaja’s own rule (apa_print(fit)$full_result$wt,$visual_x2); with a term they are the stringsapa_inline()returns.in_paren = TRUEwrites brackets for parentheses. papaja’s own methods forBFBayesFactorandemmGridare left alone.feat:
apa_convergence(), the convergence sentence (Milestone 3, second slice). From a fit or a stored diagnostics table it states R-hat, both effective sample sizes and the divergent transitions over every sampled quantity:*R̂* ≤ 1.004, bulk ESS ≥ 1,240, tail ESS ≥ 980, no divergent transitions. The extremes are stated as bounds and rounded away from the data (the largest R-hat up, the smallest ESS down), so that≤and≥hold for the unrounded numbers; the m3 manuscript’ssprintf("%.3f")printed≤ 1.003for 1.0034. When a value reaches a threshold (rhat = 1.01,ess = 400) the part says how many and gives the extreme (2 of 13 *R̂* ≥ 1.01, maximum 1.018). No word judges the fit; apassedflag and asummarydata frame are on the object for code.feat:
apa_tidy_diagnostics()records the number of divergent post-warmup transitions in adivergencesattribute, read from the sampler’s own record:rstan::get_sampler_params()on the stanfit inside abrmsfit(both backends),stanregorblavaanfit, and the object’s ownsampler_diagnostics()on aCmdStanMCMC. It isNA, not 0, for draws,mcmc.listand runjags objects and for fits made by optimisation, variational inference or a sampler without that record.rstanjoins Suggests.feat:
apa_tidy_diagnostics()gains ablavaanmethod.posterior::as_draws_df()cannot read a blavaan fit, so the chains areblavInspect(x, "mcmc"), under thecoef()names. Measured before it was written: the sampler object behind a blavaan fit is a stanfit on the default target but aCmdStanMCMContarget = "cmdstan", and both are counted.feat:
apa_inline()reports asem_fittable. A lavaan row printsχ²(24) = 85.31, *p* < .001, CFI = .931, TLI = .896, RMSEA = .092, 90% CI [.071, .114], SRMR = .065, a blavaan rowPPP = .030, BRMSEA = .094, 90% HDI [.071, .119], BΓ̂ = .983, 90% HDI [.973, .990]. The indices print with three decimals and χ² with two unlessdigitssets both, andstatsselects among them. Underinterval = FALSE, digits = 2, markup = "latex"a blavaan row reproduces the miniQ manuscript’sfmt_bfit()character for character.feat:
apa_tidy_sem_fit()on a blavaan fit gainscentrality = c("median", "mean"). The mean is blavaan’sEAPsummary, which is what the miniQ manuscript reports; without it its numbers could not be reproduced.fix: a diagnostics table no longer claims a median in its print header; its
centralityattribute isNA.internal: an
apabayes_resultsobject may carry one string for the whole table instead of one per row, which the convergence sentence needs.feat:
apa_inline(), the inline layer (Milestone 3, first slice). One row of a tidy table becomes the string a Results section quotes:*b* = −5.34, 95% CrI [−6.85, −3.82], *pd* > .999for a regression coefficient,.45, 95% CrI [.33, .57], *pd* > .999for a standardized path,−5.36, 90% CrI [−6.69, −4.02], *BF*~10~ = ∞for abrms::hypothesis()row, and R-hat with both effective sample sizes for a diagnostics row. The row is addressed by name only: a term, a label, a hypothesis string, or a structural-equation path by its two sides and operator (apa_inline(x, "visual", "textual", op = "~~"), order-insensitive for a covariance and for nothing else), withgroup =for a multi-group fit. No match or several matches is an error listing the candidates. Every number goes through the format layer; the interval label follows the row’s ownci_method, so a table of HDIs saysHDIand a lavaan table saysCI. The default method runsapa_tidy(x, ...)first, so every class that has an extract route can be reported from the fit as well as from a stored table. Tables of typesem_fit,loo,bf_modelsandcontrastsare refused by name until their slices land.feat: the
apabayes_resultsobject, the inline layer’s return value:estimate,statistic,full_resultandtable, papaja’s shape, inheriting papaja’sapa_resultsclass so thatpapaja::apa_table()accepts it. Measured before it was written: knitr’s inline hook ignoresas.character,formatandprintmethods and prints every element of a list, so bare`r apa_inline(fit, "wt")`works through aknit_printmethod registered on knitr, which stays in Suggests. (papaja’s own object needs$full_resultinline for the same reason.)internal:
sem_term_parts()inR/extract-shared.Rsplits a lavaan-style parameter name into its sides and operator, for the blavaan labels and the inline addressing alike;blavaan_labels()now uses it. No behaviour change.chore: the maintainer address is
gfrischkorn@icloud.com, and the design record, the specs and the fixture builders are kept outside the tracked tree.feat:
apa_tidy()gains abrmshypothesismethod, for the output ofbrms::hypothesis(). It is the first route that calls no easystats function: easystats has no method for the class, so the numbers are brms’s own$hypothesistable. No brms function is called either — the route reads list elements — though brms must be installed, because the table names the version that produced the numbers.bf10follows the reporting decision already recorded: the Savage–Dickey ratio of a point hypothesis is inverted to be a Bayes factor against equality, and the posterior odds of a directional one are kept as they are.feat: the
"hypotheses"contract gains agroupcolumn.brms::hypothesis(scope = "coef")returns one row per hypothesis and group level, and without the column six rows of a three-level factor cannot be told apart.feat:
apa_tidy()on abrmshypothesisreports the interval level per row.brms::hypothesis()takes the quantiles atalpha/2and1 - alpha/2for a point hypothesis but atalphaand1 - alphafor a directional one, so one object holds intervals of two masses — 95% and 90% at the defaultalpha. Theci_levelattribute states a level only when every row agrees; the column always says what each row is. Analphaof 0.5 or more, whichbrms::hypothesis()accepts and which turns a directional interval inside out, is refused by name.feat: neither the kind of a hypothesis nor what
Estimateholds is stored by brms, and both are read off the object’s own draws rather than assumed. A named hypothesis loses its operator (theHypothesisstring becomes the name, and a name may itself contain<), sodirectionalis derived from which quantile pair the interval used;directional =overrides it, and a row that cannot be read is an error rather than a silent missing Bayes factor. Likewiserobust = TRUEleaves no marker, socentralityis decided by comparing the estimate with the mean and the median of its draws.feat: the
ci_methodcolumn and attribute accept"spi"and"bci". The column is descriptive — it says what an interval is, and the result-object route reports tables apabayes did not compute, where the user chose the method. No route offers them: everyciargument is still"eti"or"hdi", exactly as"wald"and"boot"are describable without being offered.feat:
apa_tidy()andapa_tidy_sem_fit()gain ablavaanmethod, the Bayesian mirror of the lavaan route: a posterior median with a credible interval, pd and convergence diagnostics where lavaan has a maximum-likelihood estimate with a Wald interval and a p value, andpisNAthroughout. The two fit-index rows are complementary — lavaan fills χ², CFI, TLI, RMSEA and SRMR, blavaan fills the posterior predictive p value, BRMSEA and BGammaHat, and each leaves the other’s columnsNA, because a blavaan fit carries none of them.apa_tidy_sem_fit()therefore dropstestandrmsea_levelon this method rather than accepting and ignoring them, and gainspD,rescaleandfit_ci_levelforblavaan::blavFitIndices().pDis spelled as blavaan spells it, so that it is not read as the contract’spd, the probability of direction. The interval on that row is the highest-density one, because that is what reproduces the numbersblavaanitself publishes. Ablavaanfit now dispatches to its own method; the lavaan guard stays for the method called by name.feat:
standardizeon ablavaanfit readsblavaan::standardizedPosterior(), not easystats — measured,parameters::model_parameters(x, standardize = )aborts for every value of the argument,FALSEincluded. The standardized solution covers the whole parameter table, so its rows are a superset of the unstandardized ones: the fixed marker loadings appear with a real interval, and under"std.all"the latent variances are exactly 1. Those rows carry full R-hat and ESS, because row i of that matrix was measured to be the standardization of draw i of the chains. They carry no component information, socomponentisNAthere and cannot be combined withstandardize; select rows withvariables.feat: R-hat and both ESS columns of a
blavaanfit come fromposterior::summarise_draws()over the fit’s own chains, and blavaan’s are never computed. They differ from whatblavaan::summary()prints, which reportsblavInspect(x, "rhat")and"neff"— one ESS where the contract has two, from an estimator that is neither the bulk nor the tail ESS the “greater than 400” rule of thumb is defined for. The help page says so.feat: a multi-group
blavaanfit is refused with a message naming the cause.model_parameters()aborts on one, and every fallback names the parameters differently, so reporting any of them would silently change whattermmeans between fits.refactor:
apply_label_overrides()shares the “labels =wins on the terms it names” step across all three label helpers, andcheck_sem_component()takes its vocabulary as an argument, since blavaan’s component names (latent,residual) are not lavaan’s six.apa_tidy.lavaan()andapa_tidy_sem_fit.lavaan()split their row assembly and their guards into helpers, bringing both back under the 50-line guideline.feat:
apa_tidy()gains alavaanmethod, the extract layer’s first frequentist route, andapa_tidy_sem_fit()arrives with it as a generic for the fit-index row (χ² with its df and p, CFI, TLI, RMSEA with its interval, SRMR;test = "scaled"or"robust"picks lavaan’s variants, and a fit without a scaled test statistic is refused rather than given one). Estimates, standard errors, the interval and the p value come fromparameters::model_parameters()and the fit indices fromlavaan::fitMeasures(); apabayes computes no number of its own and nothing it prints judges a fit.termis lavaan’s own parameter name (visual=~x1, with the.g2suffix from the second group of a multi-group fit) andlabelthe same with spaces, qualified by the group label where there is one.componentselects one or more of"loading","regression","correlation","variance","mean"and"defined", validated before easystats sees it because a name it does not know silently yields zero rows.standardizetakesTRUE("std.all") or a lavaan type string, and thestdcolumn records which solution the row is.fix: a fixed parameter of a lavaan fit — a marker loading, or a latent variance under
standardize— reportsp = NAas lavaan does.parameterswritesp = 0there (measured:p[is.na(p)] <- 0in its source, on exactly the rows whose test statistic isNA), and a p value of 0 for a parameter that was never tested reads as significance. This is the one easystats number the route overrides, and it restores the upstream value rather than computing one.feat: the tidy contract gains
centrality = NA, for a point estimate that is no posterior summary, andci_methodgains"wald"and"boot". A lavaan fit gets a Wald interval, except that the unstandardized solution of a fit withse = "bootstrap"gets the percentile bootstrap interval and says so; the standardized solution of that same fit is Wald again, because lavaan takes it through the delta method.fix:
labels =is applied by which terms it names rather than by which substitutions differ from the term. On a route whose derived label is not the term itself —visual =~ x1againstvisual=~x1— asking for the term as the label is a real request, and the old test read it as no request at all.feat:
apa_tidy()reports an easystats result object — the tablebayestestR::describe_posterior()orparameters::model_parameters()already computed — and not only a fitted model. Because every Bayesian model easystats can summarise returns a table inheritingdescribe_posterior, this one route covers model classes apabayes has no fit method for. Nothing is recomputed: the estimates, interval,pd, ROPE percentage and diagnostics are read off the table, and the reporting settings with them, so the method takes noci,ci_level,ropeordiagnosticsargument.centrality = NULLreports whichever of the median and the mean the table holds and asks you to name one when it holds both.ess_bulkis alwaysNA— no easystats table carries it; pass the fit for both ESS columns. Aparameters_modeltable that is not a posterior summary (a frequentist model, or one computed with severalcilevels) is refused rather than coerced to draws, which is what the coercing default would otherwise do to it.feat:
apa_tidy()gains astanregmethod for rstanarm fits, the third route of the extract layer, with the brmsfit method’s signature. Estimates, interval, pd and the optional ROPE come fromparameters::model_parameters(), always called withpriors = FALSE(the prior merge appends junkNArows undereffects = "random") andcomponent = "all"(the bare easystats default omitssigmaon this class). R-hat and both ESS columns come fromposterior::summarise_draws()over the fit’s draws rather than frombayestestR::diagnostic_posterior(), which never coverssigmaon a stanreg and disagrees numerically withposterioron the terms it does cover; every reported parameter therefore has a diagnostic.apa_tidy_diagnostics()already handled stanreg through its default method, so there is nostanregmethod for it.internal: the brmsfit route’s label derivation, optional-column reading and
variables =resolution move toR/extract-shared.Rasparameters_labels(),optional_column()andresolve_parameters_variables(), ahead of the stanreg route that uses them unchanged. No behaviour change.fix:
apa_tidy(fit, effects = "random")on a model without random effects now says so (“effectsis”random”, butxhas no random effects.”) instead of surfacing easystats’'by' must specify a uniquely valid column. The check isinsight::is_mixed_model()on the model formula, run before easystats is called;insightmoves from Suggests to Imports for it, andrstanarmjoins Suggests.internal: the shape every parameters route repeats — check the reporting arguments, call easystats once, match rows by name, assemble the contract columns — moves into
R/extract-shared.R, and theapabayes_tidy()constructor splits out its input checks and its column assembly. No behaviour change: the same 585 tests pass either side of the refactor.feat:
apa_tidy()gains abrmsfitmethod, the second route of the extract layer. Estimates, interval, pd and the optional ROPE come fromparameters::model_parameters(); because that call returns noESS_bulkcolumn, R-hat and both ESS columns come from a second call tobayestestR::diagnostic_posterior(), joined by parameter name rather than by position (its row order differs and its default omitssigma). Theeffectsandgroupcolumns are read defensively: they exist only for a model with random effects, and""becomesNA. Display labels come from thepretty_namesattribute, disambiguated by group where two parameters share a label, so the inline layer’s term-or-label addressing stays unique.feat:
apa_tidy_diagnostics(), a generic for convergence diagnostics alone, with a coercingdefaultmethod for anythingposterior::as_draws_df()accepts and arunjagsmethod. Its tables carry no interval, soci_methodandci_levelareNAand the print header does not claim an interval that is not there.feat: extract layer, tidy contract and draws route (Milestone 2).
apabayes_tidy()builds the object the extract layer hands to the format, inline and table layers: a tibble whose columns are fixed bytype("parameters","diagnostics","hypotheses","loo","bf_models","sem_fit","contrasts"), with the reporting metadata as attributes.validate_apabayes_tidy()is the check every consumer runs on entry,is_apabayes_tidy()the predicate, andprint.apabayes_tidy()writes what the numbers are above the tibble.feat:
apa_tidy(), the extract generic, with methods fordrawsobjects, a coercingdefaultmethod for anythingposterior::as_draws_df()accepts (stanfit,CmdStanFit,mcmc,mcmc.list, matrices, data frames) and one forrunjags. Estimates, interval, pd and the ROPE percentage come frombayestestR::describe_posterior(), R-hat and ESS fromposterior::summarise_draws(). Sampler variables (lp__,lprior,prior_*) are dropped by default and reported when named invariables.fix:
apabayes_tidy()andapa_tidy()returned their table invisibly, so a bare call at the console printed nothing. Both now return visibly and reachprint.apabayes_tidy().feat: format layer (Milestone 1).
apa_num(),apa_p(),apa_pd(),apa_prob(),apa_ci(),apa_bf(),apa_er()andapa_rhat_ess()turn numbers into APA-style text for four markup targets (md,latex,typst,plain), chosen from themarkupargument,options(apabayes.markup = )or the knitr output format.apa_bf()prints Bayes factors as numbers only, withdirection = "01"for BF01;apa_bf_label()is the opt-in helper that returns a verbal category from a named scheme ("jeffreys","raftery"), with the caveat on its help page.Package skeleton.
