GeneSuite
Documentation / Technical reference

gbayes R interface design

Authoritative target contracts for six Bayesian R fitters, prepared resources, results and execution.

Status and authority

This is the authoritative interface contract for the standalone gbayes R package, agreed on 29 October 2026. It defines six fitting interfaces and their shared contracts. BayesC/BayesR implementations through all six fitters and bayesCM through bayes, mbayes, blr and mblr are authorized; bayesFA/bayesFR through mbayes are also authorized; scalar bayesRC through bayes and block-eigen sbayes is authorized; joint individual bayesRC through mbayes with fixed residual covariance is authorized; joint summary bayesRC through msbayes with fixed sampling/residual covariance is authorized; scalar marker_gaussian and fixed BayesC slab means through bayes/sbayes are authorized; point_normal and continuous_shrinkage through sbayes are authorized; variational and mixture_variational through sbayes are authorized; exact same-build individual C/R continuation through bayes and mbayes is authorized; exact same-build summary C/R continuation through sbayes and msbayes is authorized; exact same-build cross-product C/R continuation through blr and mblr is authorized; posterior-quantity capture for individual C/R through bayes and mbayes is authorized; posterior-quantity capture for summary C/R through sbayes and msbayes is authorized; posterior-quantity capture for cross-product C/R through blr and mblr is authorized; native mvSuSiE/MultiSuSiE exposure through msbayes with explicit IBSS identity is authorized and implemented in development gbayes 0.1.9; additional target methods require separate instructions. The current workflow and executable source describe what is available today. The current method and algorithm matrix is the capability catalog across bayes/sbayes/mbayes/msbayes, including partial and missing native adapters. Available routes retain their method-specific input and native qualification limits. All six C/R fitters expose exact same-build continuation and optional posterior quantities. This does not qualify additional input types, method/algorithm products, broad calibration, factor mixing or release platforms.

This design replaces the earlier prospective dispatcher and extraction plan in this page and the R-interface direction recorded during package migration. Current native statistical contracts and qualification evidence retain their authority. The original design remains recoverable in Git history.

Backward compatibility is not required for this development API. Replace superseded dispatch and names directly when implementation is authorized. Do not add forwarding wrappers, legacy spellings, case-dependent behavior, positional-output fallbacks or compatibility-only tests. Preserve unrelated methods, native numerical behavior, existing evidence and recorded limitations.

Follow sblr’s principles: thin public adapters, distinct single-trait and joint multivariate contracts, one resolved specification, immutable prepared resources, private chain state, validated results and common scientific access. Sblr remains unchanged and is not a runtime dependency. This is an R interface redesign, not authorization for new samplers or a general inference framework.

Public fitting interfaces

All six functions belong to the gbayes R namespace. Function names contain no underscores. The prefix s means marginal summary statistics; m means a joint multivariate model. Cross-product inputs belong to blr and mblr.

Function Input contract Current methods
bayes() One phenotype and marker genotypes bayesC, bayesR, bayesRC, bayesCM, elastic_net, laplace_gaussian, marker_gaussian
sbayes() One marginal-summary table and prepared LD bayesC, bayesR, bayesRC, point_normal, continuous_shrinkage, variational, mixture_variational, marker_gaussian
blr() Single-response cross-products bayesC, bayesR, bayesCM
mbayes() Joint phenotypes and marker genotypes bayesC, bayesR, bayesRC, bayesCM, bayesFA, bayesFR, elastic_net, laplace_gaussian
msbayes() Declared joint trait/study summaries and LD bayesC, bayesR, bayesRC; mvsusie/multisusie with ibss
mblr() Common-design multivariate cross-products bayesC, bayesR, bayesCM

This is the initial target envelope plus the qualified joint individual RC extension and joint sparse-summary RC. Cross-product BayesRC remains gated. Single-trait factor reductions remain numerical references rather than additional public fitters. Several independent single-trait fits are not a joint multivariate fit.

Current individual implementation

The C/R implementation exposes bayes and mbayes for bayesC/bayesR, with complete finite outcomes and a prepared packed BED Glist. Dense X remains unsupported for these C/R routes. Development 0.1.16 adds scalar C/R annotation adapters with passing focused references; richer joint C/R annotations remain gated. The isolated developer checkpoint now verifies 0.1.16; full release qualification remains separate. The RC/CM/factor adapters below extend that envelope. Existing inference engines are reused through private preparation/fit adapters, without forwarding legacy public names or adding a compatibility layer.

Scalar initialization is .5 times observed phenotype variance for the nominal genetic fraction and residual fraction, with slab variance h2v/(pmass). Joint fitting requires explicit labelled vb/ve and pi; learning uses the proper priors described below. Both routes center each trait on the fitting samples and default to likelihood dimension n-1. Other declared nuisance projections require an explicit likelihoodDimension. Record fitted intercepts and add them only for phenotype prediction. Glist and its selected sample set are unchanged; phenotype rows are mapped explicitly to that ordered selection.

The installed samplers retain the first native post-burn transition. For the ordinary unscheduled models in this slice, the R adapter translates native burn-in to nburn+nthin-1 and native sampling length to nit-nthin+1. Total transitions remain nburn+nit and retained post-burn indices are exact multiples of nthin, including schedules with a remainder. Final state/RNG replay and explicit native retention comparisons are qualification checks. Schedule-, annotation-dependent updates are excluded from this bridge. Exact continuation uses the separate qualified contract below.

Native parameter arrays retain their actual draw-by-chain-by-quantity axes. Full marker-effect draws are unavailable. Scalar realised-VG interval summaries cover the native post-burn interval and remain separately labelled diagnostics; they are not relabelled as common retained-draw summaries. Complete scalar global-memory estimation and scalar actual-worker counts are unavailable; mandatory summary/trace allocations and packed storage are checked, while the joint backend also supplies its native total-memory estimate and actual workers. Keeping parameter diagnostics does not alter final states or effect summaries.

Individual C/R posterior quantities

Bayes and mbayes expose existing native observational accumulators through posterior for bayesC/bayesR, algorithm=“mcmc”. No new sampler or full marker-effect trace system is introduced. Summary C/R capture follows its separate contract below; other methods/interfaces retain their capture gates.

Posterior accepts reference (an explicit aligned sparse-LD Glist), partition (mutually exclusive group labels named in fitted marker order), phenotypeVariance (positive trait-named external denominators, requiring reference), prediction, and memoryLimit (bounded by control$memoryLimit). Prediction accepts Glist, ids, targetSet=“prediction”, batchSize=64, retainDraws=FALSE and preparationMemoryLimit. All keys are exact; native snake-case spellings are not compatibility aliases.

Reference genetic covariance is the retained-draw quadratic B’ R B on the declared standardized LD reference. It is separate from latent vb and from empirical training genotype covariance. No reference uncertainty or automatic effect-scale conversion is added. Draw-wise correlation moments condition on positive variances and retain their valid counts; all-null draws do not invent correlations. Heritability ratios use the supplied compatible phenotypeVariance. Population moment variances use divisor S; native trace summary SDs/intervals retain their own reported conventions and availability statuses.

Partition activity distinguishes expected active-marker counts, any activity for each trait in a pair, and activity shared at a marker. With reference, full group/trait covariance retains cross-group LD; diagonal blocks are not additive heritability contributions, and posterior block variances cannot simply be summed. Partitions are output groups, not prior annotations or enrichment tests.

Prediction captures selected conditional genetic-score moments and within-person cross-trait covariance. Native target preparation uses a private descriptor copy with the fit’s saved HWE coding. Target frequencies/outcomes do not redefine the fit or mutate Glist. Marker subsets report explicit coverage and domain; omitted effects contribute zero to that selected score. These are not phenotype prediction intervals; residual noise and cross-person/reference uncertainty are absent.

Common extract quantities are genetic (native moment/count metadata), geneticCovariance, geneticCorrelation, heritability, partition, prediction and quantitySummary, with per-chain moments where available. Summary quantities returns pooled native trace intervals/diagnostics separately from model parameter summaries. Genetic/partition traces follow retainDiagnostics; selected scores follow prediction$retainDraws independently. Stored arrays preserve draw, chain and named scientific axes, including size-one axes. Full effect draws remain NULL.

Capture is requested per call, including continuation; an empty posterior does not inherit prior capture. Projection resources/settings may change while the statistical model remains fixed. Resumed moments/intervals describe the newly retained segment only, excluding any discarded thinning advance. Native states, RNG, effects and parameter traces remain unchanged by capture. Resource hashes are checked before/after the call. Reference loads, selected-target preparation, native accumulators, trace copies and summaries have managed memory guards; these do not supply a complete scalar process-RSS ceiling or new scale qualification.

Exact individual C/R continuation

Bayes and mbayes accept a previous compatible bayesfit through continuation for bayesC/bayesR, algorithm=“mcmc”, using existing native full checkpoints. Saved RNG, effects, exact working residuals, allocations, marker order and learned parameters are restored per logical chain. These are not fresh fits initialized from posterior means. SaveRDS/readRDS preserves the checkpoint without live handles.

Nit requests additional transitions. Omitted method, traits, scientific arguments, thinning, chain count and seeds inherit the original specification. Nburn must be omitted or zero; original burn-in is never repeated. Thinning, logical chains, seeds, likelihood dimension, priors and learning policies must remain identical. Presentation, parameter-diagnostic capture, memory budgets and supported worker count may change. Scientific settings are revalidated against the original prior, not the final learned parameter values. Dense X and annotations remain unsupported; optional C/R quantity capture uses the separate contract above.

Global retained postburn indices remain multiples of the saved nthin across every split, including remainders. If needed, advance once to just before the next retained transition using native checkpoints, discard that advance’s summaries, then run the retained segment. This uses at most two native calls and exactly nit new transitions, without replay or extra RNG consumption. Reject a segment that contains no scheduled retained draw. Absolute retained transitions, origin burn-in, cumulative postburn count and advance accounting are recorded.

A resumed fit summarizes the newly added segment only. It does not silently pool earlier means or fabricate cumulative posterior intervals or diagnostics. Retained-count-weighted moment pooling and concatenated retained parameter traces can be compared with an uninterrupted run; native scalar realised-VG summaries continue to describe their separately labelled native postburn interval. The new fit remains resumable.

Checkpoint identity binds aligned raw outcomes, ordered traits/samples/markers, physical selections, coding metadata, full active BED/BIM/FAM bytes, and the bundled gbayes/gbase native runtime closure, R version and platform. Resource and runtime fingerprints are checked before and after fitting. Full file hashing adds streaming I/O; it does not decode a dense genotype panel. State/specification checksums detect accidental edits. This is same-build continuation, not a promise of portability across libraries/platforms or a tamper-proof archive. Current qualification is the Windows bundled distribution; other layouts keep ordinary fitting with restartState unavailable. Historical objects lacking this checkpoint contract are rejected. Other interfaces/methods do not gain continuation.

Focused uninterrupted-versus-split tests cover both methods and interfaces, fixed/learned priors, thinning phase, repeated continuation, serialization, diagnostic capture, worker changes and native residual-rebuild boundaries. These checks do not expand the existing scientific, memory or performance qualification envelope.

Current marginal-summary implementation

The C/R adapters in sbayes and msbayes expose bayesC/bayesR through existing native samplers and the same bayesfit result/execution contract. Sbayes supports sparse LD and verified block-eigen LD; msbayes currently supports sparse LD only. Joint block-eigen input fails explicitly because the R/native bridge does not support it. Annotation remains unavailable here. Optional C/R posterior quantities and exact continuation follow the separate contracts below.

Scalar summaries initialize vb=h2/(p*mass) and ve=1-h2 on standardized response scale. Sparse residual learning defaults to the existing reference_ld approximation with adjustment .9; eigen learning uses the retained likelihood. Fixed residuals and native-validated exact in-sample normalization remain available. These policies are recorded rather than inferred to be interchangeable. Joint summaries require explicit sampling dependence, vb and pattern pi. Independent studies supply named residual_variance and may use different references/marker subsets. Shared-LD covariance can be supplied through ve or sampling$covariance, with duplicate specification rejected. Its optional learning requires the existing exact response scatter, likelihood dimension and proper prior. All joint learning defaults off.

Summary tables are harmonized and standardized by each checked reference. Resource checksums, provider maps and standardized marginal inputs are retained. Training sample identities, phenotype intercepts and genotype coding are unknown; prediction fails explicitly rather than fabricating those quantities. Thinning uses the same ordinary-transition translation and checkpoint diagnostics as the individual adapters. These interfaces do not change native scientific limits.

Marginal-summary C/R posterior quantities

Sbayes and msbayes expose the existing native observational accumulators for bayesC/bayesR, algorithm=“mcmc”, on their current likelihoods. Posterior accepts reference, partition, phenotypeVariance and memoryLimit, with the same exact keys, axes, moment conventions and memory/resource checks as individual C/R. Reference is an explicit sparse-LD Glist aligned to the complete ordered fitted marker set, including the union of study-specific marker sets. No fitting reference or provider is selected implicitly for covariance reporting.

Reported genetic covariance is the retained-draw quadratic B’ R B on that declared standardized reference. It is separate from latent vb, sampling-error covariance, the fitting reference-LD approximation and any retained eigen likelihood. Reporting with the full explicit reference does not restore omitted likelihood directions or account for LD-reference uncertainty. Trait-named, compatible phenotypeVariance supplies external h2 denominators; standardized summary effects do not identify raw phenotype variance or units automatically.

Partition activity can be requested without a reference. Full group/trait covariance requires reference and preserves cross-group LD. Extract exposes genetic, geneticCovariance, geneticCorrelation, heritability, partition and quantitySummary. Retained covariance, activity and h2 arrays follow control$retainDiagnostics; disabling traces preserves moments and native not-retained statuses. Full effect draws remain unavailable. Pooled native quantity intervals/diagnostics remain separate from parameter summaries; per-chain moments are available, per-chain quantity intervals are not.

Capture is requested separately on each call, including continuation. Requests may change without changing the statistical model. Resumed outputs cover only new retained draws, excluding discarded thinning advances; earlier intervals and convergence diagnostics are not pooled. Native states/RNG, effect summaries and parameter traces are observationally unchanged. Explicit reference bytes and descriptors are checked before/after fitting. Disk LD retains its existing single-worker limit. Managed allocation guards do not add a scalar total-RSS estimate or performance qualification.

Summary prediction requests are rejected: marginal summaries do not identify training genotype coding or phenotype intercepts. An LD reporting reference does not resolve this identification limit. Other methods/interfaces retain their capture gates; no new native sampler is added.

Exact marginal-summary C/R continuation

Sbayes and msbayes accept a previous compatible C/R bayesfit through continuation, algorithm=“mcmc”, using the existing native full checkpoints. Sbayes supports its existing sparse and scalar block-eigen likelihoods; msbayes supports existing sparse shared-LD and independent-provider likelihoods, including study-specific references and declared variable N. This adds neither joint block-eigen input nor continuation for specialized summaries, RC, CM or factors.

Nit requests additional transitions, with nburn omitted or zero. Omitted method, representation, trait/provider mapping, sampling, priors, learning settings, scientific controls, thinning, chains and seeds inherit the saved specification. Original priors remain priors; final learned parameters are restored only through native state. Changed priors, sampling dependence/covariance/scatter/dimension, study sample sizes, residual policy/normalization, eigen settings, sample-size policy, storage mode, representation or chain identity fail. Workers, interval probability, diagnostic capture and resource budgets may change within existing backend limits; disk LD still requires one worker.

The original global thinning phase persists across remainder and repeated splits. At most one checkpoint advance precedes the retained native call, consuming exactly nit new transitions without replay or repeated burn-in. Reject a segment with no globally scheduled retained draw. Record absolute retained transitions, origin burn-in, cumulative counts and advance/native-call accounting. Resumed summaries, intervals and convergence diagnostics cover the added segment only; earlier interval/diagnostic summaries are not automatically pooled.

Identity covers harmonized standardized marginal effects and marker N per provider, ordered trait/provider mapping, prepared reference descriptors and full active sparse-LD row-pointer/index/value/metadata/marker-file bytes. Scalar eigen checkpoints additionally bind verified block definitions and eigen controls. Row order and equivalent allele swaps remain valid after harmonization. Resource and runtime fingerprints are checked before and after fitting, adding streaming I/O without storing LD values or eigenvectors in the checkpoint. Existing Glist validation still requires declared source-file availability. Runtime/state checksums follow the same bundled-Windows, R/platform and accidental-edit scope as individual C/R. SaveRDS/readRDS preserves states without live handles; objects without the new summary checkpoint contract fail. Other runtime layouts retain ordinary fitting with restartState unavailable.

Focused replay checks compare complete final native/RNG states and retained parameter traces with uninterrupted runs for both methods and likelihoods, fixed/learned priors, provider maps, variable N, memory/disk LD, worker changes, serialization and residual-rebuild boundaries. Retained-count-weighted effect/PIP and second-moment pooling is checked separately from segment-only intervals. The existing reference-LD approximation, eigen truncation, covariance-learning guards, missing scalar total-memory/worker reports and summary prediction limits remain unchanged.

Current cross-product implementation

Blr and mblr implement exact common-design BayesC/BayesR using the existing scalar/joint samplers and common bayesfit. The old blr signature and positional outputs are replaced directly. XX has identical unique feature row/column labels; Xy is a named vector for blr or labelled feature-by-trait matrix for mblr. yy is exact same-scale response scatter, required for residual learning and omitted scalar variance initialization. Symmetry, PSD, score consistency for singular designs and the complete joint Gram/rank contract are checked.

Inputs declare already centered statistics by default, with likelihood dimension n-1. Residualized inputs declare coding\(preprocessing="residualized" and an explicit control\)likelihoodDimension. No preprocessing is applied to supplied statistics. Scalar calibration respects feature units: vb=h2yy/(trace(XX)mixture mass), ve=(1-h2)*yy/dimension. Joint vb/ve and pattern pi remain explicit; joint learning defaults off and requires proper priors. Only likelihood=“exact” is supported for C/R. Exact common-design inputs do not cover arbitrary missing outcomes or trait-specific nuisance projections.

Optional coding owns centers/scales named in feature order, intercept named in trait order and preprocessing (centered or residualized). These describe the transformation used to prepare statistics. Dense feature prediction requires saved centers/scales; phenotype prediction additionally requires intercepts and centered preprocessing. Unknown coding remains unavailable. Generic cross-product prediction does not infer alleles or accept packed Glist inputs. Full effect draws and annotation are unavailable in this implementation. C/R continuation and posterior quantities use the separate contracts below.

Cross-product C/R posterior quantities

Blr and mblr expose existing native observational accumulators for bayesC/bayesR, algorithm=“mcmc”, likelihood=“exact”. Posterior accepts reference=“training”, partition, phenotypeVariance and memoryLimit (bounded by control$memoryLimit). An empty request does not capture quantities. Other reference types and prediction capture are rejected. Feature partitions are disjoint labels named in the exact fitted feature order; partition-only capture needs no covariance request.

Reference=“training” explicitly selects the checked fitting operator XX/d, with d equal to the declared likelihood dimension. Covariance is the retained-draw quadratic B’ XX B / d in supplied feature coordinates. For centered data the default is d=n-1; residualized designs report a projection-normalized model quantity, not raw-population covariance. No LD correlation standardization, allele interpretation, effect rescaling, intercept contribution or new centering is inferred. The fitting operator is shared without a second reference matrix. Its identity includes ordered features, values and divisor.

The common genetic/geneticCovariance/geneticCorrelation names describe this linear-predictor component; generic features do not establish a genetic model. Latent vb and empirical component covariance remain distinct. Trait-named phenotypeVariance requires reference=“training” and supplies explicit compatible denominators for the common heritability output. These are variance ratios; genomic heritability requires appropriate genetic features, model and units. No denominator is inferred from yy and no ratio is clamped to [0,1].

Native accumulators preserve conditional correlation counts, population moment variances, full cross-group/trait covariance, expected active counts, both-active and shared-marker activity. Partition blocks are not independent additive variance contributions. Quantity summaries keep native interval/diagnostic conventions and availability separately from parameter summaries. Per-chain moments are available; per-chain quantity intervals and full effect draws are not. Covariance/activity/h2 traces follow control$retainDiagnostics and keep singleton axes. Disabling traces preserves moments and not-retained statuses.

Capture is requested separately on every call, including continuation. Requests can change while the model stays fixed. Resumed outputs cover only added retained draws, excluding discarded thinning advances. Native states/RNG and parameter traces are unchanged. Checked reporting identities are verified before/after formatting and checkpoint identities before/after fitting. Managed allocation guards include native accumulators, traces and R copies; they do not supply a complete scalar RSS estimate. The bridge reuses public native capture APIs; sampler algorithms and native library sources remain unchanged.

Posterior score capture is unavailable. Ordinary predict() continues to use mean effects and saved feature transformations, with its existing coding and intercept gates; availability$prediction refers to that ordinary operation here. CM capture, annotation and full effect traces retain their existing gates.

Exact cross-product C/R continuation

Blr and mblr accept a previous compatible bayesfit through continuation for bayesC/bayesR, algorithm=“mcmc”, likelihood=“exact”. Existing native checkpoints restore each chain’s RNG, implementation-coordinate residuals, effects, allocations, update order and learned parameters. The current Rcpp controls already accept those states; no native bridge or sampler changes are needed.

Supply XX, Xy and n again. Omitted yy and coding inherit the saved checked values; explicitly supplied values, including NULL, are revalidated. Omitted method, statistical settings, proper priors, likelihood dimension, thinning, logical chain count and seeds inherit the original specification. Learned final parameters remain checkpoint state, not replacement priors. Any change to the ordered feature/trait labels, cross-product values/scatter, n, coding, dimension, prior, learning policy or chain identity fails. Coding includes saved transforms, intercepts and preprocessing even when it does not affect the likelihood. Workers, diagnostic capture, interval probability and memory budgets may change.

Nit adds transitions, with nburn omitted or zero. Preserve the original global thinning phase across remainder and repeated splits, using at most one discarded checkpoint advance followed by the retained segment. Exactly nit transitions run; a segment containing no scheduled retained draw fails. Store absolute retained transitions, origin burn-in, cumulative postburn counts and advance accounting. Resumed moments, intervals and diagnostics describe only the added segment. No cumulative intervals or convergence diagnostics are manufactured.

Identity binds normalized checked statistics in supplied feature coordinates, ordered labels, saved coding, the bundled gbayes/gbase native closure, R and platform. Load the declared gbase dependency before fingerprinting it; pure cross-product fitting otherwise need not initialize that namespace. Check identities before and after fitting, with state/specification checksums for accidental edits. Fits retain no native handles. SaveRDS/readRDS preserves the checkpoint. Current qualification is the bundled Windows distribution, with no cross-build/platform replay promise. Other runtime layouts retain ordinary fitting with restartState unavailable; historical objects without this contract are rejected.

Focused tests compare complete native/RNG states and parameter traces for both methods and interfaces, fixed/learned priors, worker changes, remainder/repeated splits, singular designs, absent scatter with fixed residuals, explicit nuisance dimensions, saved prediction transforms and native residual-rebuild boundaries. Dense algebra independently checks working residuals; weighted effect/PIP/second moments are checked separately from segment-only intervals. Managed allocations include checkpoint/segment copies, without a new scalar total-memory or actual worker report. Optional C/R capture follows its separate contract above. Full effect draws, annotations, non-exact C/R likelihoods and CM/factor/specialized continuation remain gated.

Current covariance-mixture implementation

BayesCM, algorithm=“vbayes”, now uses the common bayesfit through bayes, mbayes, blr and mblr. Individual models require packed Glist. Joint missing outcomes select the existing published native algorithm. Complete single-trait packed CM prepares a memory-bounded dense Gram from the public HWE operator, because the native joint packed preparer requires T>=2. Its dense memory cost is explicit. Single-trait packed missing outcomes and dense X remain unqualified.

Individual default dictionary/residual scales follow the covariance-mixture rules below. Pi initializes dictionary weights, with updatePi=TRUE and updateE=FALSE by default. Explicit updateB, gamma, vb, nub and nue are rejected. UpdateE enables native diagonal EB (requiring diagonal initial ve), or full EB with explicit residualLearning for correlated residuals. Cross-products require explicit prior$covariance and ve. Exact EB needs yy; reference-LD and fixed-residual fits without yy use the existing native RSS method, with absolute ELBO unavailable when response scatter is absent.

Optimization has no chains, seed, burn-in or thinning. Explicit MCMC-only settings fail; the bridge supports one worker. Native sample-count normalization is n for individual CM, and other individual nuisance dimensions fail. Exact cross-products may declare an effective dimension >2 and <=n for a common residualized design. This is separate from C/R’s default n-1 normalization.

Common results expose native variational means/variances, optional component responsibilities/covariances, global nonzero probability and missing-outcome imputed values. Multivariate per-trait inclusion probabilities remain unavailable; they are not replaced by global activity. Native bound histories, EB accounting, stopping reason and changes are distinct from MCMC diagnostics. Missing-outcome augmented bounds and observed likelihood at fitted means retain separate labels. No effect draws, chain states, annotation or continuation are fabricated.

Current factor implementation

Mbayes now exposes bayesFA/bayesFR, algorithm=“mcmc”, over a prepared genotype Glist and ordered phenotype table. Native samplers and priors are unchanged. BayesFA constructs the additive relationship described below through installed gmat/gbits, once per fit, normalizing mean diagonal to one with no ridge or Glist$K. Save frequencies/exclusions/provenance; optionally retain the kernel. BayesFR preserves selected-training sample-SD coding and per-draw reconstructed total effects. Direct, marker-factor and loading activity remain separate; trait-total PIPs are unavailable. BayesFA does not invent marker effects.

Both retain native factor burn-in 1000, two chains/seeds 1,2 and serial execution. The initial adapter requires nit divisible by nthin, with exact completed post-burn multiples and no phase shift. Native final states are chain-specific but lack RNG state, so continuation stays unavailable. Retained invariant arrays and native G/R diagnostics are bounded/optional; no full-model mixing guarantee is inferred. FA prediction is stored-training-only, while FR prediction uses pooled or explicit-chain effect/intercept means and saved coding. Qualification bounds and paused MegaBayesC mixing failures below are unchanged.

Current scalar annotation implementation

Bayes and sbayes now expose bayesRC, algorithm=“mcmc”, through the existing native continuation-probit mixture sampler. Bayes requires finite complete individual outcomes and packed Glist; sbayes requires explicit representation=“block_eigen”, verified blocks and one common sample size. Cross-product BayesRC remains gated. Scalar individual BayesRC enables the component role; summary BayesRC also admits log-variance annotations.

Annotation design rows must match fitted marker order exactly. Native column centering preserves annotation units. Pi is normalized and sets zero-slope coefficient starts through continuation-probit intercepts; finite derived starts require strictly positive weights. Explicit pi and explicit coefficient starts conflict. With explicit starts and omitted pi, mean initial marker class probabilities provide nominal slab-scale calibration. Gaussian intercept prior means default to zero independently of pi; intercept/slope prior SDs default to one. Explicit proper native priors retain their original parameterization.

UpdatePi defaults TRUE and learns annotation coefficients; no global Dirichlet update or piMass prior is added. Individual updateB/updateE and their scalar priors retain the C/R defaults. Summary global updateE defaults FALSE and TRUE is rejected. Separate control\(blockResidual defaults to native all_mix; sample, mix and fixed are explicit alternatives. Nue (default four) and prior\)veScale (default (nue-2)/nue*ve) set learned block priors; both are unused and rejected with fixed blocks. Ve initializes all blocks. Block response scatter and likelihood dimension use retained coordinates, not a full-sample likelihood.

The common result separates posterior allocations, mean marker prior probabilities, coefficient priors/starts, pooled/per-chain coefficients and retained/final coefficient arrays. PIPs derive from posterior null allocation. Block posterior scale means are separately named. Annotation cadence counts total completed sweeps independently of the retention bridge. Parallel chain identity and observational capture reuse existing native execution. No public continuation or generic posterior-capture contract is enabled. Native annotation hypervariance learning and full sblr algorithm/output parity are not claimed.

Scalar C/R annotation source extension

Batch source 0.1.16 reuses the existing scalar native MCMC annotation engine through bayes/sbayes. This is implemented in source and awaiting the agreed batch build and runtime references; it is not verification against installed 0.1.15. No native solver or Rcpp signature changes are needed.

Use annotation\(inclusion for BayesC logistic active probabilities and annotation\)component for BayesR continuation-probit class priors. Both accept annotation\(variance, or annotation\)bayess for the same log-variance model using explicit marker-ordered allele frequencies. Variance and bayess are mutually exclusive. Designs are finite, exactly marker-ordered, centered without scaling, and have named columns excluding (Intercept). Component designs may have zero columns; variance/inclusion designs require columns.

For BayesC, updatePi continues to control baseline Beta learning while inclusion\(learn independently controls native MH slope updates. For BayesR component annotations, updatePi controls annotation coefficients and the native global Dirichlet flag is disabled; component\)learn is an alternative control, not a second simultaneous selector. piMass is rejected in that case. Omitted component intercept prior means/starts retain native pi-derived semantics, which differ from the common BayesRC zero-prior-center convention.

Variance$learn controls the native elliptical-slice relative-scale update; updateB controls global vb independently. The MAF specialization is q[j] = exp(S * (log(2p[j](1-p[j])) - mean(log(2p(1-p))))). Its exponent is on the fitted effect variance scale. No raw-dosage exponent or source/cohort frequency choice is inferred. The native numerical guards, proper coefficient priors and total-sweep cadence are preserved.

Role-labelled coefficient posterior means/variances, retained/final coefficient arrays and marker prior probabilities reuse common extraction. Prior activity probabilities are not posterior PIPs. Relative variance multipliers are native posterior mean exponentials, not exponentials of mean coefficients. Per-chain coefficient variances and multiplier summaries remain unavailable through this bridge. Summary per-chain component assignments are now carried through the existing R transport; native computation is unchanged.

Capture, continuation and saved gmap conversion are explicitly gated for the new common annotation configurations; so are joint C/R, variational annotation and fixed-informed BayesC-plus-annotation combinations. Ordinary C/R contracts and existing joint/scalar BayesRC behavior retain their prior boundaries. See ?scalar_annotations, tools/examples/gbayes/scalar-annotations.R and the source-ready section of the method matrix.

Joint individual annotation implementation

mbayes(method="bayesRC", algorithm="mcmc") reuses the existing packed joint BayesR sampler with pattern/component/variance annotations. Require complete finite outcomes, explicit trait-labelled SPD vb and ve, explicit activity-pattern pi, and at least one nonempty annotation$pattern or annotation$component design. Joint gamma contains positive scales only; null activity is represented once by the first pattern. prior$componentWeights sets positive-scale probabilities. Optional annotation$variance multiplies all positive scales and retains its independent learn flag.

Residual covariance is fixed: updateE=TRUE, nue and prior$veScale fail. Effect covariance learning retains the existing explicit nub/vbScale prior. updatePi defaults TRUE and learns supplied probit roles; omitted roles keep fixed global weights. No global Dirichlet update or pattern/component masses are admitted. Probit roles use updatePi, not a separate learn argument. Coefficient prior means default to zero independently of supplied weights; derived starts reproduce positive weights with zero slopes. Explicit starts retain native labelled coefficient/stick axes. Pattern prior probabilities include null; component prior probabilities condition on a nonnull pattern.

The common result exposes posterior patternProbabilities, unconditional positive componentProbabilities (rows sum to anyPip), and trait activity PIPs. annotationProbabilities, annotationCoefficients and coefficient variances are role-labelled lists; probit coefficients have coefficient/stick axes, while variance coefficients are named vectors. Retained/final arrays preserve chain axes and omit a stick axis for variance. Native coefficient diagnostics, update counts, actual workers, managed output-memory admission and save/reload retain existing meanings. Ordinary prediction uses saved training HWE coding and original outcome units. Posterior capture, continuation, cross-product RC and saved-fit gmap eligibility remain unavailable. Focused native parity and dense integration checks do not establish full-model mixing or real-data calibration.

Joint summary annotation implementation

msbayes(method="bayesRC", algorithm="mcmc") reuses the existing sparse joint summary sampler and the individual joint RC annotation resolver/result formatter. The same pattern/component/variance designs, positive scales, proper coefficient priors, initial-value mapping and updatePi semantics apply. Design rows use the ordered global marker union. Effect covariance can be fixed or learned with its existing explicit prior. Sampling/residual covariance is fixed: updateE=TRUE, nue, prior$veScale and sampling response-scatter learning inputs are rejected. No checkpoint or posterior-capture adapter is added.

Declare sampling$dependence. Shared-LD requires a single shared reference, complete common markers, common N across traits/markers and a fixed labelled SPD sampling$covariance (or ve, not both). Its separable sampling-error model is distinct from genetic covariance and from arbitrary GWAS overlap. Independent providers require positive study-named residual_variance; they may have different LD/N/local markers, with an explicit study-to-trait mapping for a reference catalog. Missing local markers contribute no likelihood; summary tables must cover their own reference. Multiple independent providers may target one trait; at least two effect traits remain required. Existing explicit variable-N policies and study sample-size admission are retained.

Effects use standardized marginal-summary coordinates, not the individual HWE-coded original-outcome units. The descriptor saves study maps, fixed sampling settings and resource identities. Role-labelled priors, posterior assignments, coefficient moments, retained/final arrays and save/reload match the individual joint route. Training coding/intercepts are unidentified, so ordinary prediction remains unavailable. The gscore summary handoff requires compatible caller-supplied coding/scaling. Saved-fit gmap mapping remains gated. Native parity and small independent Gaussian integration do not establish general calibration, full-model mixing or external-software parity.

Fixed marker-specific BayesC slab means

Scalar bayes and sbayes reuse native fit_informed_bayesc and fit_informed_bayesc_variational through method="bayesC" and algorithm="mcmc" or "vbayes". Supply scalar pi or named prior$markerInclusionProbability, and scalar vb or named prior$markerSlabVariance, plus explicit fixed ve. Supplying both scalar and marker forms of the same parameter is rejected. Optional named prior$slabMean defaults to zero. The prior is (1-pi[j]) * point_mass(0) + pi[j] * Normal(m[j], v[j]). Probabilities are active-slab probabilities strictly inside (0,1); slab variances are strictly positive absolute effect variances, not vb multipliers or spikes. Every supplied marker vector has unique names covering the full fitted domain and is aligned independently by name. Any marker field selects the fixed-prior route. Marker priors remain fixed; omitted update flags mean FALSE. Batch source 0.1.16 adds optional exact MCMC residual learning with updateE=TRUE; its builds/runtime tests are pending. VB retains fixed residual variance. See exact residual learning. The native unit global variance used to represent absolute marker variances is removed from public parameter summaries/traces. Fixed marker probabilities do not imply an estimated global mixture weight. Resolved priors stay in input$prior.

m must have exactly one finite, uniquely named entry per fitted marker. Individual means/effects use original phenotype units per saved training HWE dosage scale, selected-training frequencies and missing mean imputation. Summary means/effects use standardized phenotype per standardized reference counted-allele dosage and require one common N and the full sparse-LD domain. GWAS harmonization does not reorient the prior: supplied means must already match the fitted allele/units. No source model or transfer hierarchy is inferred.

MCMC shares ordinary chain retention controls and result formatting. VB uses a single whole-panel window, nit as its sweep cap, control$tolerance (1e-8 by default), and one worker. VB has no burn-in, thinning, chains or seed. PIPs mean non-spike activity; VB moments and PIPs belong to its product approximation. Objective endpoints omit the fixed likelihood baseline and include the nonzero-mean Gaussian KL. Convergence means a coordinate fixed point, not a global optimum or calibration under LD.

Both routes preserve common bayesfit extraction, save/reload and the gscore handoff. Individual prediction uses saved coding and intercept. No joint fit, covariates, annotation learning, block-eigen representation, scheduling, swaps, posterior capture, continuation or gmap conversion is enabled. Memory checks are lower-bound preflights/provider bounds, not total-process guarantees. Ordinary BayesC MCMC without any of these marker fields retains its defaults. BayesC/vbayes uses the fixed-prior contract, with optional zero means and one explicit scalar/vector choice for probability and slab variance, plus fixed ve. See ?informed_bayesC and the repository’s runnable tools/examples/gbayes/informed-bayesc.R RDS example.

Marker-specific Gaussian posterior means

bayes and sbayes expose method="marker_gaussian", algorithm="pcg". Require named finite prior$markerVariance (nonnegative, at least one positive) and optional named finite prior$markerMean (default zero). Both vectors align to all fitted markers by name; no scalar recycling or mean learning is implied. Zero variance fixes an effect at its supplied mean rather than removing its likelihood contribution. A shared Rcpp adapter uses s-C*m with the existing native marker-variance fitter and reconstructs b=m+delta. Zero means retain the original summary solve. All numerical solving stays in gbayes/gsolve.

Individual input is a prepared packed Glist and complete finite quantitative outcomes. The existing native provider estimates allele frequencies on selected training samples, imputes missing dosage at the training mean, and saves HWE centers/scales. Outcomes are centered without rescaling; effects and prior means use original outcome units per training-HWE-scaled genotype. ve is fixed and defaults to one on that outcome scale. Ordinary prediction includes the saved phenotype mean when requested. No dense genotype/cross-product matrix is made.

Summary input retains sparse LD, common N and standardized phenotype/genotype coordinates. Prior means already refer to the reference counted allele and the fitted units; GWAS allele harmonization does not flip these prior values. No raw-beta or phenotype-scale conversion is inferred. Ordinary summary prediction remains gated; the existing gscore handoff needs compatible explicit training coding/scaling. Joint Gaussian and exact-cross-product adapters remain separate work.

nit caps PCG iterations, control$tolerance retains the existing relative threshold, and ncores is one. Managed memory admission covers packed/LD and working vectors; it is not a process-memory ceiling. Diagnostics retain native prior-standardized deviation residuals and PCG applications, with the optional prior-mean product counted separately. Failed solves throw. MCMC settings, learning flags, h2/vb shortcuts, annotation/capture/continuation, posterior variances and PIPs are not exposed. Save/reload, effect axes and individual coding use the existing common result class and descriptor.

Current specialized summary MCMC implementation

Sbayes now exposes point_normal and continuous_shrinkage, algorithm=“mcmc”, over common-N summaries and sparse LD using the existing native engines. Logical chains share one immutable prepared reference and run serially; ncores>1 fails. Defaults resolve to nit=1000, nburn=500, nthin=1, nchains=2 and seed=1. Native RNG/full continuation states are unavailable; final effects are not restart checkpoints. Unsupported moments and diagnostics remain NULL with availability reasons, rather than being reconstructed by rerunning chains.

Point_normal defaults pi=.01 and h2=.5, slab variance h2/(p*pi) and unit likelihood residual variance. It averages native conditional expectations/PIPs over all postburn sweeps and therefore requires nthin=1. UpdateB/updatePi both default FALSE; both TRUE select the existing coupled 2020-style pi/h2 auto policy. Unequal flags fail. Its quadratic h2-scale update is not an independent variance draw or posterior heritability estimate. Control sparseEffects defaults FALSE, selects the native threshold approximation and cannot accompany auto updates. Storage may be memory or disk. No explicit prior, updateE, gamma, vb, ve, nub or nue applies. Captured native p/h2 paths expose descriptive diagnostics with fixed statuses when appropriate; effect second moments are unavailable.

Continuous_shrinkage requires memory LD and verified Glist blocks. Prior globalScale defaults one; updateB defaults FALSE and controls global-scale learning only. Local scales and residual scale always update; updateE=FALSE fails. H2/pi/gamma/vb/ve/nub/nue/updatePi are unsupported. The existing a=1,b=.5 hierarchy, local-scale cap and native update order are unchanged. Exact completed-multiple thinning uses the ordinary retention translation without changing final effects or total transitions, including remainder schedules. Means of local/global/residual scales are exposed; PIPs, effect variances and native parameter/effect traces are unavailable. No fake convergence diagnostics or posterior intervals are supplied.

Common advanced controls are retainDiagnostics, memoryLimit, storage and maxLdEntries. Shrinkage also accepts maximumBlockDimension and denseWorkspaceLimit; block offsets come only from verified Glist resources. Shared LD/cache payloads, all returned chains, transient copies and PN mandatory full paths are estimated before fitting. The native dense workspace receives the remaining managed budget. These are allocation estimates, not process RSS or a genome-wide performance claim. Remaining variational-engine migration and broader native qualification limits are unchanged.

Current specialized variational summary implementation

Sbayes now exposes variational and mixture_variational, algorithm=“vbayes”, over common-N summaries and sparse LD, with existing native fixed-prior mean-field optimizers. The four specialized summary-engine crosswalks are now resolved; remaining capture/continuation and qualification work is separate.

Variational defaults pi=.01 and h2=.5, both in (0,1], with slab variance h2/(p*pi), p markers and unit likelihood residual variance. Mixture_variational requires direct vb as absolute component variances, with at most one zero spike in any position; positive variances need not be ordered. Direct pi supplies strictly positive normalized weights, or defaults to uniform. A single Gaussian, mixtures without a spike and the all-zero point mass are valid native reductions. H2 does not calibrate explicit mixture scales. Gamma/ve/nub/nue are unsupported; vb is unsupported for the point-normal method. Prior is empty rather than a second nested spelling for these direct arguments. All learning defaults FALSE; explicit updateB/updateE/updatePi=FALSE is allowed and TRUE fails.

Nit defaults 1000 and caps sweeps per window. Controls are tolerance (1e-8), windows (one full-panel window), storage (memory or disk), maxLdEntries (1e7) and memoryLimit (256 MiB). Windows use ordered one-based inclusive ranges that cover every marker without gaps or duplicates; overlaps are allowed. Native global residual updates retain cross-window coupling. Each window is optimized once and must meet its coordinate tolerance, or inference raises an error. Multiple-window output is labelled windowed_approximation, not whole-panel convergence. The native whole-panel flag means a coordinate fixed point, not a global optimum or exact joint posterior.

Effect means, variational marginal variances and PIPs use marker-by-trait axes. PIPs equal one by definition without a spike. Correlated Gaussian means match the corresponding dense posterior solve, while mean-field variances are not exact joint posterior marginal variances. Only native initial/final objective endpoints are returned: relative mean-field bounds omitting the fixed log p(Y|b=0) baseline. There is no absolute ELBO or complete objective history. Responsibilities and parameter posterior estimates are unavailable. Final effects are the optimizer mean matrix, with no chain axis.

MCMC-only arguments must be NULL; ncores=1 is the sole optimizer worker setting. No chains, seeds, sampled draws, RNG states or MCMC diagnostics are fabricated. Memory preflight includes LD/cache payloads, native per-marker mixture prior/state replication and R/native copies before loading or fitting. Existing native disk window/page limits remain; managed estimates are not process-RSS ceilings. Annotations, generic posterior capture, continuation and summary prediction from unknown training coding remain unavailable. Native methods and scientific limits are unchanged; no new inference algorithm or broad qualification is implied.

Individual single-trait fitting

bayes(
  data, Glist=NULL, trait=NULL, X=NULL,
  method="bayesR", algorithm=NULL,
  nit=1000, nburn=NULL, nthin=NULL,
  nchains=NULL, ncores=1, seed=NULL,
  h2=NULL, pi=NULL, gamma=NULL,
  vb=NULL, ve=NULL, nub=NULL, nue=NULL,
  updateB=NULL, updateE=NULL, updatePi=NULL,
  prior=list(), control=list(),
  annotation=NULL, posterior=list(), continuation=NULL,
  verbose=FALSE
)

Single-trait marginal summaries

sbayes(
  stat, Glist, trait=NULL,
  method="bayesR", algorithm=NULL,
  representation="sparse",
  nit=1000, nburn=NULL, nthin=NULL,
  nchains=NULL, ncores=1, seed=NULL,
  h2=NULL, pi=NULL, gamma=NULL,
  vb=NULL, ve=NULL, nub=NULL, nue=NULL,
  updateB=NULL, updateE=NULL, updatePi=NULL,
  prior=list(), control=list(),
  annotation=NULL, posterior=list(), continuation=NULL,
  verbose=FALSE
)

Single-response cross-products

blr(
  XX, Xy, yy=NULL, n,
  method="bayesR", algorithm=NULL,
  likelihood="exact", coding=NULL,
  nit=1000, nburn=NULL, nthin=NULL,
  nchains=NULL, ncores=1, seed=NULL,
  h2=NULL, pi=NULL, gamma=NULL,
  vb=NULL, ve=NULL, nub=NULL, nue=NULL,
  updateB=NULL, updateE=NULL, updatePi=NULL,
  prior=list(), control=list(),
  posterior=list(), continuation=NULL,
  verbose=FALSE
)

Individual joint multivariate fitting

mbayes(
  data, Glist=NULL, trait=NULL, X=NULL,
  method="bayesR", algorithm=NULL,
  nit=1000, nburn=NULL, nthin=NULL,
  nchains=NULL, ncores=1, seed=NULL,
  h2=NULL, pi=NULL, gamma=NULL,
  vb=NULL, ve=NULL, nub=NULL, nue=NULL,
  updateB=NULL, updateE=NULL, updatePi=NULL,
  prior=list(), control=list(),
  annotation=NULL, posterior=list(), continuation=NULL,
  verbose=FALSE
)

Joint multivariate marginal summaries

msbayes(
  stat, Glist, sampling=NULL, trait=NULL,
  method="bayesR", algorithm=NULL,
  representation="sparse",
  nit=1000, nburn=NULL, nthin=NULL,
  nchains=NULL, ncores=1, seed=NULL,
  pi=NULL, gamma=NULL,
  vb=NULL, ve=NULL, nub=NULL, nue=NULL,
  updateB=NULL, updateE=NULL, updatePi=NULL,
  prior=list(), control=list(),
  annotation=NULL, posterior=list(), continuation=NULL,
  verbose=FALSE
)

Multivariate cross-products

mblr(
  XX, Xy, yy=NULL, n,
  method="bayesR", algorithm=NULL,
  likelihood="exact", coding=NULL,
  nit=1000, nburn=NULL, nthin=NULL,
  nchains=NULL, ncores=1, seed=NULL,
  h2=NULL, pi=NULL, gamma=NULL,
  vb=NULL, ve=NULL, nub=NULL, nue=NULL,
  updateB=NULL, updateE=NULL, updatePi=NULL,
  prior=list(), control=list(),
  posterior=list(), continuation=NULL,
  verbose=FALSE
)

NULL resolves the documented model-specific default; an explicit unsupported value fails. Direct arguments have no competing aliases in control or prior. Capture original call spellings before R partial matching; reject abbreviated and duplicate argument names. Prior owns additional scientific structure; control owns advanced numerical, memory, retention and diagnostic options. Annotation, posterior capture and continuation remain method-specific: their presence in a signature does not enable them for every method.

Inputs and likelihoods

Individual data are ordinary phenotype tables with unique character id and numeric trait columns. Select exactly one trait for bayes and at least two for mbayes. With trait omitted, select all non-id columns and validate the resulting trait count. Exactly one genotype source is allowed: Glist or labelled dense X. Align by unique sample IDs and record reordering. Do not silently intersect IDs or markers. Trait order is explicit and retained throughout.

Missing outcomes use only qualified native method/likelihood routes. Do not silently remove incomplete rows, impute outcomes generically or loop over independent traits to enable an unsupported joint model. External covariate adjustment and its likelihood dimension must be declared; arbitrary fixed-effect estimation is not introduced.

Sbayes consumes one checked marginal-summary table. Msbayes consumes ordered trait/study inputs with an explicit sampling declaration. Independent providers may have different marker subsets and LD resources; absent markers contribute no likelihood information. Shared-LD correlated summaries require their supported common design and justified sampling-error covariance. Genetic covariance, overlap counts and sampling-error covariance are distinct quantities. Existing provider and overlap restrictions remain.

For blr/mblr, XX is a labelled feature cross-product; Xy is respectively a vector or feature-by-trait matrix, and yy a scalar or trait-by-trait response scatter. Exact fitting requires compatible yy, sample count, units, preprocessing and likelihood dimension. Coding records training transformations, allele identities where genomic, and nuisance projection information. It is required for operations that need those quantities. Cross-products alone do not identify training means or alleles. Unknown normalization cannot enable residual learning.

Reference-LD cross-products are available only for the existing bayesCM RSS approximation with likelihood=“reference_ld” and explicit scales. Residual covariance stays fixed. Marginal coefficients are never treated as Xy. Exact common-design statistics do not cover arbitrary missing outcomes or different trait-specific nuisance projections.

Methods and algorithms

Use the current four-interface matrix for the complete accepted method/algorithm combinations and the separate native adapter gaps. The exact cross-product companions blr/mblr retain BayesC/BayesR MCMC and BayesCM VB, with their own likelihood and normalization contracts.

Algorithm=NULL selects the method default. Sparse versus block-eigen LD is a representation choice. No EM, MCMC bayesCM, variational factor model or unrestricted method/algorithm product is introduced. Internal native route names need not change. Bayesian YAML is not part of the new public fitting workflow.

Existing specialized summary engines belong under sbayes: point_normal and continuous_shrinkage use MCMC; variational and mixture_variational use their existing variational algorithms. All four argument/output crosswalks are resolved above, retaining their distinct native scientific meanings. Keep gbayes_single_effect as a separate deterministic helper. Native mapping and other consumer APIs do not automatically become methods of these six functions. The explicit msbayes IBSS routes reuse the installed native engines and preserve their distinct sampling and probability contracts.

Familiar statistical arguments and defaults

These are target design defaults, distinct from current dispatcher defaults. Initialization, hyperprior information and posterior estimates are recorded separately. A working h2 value is not estimated heritability.

Scalar BayesC and BayesR

Argument BayesC BayesR
h2 .5 for supported initialization .5 for supported initialization
pi .001 active probability c(.95,.02,.02,.01), including null
gamma Not applicable c(0,.01,.1,1), variance multipliers
vb, ve Calibrated on the declared input scale if omitted Same
nub, nue 4, greater than 2 4, greater than 2
updateB TRUE, slab-variance learning TRUE, base slab-variance learning
updateE TRUE where the residual policy permits Same
updatePi TRUE, active-probability learning TRUE, mixture-weight learning

Automatic vb/ve calibration must match an explicit native prior on the actual input scale. Preserve response scale and distinguish slab variance, realised genetic variance and residual variance. Explicit h2 cannot conflict with an initialization it would otherwise determine. The per-route calibration and normalization crosswalk is an implementation gate; standardized-summary formulas must not be reused for raw features. Learning requires proper corresponding priors.

Joint BayesC and BayesR

Argument Joint contract and default
h2 Unsupported as a shortcut for these full covariance models
vb Explicit labelled covariance of latent base marker effects
ve Explicit residual covariance where supported; sampling declarations govern summaries
pi Explicit probabilities aligned to the declared activity-pattern set
gamma BayesC has positive scale 1; BayesR defaults to c(.01,.1,1)
nub, nue Explicit covariance-prior degrees of freedom when learning
updateB, updateE, updatePi FALSE by default; opt in with required priors and sufficient statistics

Prior declares activity patterns, covariance-prior scale matrices and separate positive-scale weights. BayesR scale weights default to uniform if omitted. Do not expand a scalar pi into an unspecified multivariate prior. Proper inverse-Wishart degrees of freedom exceed T-1; scalar nub/nue=4 is not reused for arbitrary T. Scale matrices must satisfy the native labelled SPD contract.

Supported common-sample individual/exact-statistic routes may learn residual covariance. Independent marginal summaries do not identify that full covariance. Learning a shared sampling-error covariance requires its existing exact response scatter and likelihood dimension; marginal GWAS statistics alone are insufficient.

Covariance mixtures and factor models

Method Applicable familiar settings
bayesCM h2=.5 for the default individual-data dictionary; pi initializes dictionary weights, uniform if omitted; ve is residual covariance; updatePi=TRUE; updateE=FALSE; updateB, gamma, vb, nub and nue are unsupported
bayesFA Scalar statistical arguments and the three generic learning switches are unsupported; explicit factor/grid prior settings apply
bayesFR updateB=TRUE for all marker-factor/direct/loading slab variances; updatePi=TRUE for their inclusion probabilities; updateE=TRUE for both trait and factor noise variances; other scalar settings remain structured in prior

For bayesCM, with observed fitting trait variances v, p fitted markers and h=h2, the default dictionary contains zero, diag(hv/p), and the outer product of sqrt(hv/p). Omit the duplicate shared component for one trait. Default residual covariance is fixed diag((1-h)*v). Insufficient/nonvarying traits require explicit covariances. Dictionary matrices are fixed; updateB does not enable covariance discovery. UpdateE=TRUE selects supported diagonal EB; full EB needs an explicit supported choice. RSS requires explicit dictionary and residual covariance.

Both factor models retain two factors and existing native priors by default. BayesFR loading-order shrinkage still updates when updateB=FALSE; that switch does not freeze the entire hierarchy.

Multiple components and BayesRC

Scalar BayesR accepts an arbitrary supported number of gamma/pi classes, not a hard-coded four-class model. Gamma has one null scale followed by increasing positive variance multipliers; pi is normalized and aligned. Starting weights and their learning prior are separate inputs.

Joint BayesR retains the existing factorized activity-pattern by positive-scale target. One null activity pattern has mass Pi(0); a non-null state (delta,k) has mass Pi(delta)*omega(k). This is not an unrestricted joint simplex. Gamma contains positive scales, pi describes patterns, and prior declares the separate magnitude weights. Complete enumeration grows as 2^T. Restricted patterns change the model; they must be explicit. Check native dimensions and memory before enumeration or markerwise output allocation.

BayesCM components are covariance matrices. Mixture classes, factor counts, marker partitions and multiple relationship kernels are distinct concepts. Extra mixture classes do not enable additional variance components or kernels.

Use method=“bayesRC” in bayes, mbayes and sbayes. The latter is SBayesRC: the function already identifies the summary likelihood. An aligned annotation design enters through annotation, for example annotation=list(component=list(design=A)). Annotations may overlap; a design is not automatically a hard partition.

BayesRC uses gamma-defined variance classes and annotation-dependent marker component probabilities. Preserve the existing supported probit-stick model, proper coefficient/intercept priors, preprocessing and native parameterization. Pi supplies only a documented initialization, not informative coefficient-prior information. UpdatePi controls annotation probability learning; it must not add an ordinary global Dirichlet update. Record coefficient starts, priors and posterior allocations separately. Pi initialization and explicit coefficient starts require unambiguous precedence or a conflict error.

Scalar bayesRC uses the BayesR gamma ladder and scale initialization defaults, with updatePi=TRUE for supported annotation learning. Coefficient/intercept priors retain the native parameterization; their exact initial-value mapping is resolved in the current scalar annotation implementation above. Individual-data updateE follows its supported residual policy. For the initial summary route, explicitly select representation=“block_eigen”.

The initial SBayesRC route retains verified block-eigen requirements and its block residual policy. Its backend rejects global residual-variance learning: do not inherit scalar global updateE=TRUE here. The design baseline keeps that global flag FALSE and records block-scale controls separately. Final flag-to-block policy mapping is the separate blockResidual/nue/veScale contract above.

The joint individual contract above separates annotation-dependent pattern probabilities, conditional positive magnitudes and latent covariance learning. The summary extension preserves the explicit sampling contract above; cross-product promotion still needs its own checks. Arbitrary covariance-template/annotation combinations and independent group-by-component variance learning are not implied.

Glist and internal relationship construction

Glist remains the existing gbase resource descriptor. Preserve file identities, physical selections, sample/marker IDs, counted alleles, coordinates, prepared LD/block identities and preparation provenance. Fitting neither rewrites BED nor mutates Glist. Resource ordering remains its existing contract; fit-specific maps record analysis reordering.

Individual methods consume selected genotypes. Summary methods consume prepared LD and metadata. Blr/mblr require no Glist. Genotype, phenotype and effect scales remain explicit: HWE and sample-SD/raw routes are not silently interchanged. Imputation/scaling learned on fitting samples is saved for prediction; held-out samples never redefine training coding.

There is no public K argument and no Glist$K resource. For mbayes(method=“bayesFA”), construct one additive relationship internally from the declared fitting genotypes. Glist stays genotype-backed. Outcome missingness does not separately redefine the allele-frequency sample set for each trait.

For dosage g and fitting-sample allele frequency p, use

\[ W_{ij}=g_{ij}-2p_j,\qquad K_0=\frac{WW^{\mathsf T}}{\sum_j2p_j(1-p_j)},\qquad K=\frac{K_0}{\operatorname{tr}(K_0)/n}. \]

Mean-imputed genotypes contribute zero centered dosage. Exclude/report estimated monomorphic markers; reject all-missing markers and nonpositive normalization. Explicitly select additive coding in the existing gmat primitive. Validate finite symmetry and the existing bounded PSD checks. Apply no hidden ridge or changed kernel definition. The final mean diagonal is one, as required by the current factor backend.

Construct once per fit, share immutably across chains, and preflight the dense quadratic storage. Save sample/marker selections, training frequencies, informative-marker count, normalization and construction provenance. Do not attach the derived kernel to Glist or retain a second decoded genotype matrix. The fit records its derivation; the full kernel need not be saved by default.

This changes preparation only. New-sample cross-kernel prediction, other kernel types and multiple relationship kernels remain outside the currently qualified factor route.

Resolved specification and ownership

Resolve and save one checked specification: interface, single/joint analysis, method, algorithm, likelihood, identities, coding, priors, learning policies, execution, retention, output requests and resource bounds.

The task R package owns public validation, normalization, orchestration and formatting. Bayesian inference remains native gbayes; generic genotype/kernel operations remain gmat/gbits; solves and eigensystems remain gsolve. Gbase owns task-neutral Glist and must not depend on gbayes or root gsuite. Use installed public interfaces. Shared adapters do not duplicate samplers or import sblr at runtime.

Validate argument names, supported combinations, units, identity alignment, prior constraints and memory before native execution. Independent native numerical/allocation guards remain. A manual capability table must not override executable dispatch and contract tests.

Common fit and scientific access

All six fitters return a serializable object inheriting from bayesfit. One versioned result boundary validates structural fields, ordered marker/trait axes, final-effect axes and logical-chain identities after method-specific formatting. It fills availability reasons for unsupported stored quantities without manufacturing values or changing native numerical output. Provenance records the gbayes/gbase R versions, R/platform and existing native version metadata. Factor prediction availability explicitly distinguishes stored-training FA summaries from saved-coding FR prediction; native prediction limits remain.

The target R schema starts at input$schemaVersion=1. This identifies the R specification/result contract, separately from native ABI and source-schema versions. Store the execution seed and retention policies by name and version; a schema version must never imply that a numerical method has been qualified.

Field Contract
input Complete resolved model and execution specification
data Ordered identities, scales, masks, alignment and resource descriptions
posterior Available posterior or explicitly approximate variational summaries
draws Requested retained MCMC arrays, otherwise NULL
final Per-chain final states or final variational state
diagnostics Numerical, execution, convergence and advisory information
availability Available quantities and reasons for unavailable values
provenance Schema/software versions, source identities and preparation history

Structural fields remain present with NULL where appropriate. Model-specific quantities appear only where defined. Availability follows the resolved model and actual results; it does not manufacture quantities to fill a schema.

Effect means have marker-by-trait dimensions. Covariance summaries preserve labelled trait axes. Effect draws have draw-by-chain-by-marker-by-trait axes; final arrays preserve chain axes. Keep size-one axes, including one trait, marker, draw or chain. Store retained indices and effect units.

Separate latent base effects, realised effects, activity, magnitude classes, pattern probabilities, annotation prior probabilities, posterior allocations and PIPs. Genetic, latent-effect and sampling-error covariances retain their meanings. BayesFR total effects are reconstructed per draw before summaries or prediction, not by multiplying separate posterior means. Keep marker-factor, loading and direct activity separate. BayesFA does not invent marker effects. Variational fits do not invent MCMC draws, chains, ESS or R-hat.

The scientific access interface is

coef(fit)
extract(fit, quantity="effects")
extract(fit, quantity="pips")
summary(fit, quantity="effects")
diagnostics(fit)
predict(fit, ...)

Extraction retrieves stored quantities and preserves axes; summarization owns aggregation. Final-state access is explicit. Summaries identify contributing chains; pooled retained-draw results keep warnings and chain-specific access. Failed chains are not automatically dropped. Shared generic ownership must respect package boundaries; gbayes can initially own namespaced access functions without adding task computation to gbase.

An unavailable quantity returns NULL with an availability reason. Unsupported prediction errors clearly. Distinguish training phenotype fits from genotype-only prediction. Reuse saved fitting transformations and check target identities and alleles. Serialized fits have no live pointers or open handles; later resource operations still validate their external files.

Execution and multiple chains

Methods nit Effective nburn Effective nthin Effective nchains Effective seed
bayesC, bayesR, scalar bayesRC 1000 post-burn transitions 500 1 2 1
point_normal, continuous_shrinkage 1000 post-burn transitions 500 1 2 1
bayesCM 1000 maximum optimization sweeps Not applicable Not applicable Not applicable Not applicable
variational, mixture_variational 1000 maximum sweeps per window Not applicable Not applicable Not applicable Not applicable
bayesFA, bayesFR 1000 post-burn transitions 1000 1 2 1

Ncores defaults to one. Explicit MCMC-only arguments fail for vbayes. Multiple optimization starts are not chains and are outside this target.

Nchains counts logical chains; ncores requests workers. Multiple chains may run serially. Prepared resources are immutable and shared. State, RNG, residuals, workspaces, accumulators and traces are chain-private. A multivariate chain samples the entire joint model; traits are not independent tasks. Worker threads do not call R APIs or allocate R objects.

Preserve native RNG behavior during interface-only changes. Initially map the starting uint32 seed to consecutive distinct chain seeds, reject overflow and record requested/resolved seeds. A hashed task-seed scheme would need a separate versioned decision. Logical chain identity, never worker assignment, owns its seed. On qualified backends/builds, changing supported worker scheduling must preserve each logical chain’s scientific output. Cross-library/platform random stream identity is not promised.

For post-burn u=1,…,nit, retain u modulo nthin equal to zero and save the exact indices. Complete all requested transitions, including a remainder. A backend unable to honor the schedule must reject it rather than round or shorten nit. Remove burn-in once. The initial factor adapter may require divisibility until the exact full-schedule boundary is qualified.

Expose only qualified parallel execution. Validate ncores>1 support and report requested workers and actual execution; do not silently claim parallel execution after falling back. Existing serial factor routes do not gain parallelism from a signature change. The specialized summary MCMC adapters are likewise serial. Point-normal has no native thinning API and explicitly requires nthin=1.

Diagnostics and resource accounting

Diagnostic capture, posterior thinning, compact chain records and retained trace arrays are separate policies. Capture occurs at completed transitions, consumes no RNG and cannot change updates, rerun chains or feed back into inference. Report the actual available diagnostic schedule. Do not imply that unthinned native traces exist where they do not.

MCMC diagnostics include applicable rank-normalized split/folded R-hat, ESS and MCSE, with explicit constant/fixed/unavailable/unrequested statuses. One chain provides no between-chain R-hat evidence. Factor diagnostics emphasize invariant effects, covariance and predictions rather than uninterpretable pooled loading means. Sampling completion, adequate mixing, numerical correctness and calibration are distinct claims.

Variational diagnostics record objective definition, iteration count, stopping reason, parameter changes and EB updates. An augmented missing-outcome bound is labelled separately from observed-data likelihood. Hitting nit is not a convergence certificate.

Preflight counts shared packed/LD/kernel resources, all chain workspaces, output, diagnostic traces and transient R/native copies. An estimated allocation ceiling is not measured process RSS. Pass through solve, factorization, update, decode/ packed-product and preparation counters where available. Unknown counters stay unavailable. Separate preparation, fitting and formatting time where measurable.

All-marker draw/diagnostic storage is opt-in and bounded. Diagnostic defaults and retention requests need a capability-checked mapping to current backends; this design does not authorize a new generic trace subsystem.

Qualification and implementation gates

Resolve the following against current native contracts before enabling the corresponding target. They do not reopen the six-function naming decision.

Gate Required outcome
Per-route defaults Exact initialization, hyperprior scale, likelihood dimension and learning behavior; explicit/default equivalence
BayesRC initialization and residual policy Resolved for scalar individual/block-eigen routes above; preserve independent coefficient priors and separate block-scale mapping
Multivariate BayesRC Individual and sparse-summary fixed-residual routes expose separate pattern/positive-magnitude annotations; cross-product remains gated
Specialized summaries Resolved above for both existing MCMC and both fixed-prior variational engines; preserve distinct scales, windows and availability
Additional cross-product methods Extend the qualified exact C/R adapter only after method-specific scale, response-scatter and prediction checks
Internal additive kernel Selected-genotype dense references, normalization, multi-file ordering and factor input invariants
Execution and diagnostics Actual capture/retention availability, RNG preservation and supported worker behavior

Existing factor limits remain n<=256, T<=128, q<=16, and bayesFR p<=4096. Packed factor support is resident; relationship storage is quadratic in samples. Multiple kernels, arbitrary fixed covariates, generic overlap, broad calibration and genome-wide factor performance are not qualified. Recorded full-model MegaBayesC mixing failures remain unresolved and paused. New names and common summaries do not repair them. Additional annotation-dependent sharing/covariance models beyond the documented joint pattern/magnitude/variance model and extra variance components are outside scope.

Bounded implementation sequence and acceptance

Beyond the authorized individual slice, implementation requires a separate user instruction. Use existing public native APIs and independent references in this sequence.

Work Focused acceptance
Resolved specifications and six adapters Exact names, dimensions and supported combinations; explicit/default mapping; no compatibility branch
Common result and access Correct meanings, labels, size-one axes and NULL reasons; final versus posterior; serialization and prediction gates
Resources and internal kernel Sample/marker selection, alleles, training imputation and kernel entries/normalization versus independent dense references
Chain and diagnostic integration Per-chain replay, exact retained indices, observational capture, qualified serial/parallel equivalence and bounded allocation rejection
Route promotion Small installed-package fixtures and existing native references; fresh pinned parity when a numerical/prior change warrants it

Keep tests deterministic and focused. Preserve tolerances, independent dense references, pinned-software provenance and installed-consumer checks. API identity cannot replace an independent numerical oracle. Broad simulations, performance campaigns, sampler development, releases, commits and pushes are not authorized by this design task.

Scalar Gaussian co-data with frozen design coding

Development version 0.1.16 adds bayes(method="marker_gaussian", algorithm="gaussian", X=..., ve=..., prior=list(coData=...)). R validates labels, complete scalar outcomes, group coverage and explicit options; gbayes::fit_gaussian_co_data owns all moment equations, hyper-ridge learning and final Gaussian fitting. No new native algorithm or sibling source change is needed. The direct Gaussian algorithm has its own contract; existing marker_gaussian/pcg behavior is unchanged.

X may be a finite labelled numeric matrix or dgCMatrix. The model is y = Z beta + noise, Z[,j] = (X[,j]-center[j])/scale[j]. Saved control$coding supplies named centers/scales (defaults zero/one). Outcomes are reordered by ID and otherwise unchanged. There is no inferred intercept, centering, nuisance projection or imputation. Effects have outcome units per transformed feature unit, not automatically HWE or standardized-phenotype units.

prior$coData contains a single named, fully covering, possibly overlapping groups list, group-set id, positive globalVariance (default 1), required positive hyperLambda, globalMode (fixed or known_noise_ml), positive varianceBounds, normalize, rhs (ecpc_2_positive_part or gaussian_unbiased) and profile (ecpc_2_full or target_one). One native update learns clipped group multipliers and averages them across each feature’s memberships. Optional normalization sets mean feature variance to the global variance. An unnormalized all-zero profile records ordinary-ridge fallback; normalizing an all-zero profile fails. Known-noise ML estimates the initial shared variance within supplied bounds, not residual variance. A nonconverged search fails without returning an accepted bayesfit. This is the native exact Gaussian profile, not complete ecpc software reproduction or a global ML certificate.

diagnostics(fit)$coData records learned feature variances, raw/clipped/used multipliers, moment equations, hyper-ridge profile, normalization/fallback, ML evaluations/boundary and factor/solve/materialization counts. Its samplingVariance is the sampling variance of the fitted mean at a frozen learned prior. It is not placed in posterior effectVariance. PIPs, posterior variances, hyperparameter uncertainty, chains, continuation and mapping remain unavailable. Native prediction uses saved transforms and complete fitted feature order; genetic/phenotype predictions agree because no intercept is fitted. Serializable results retain no original X or live native design.

Controls admit the dense dual n-by-n workspace and group-by-group equations before CSC copying/fitting: memoryLimit (64 MiB), maxRows (2048), maxGroups (256), and ML maximumEvaluations/maximumIterations/precisionBits. ncores must be one; nit does not control this direct fit. Numeric admission includes conservative bridge allowances; it is not an RSS cap or large-cohort throughput qualification. Supplied-fold CV, joint/summary adapters and general gscore selection remain separate; optional initial noise learning is described below. Focused developer reference checks pass in gbayes 0.1.16. Focused developer tests pass; this does not establish large-cohort qualification.

Multiple annotation group sets

The same scalar marker_gaussian/gaussian route now accepts prior$coData$sets=list(A=groupsA, B=groupsB) instead of groups/id, using native fit_gaussian_co_data_multi. Each named set must independently cover all fitted features. Overlap counts are normalized within its own set; group names can repeat across sets. These are annotations on one Gaussian response, not additional traits, cohorts or independent candidate models.

hyperLambda is an unnamed positive scalar shared across sets or a complete positive set-named vector. Group normalize and normalizeSets are distinct booleans. weightRule selects ecpc_2_switch (default), nonnegative or unconstrained_then_clip. The native switch tries normal equations and clips negatives, using NNLS after numerical failure or near-collinear feature profiles. Single-set weights stay one; all-unit profiles use equal weights. A one-group set uses the native fixed-unit group rule and skips hypershrinkage. The original groups adapter retains its generic profile, including its one-group behavior. Global variance selection is shared once; noise and per-set hyperpenalties remain fixed. The combined variance is t times the sum of weighted within-set feature profiles. Set normalization is post-fit scaling, not a constrained sum-to-one fit.

control$maxSets defaults to 16; maxGroups bounds total groups. Optional control$setWeights records native similarity/rank/NNLS tolerance and work limits (see package help). Whole-call native memory admission covers all stage bounds, plus conservative bridge/output allowances. Group, cross and final Gaussian counts are retained separately from set-weight normal/NNLS work. The diagnostic groupFits are named by set; setWeights retains raw/used weights, route, profile cosines, reduced equations, normal rank and NNLS KKT/work fields. Cross moments retain flattened set/group labels and native zero-based offsets. NNLS KKT fields describe raw weights before normalization, and unused route fields have no certificate meaning. Weights can be nonunique for dependent profiles and are prior-variance multipliers, not posterior/sharing probabilities.

A zero per-set fallback returns an explicit unidentified_source_profile failure with set identity when multiple sets are combined. Failed set solvers and ML searches return no accepted fit. Frozen coding, prediction, save/reload, units and unavailable posterior uncertainty are unchanged. Automatic group tuning is now source-ready below; patient CV and joint/summary co-data remain separate; initial noise learning is now source-ready below. Focused developer reference checks pass in gbayes 0.1.16. Focused references pass in the 0.1.16 developer checkpoint.

Saved feature-group split tuning

In development version 0.1.16, hyperLambda=0 requests native automatic group-penalty tuning through the same scalar marker_gaussian/gaussian adapter. Positive values keep fixed penalties; omission is still an error. Zero does not fit an unpenalized group equation. Noise is frozen during group fitting. Existing fixed/ known-noise modes are unchanged; optional initial joint ML is described below.

For groups, supply coData$splits as a nonempty named list of saved pairs: list(first=list(inside=list(left="u",right="v"), outside=list(left="v",right="w"))). Each half names every group and contains feature IDs from that group. The two halves must partition its full membership exactly; empty halves use character(0). Names are preserved and groups aligned by name. No splits are generated randomly. For sets, the outer splits list names exactly the automatically tuned sets, with those same per-set pair lists. Positive/zero set-named penalties can be mixed. Native one-group sets keep their unit profile and skip tuning even for zero penalties; fixed and skipped sets must not receive unused splits.

Native fitting retains full group denominators and within-set target overlap weights when computing split row equations. It builds inside-split ridge paths, sets lower=min(terminal path penalties)/100 and upper=max(first path penalties), then searches log(lambda) using the mean outside-equation RSS and raw, unclipped split-profile gamma. The split profile is ecpc_2_split; the final full fit still uses the declared full profile. The first path point has source deviance zero and the infinite-penalty convention, not a finite fit at that displayed value. This preserves the native exact-equation procedure and qualification limits.

control$tuning exposes native path count/minimum steps, minimum ratio, deviance and improvement stopping, double or archived Fortran-exponent spacing, and hyper-search evaluations/iterations/precision. These are distinct from global ML controls and set-weight solver controls; unused tuning controls are rejected. control$maxSplits defaults to 32 across all sets. Native planners and bridge allowances include retained split equations, paths and serialized output copies.

Saved input retains splits and resolved controls. Diagnostics expose tuning status, bounds, selected lambda, named paths/split equations, actual evaluations, boundary and factor/solve counts, at the top level for groups or under each named groupFits entry for sets. Exhaustion returns no accepted fit, identifying the set for a multi-set failure. Degenerate equations fail explicitly without inventing replacement splits. Prediction/save/reload do not retune, and effect units, coding, no-intercept semantics and unavailable posterior uncertainty stay unchanged. Bounded search is not a global-optimum certificate for arbitrary curves.

These are feature-group equation splits, not patient CV. All equations still use the supplied training outcomes. Keep held-out patients out of fitting; general patient-fold selection/refitting remains in gscore. Patient CV and joint/summary co-data remain separate; initial noise learning is now source-ready below. Focused developer reference checks pass in gbayes 0.1.16. Focused independent references pass in the 0.1.16 developer checkpoint.

Residual variance learning in scalar co-data

Pending 0.1.16 source adds the existing native joint_noise_ml profile to single-/multiple-set co-data. Use coData$globalMode="joint_noise_ml" and explicit varianceRatioBounds=c(.01,100), omitting ve. Supplied ve, globalVariance and varianceBounds are rejected in this mode rather than ignored. Existing fixed and known-noise modes still require positive ve. The method/algorithm remain marker_gaussian/gaussian; top-level updateE is not an alternative selector.

Native fitting first estimates y ~ N(0, s I + t Z Z’) on the saved transformed design. It searches log(r=s/t) within the closed supplied bounds, profiling s=y’(I+ZZ’/r)^(-1)y/n and t=s/r and checking endpoints. The objective is the full normalized Gaussian marginal negative log likelihood. This is zero-mean ML, not REML or an intercept/nuisance fit. Ratio bounds follow supplied feature units; they do not bound the two variances separately. The existing top-level global search controls govern this stage; tuning and setWeights controls retain their separate roles.

The learned residual/global pair is fixed before group moments, split tuning, set weighting and the final fit. All annotation sets receive the same pair, with no per-set or subsequent residual refit. The final annotated prior is not necessarily the initial global variance. Actual residual/global values, estimated flags, ratio and search objective/status/boundary are saved; per-set flags are FALSE. input\(varianceLearning and the common descriptor record the one-time stage and actual likelihood variance, with resolved learning\)updateE=TRUE. Gaussian counts include native profile evaluations, identification and its intermediate ordinary-Gaussian fit; no extra profile is run to create diagnostics.

Native identification rejects zero outcomes, zero designs and transformed Gram matrices proportional to identity at its 64-epsilon shape threshold. Nearly unidentified profiles can remain broad. The assembly does not expose that primitive shape statistic, and R does not recompute it. Quota exhaustion returns no accepted fit. Native numeric admission and dense-dual limitations remain. This bounded profile is not an unrestricted global certificate or full original ecpc optimizer reproduction.

Residual variance uses outcome-squared units; effects/global coefficient prior retain supplied transformed-feature units. No centering, intercept, probability or posterior-uncertainty interpretation changes. Saved prediction never uses target outcomes or re-estimates variances. Sampling variance remains a frozen- parameter estimator diagnostic. Patient CV and joint/summary co-data are still separate. Focused developer reference checks pass in gbayes 0.1.16. Focused references pass in the 0.1.16 developer checkpoint.

Supplied-fold co-data initialization with gscore selection

Development gbayes 0.1.16 adds public co_data_cv_statistics; gscore 0.1.2 adds co_data_cv. Selection and refit orchestration stay in gscore. All fold, variance-profile and final annotation fitting stay in gbayes, using the existing native Gaussian ridge CV primitive and scalar co-data fitters. No solver, sampler, task-neutral computation or second selector framework is introduced. The new explicit R workflow dependency is optional gscore -> gbayes; gbayes does not depend on root gsuite or call gscore for fitting.

The selected target is the ordinary-ridge initial ratio, not CV of the final annotated empirical-Bayes model. Supply complete scalar outer-training data, labelled real/CSC X, sample-named integer patient folds exhausting 1:F, and positive unique candidate penalties. Optional patient clusters cannot cross folds; they govern splitting, not loss weights or residual covariance. Frozen external coding must be declared with cvControl$preprocessing=“externally_frozen”. Neither package learns fold-specific transforms or accepts outer test outcomes. Caller preprocessing provenance cannot be verified automatically.

The native normal_equation_ratio profile uses each candidate directly. The separate glmnet_4_1_1_gaussian profile uses n_train*lambda/RMS(y_train), with zero intercept/feature standardization and native rejection of nonzero constant training columns. Fold losses are SSE and row-weighted MSE including unequal fold sizes; optional OOF predictions are tuning outputs, not outer performance. A held-out prediction uses only its fold-training outcomes. No automatic paths, random folds, one-standard-error rule, candidate averaging or full-model nested CV is added.

The existing native primitive also profiles a provisional winning candidate. gscore independently selects minimum reported MSE (largest penalty on exact ties), verifies that index/penalty before reuse, then calls public gbayes::bayes at the frozen selected pair. A disagreement fails before annotation refitting; native provisional choice and its ordinary-Gaussian final work are not hidden. Known noise s gives t=s/ratio; optional estimateNoise profiles s at that selected ratio on full training data, then t=s/ratio. This fixed-ratio scale estimate can admit an identity Gram, unlike free joint_noise_ml variance identification.

The final single-/multiple-set co-data fit receives exactly the same frozen coding and pair. Fixed or saved feature-group split penalties compose with it; patient folds and feature-group equation splits remain distinct. Omit prior initializer modes/variances/bounds and fitControl\(coding to avoid ignored inputs. Result\)fit is the ordinary common bayesfit; its flags describe the conditional fixed-pair fit. Earlier CV/noise profiling remains in gscore selection metadata, including fold/cluster identities, candidates/losses, penalty profile, work and owner version. fit\(provenance\)selection preserves that metadata if saving the fit alone. Common effect units, uncertainty limits and frozen prediction remain.

CV and final-fit numeric bounds are stage-specific, not a combined RSS ceiling. Native dense-dual planning includes optional retained predictions and work caps; incomplete CV or an invalid final co-data fit yields no workflow result. Focused developer reference checks pass in gbayes 0.1.16. Independent references pass in the focused gbayes 0.1.16 / gscore 0.1.2 developer checkpoint. Full-model CV and fold-learned coding remain planned.