Builds a single axis spec for tulpa_hyper_grid(). Carries the candidate
values, the optional log-prior, and the metadata (log-scale, bounds,
refinable flag) that the generic refinement / consistency passes need.
Usage
hyper_axis_spec(
name,
grid,
log_prior = NULL,
log_scale = FALSE,
bounds = NULL,
refinable = FALSE,
atom_mass = NULL,
slab_bounds = NULL,
log_prior_coord = c("integration", "natural"),
extend = TRUE
)Arguments
- name
Character. Axis label, used as the column name of the grid matrix and in posterior summaries.
- grid
Numeric vector of length >= 1. The per-axis candidate values (the outer integration nodes on this axis). The full outer grid is the Cartesian product across axes.
- log_prior
Optional
function(x)returning the scalar log prior density at axis valuex.NULL(default) is a flat / improper prior (zero log-prior contribution).log_prior_coordsays which coordinate the function is a density on.- log_scale
Logical. Does the axis live naturally on a log scale (
sigma,tau,lengthscale, ...)? Drives geometric vs arithmetic spacing in refinement and log-axis quantile fits. DefaultFALSE.- bounds
Numeric vector of length 2 giving the natural support
(lower, upper)of the axis, e.g.c(0, Inf)forsigma,c(0, 1)for a BYM2 mixing coefficient.NULL(default) is unbounded. A finite endpoint is treated as OPEN: it is the value the parameterisation degenerates at, so refinement clamps new points to the interior and the axis's quadrature cells and reported support are closed strictly inside it rather than half a node step past the outermost node.- refinable
Logical. When
TRUE, the axis participates in the adaptive-grid and var-of-means consistency passes (when those are enabled at the driver level). Spatial prior amplitudes (sigma) are typically left at the user-specified grid (refinable = FALSE); the copy coefficientalphaand per-arm dispersionphitypically opt in. DefaultFALSE.- atom_mass
Numeric in
[0, 1), orNULL(default). Prior probability of the zero level on a log-scale axis. A0is a point mass, not a point of the log continuum, so its prior share has to be declared rather than inherited from the node count; the continuum nodes then share1 - atom_massby quadrature weight. Required whengridcontains a0on alog_scaleaxis. Alog_prioron such an axis is a density on the continuum: it is not evaluated at the zero level and it shapes the continuum's share without moving the declared split, soatom_massis the prior probability the fit integrates whatever the density is (gcol33/tulpa#624, gcol33/tulpa#626).- slab_bounds
Numeric
c(lower, upper), orNULL(default). Fixed support of the continuum part of the prior. A flat measure on a log axis is improper, so the truncation bounds are what make it a proper density and they are therefore a prior choice: the weights normalise overslab_boundsand refinement is not allowed to move outside it.NULLleaves the node span acting as the support, which makes the prior depend on where refinement put the outermost node.- log_prior_coord
One of
"integration"(default) or"natural", naming the coordinatelog_prioris a density on. The contribution is added to the cell'slog_marginal, which the integrator weights by cell widths measured on the axis's INTEGRATION coordinate (log xon alog_scaleaxis), so"integration"is carried through as written and is what the flat default's zero contribution is flat on."natural"declares a density onxitself – a PC prior,dexp,dgamma– and the engine adds the change of variableslog(x)on alog_scaleaxis. Every path that meets a declared density carries it across in one place (.hyper_prior_carry()). Inert on a linear axis, where the two coordinates coincide (gcol33/tulpa#623).- extend
Logical. On a refinable axis, may the passes place a node beyond the outermost value in
grid?TRUE(default) lets refinement follow the posterior out past the declared span, which is what an axis the engine placed wants.FALSEconfines every new node to the interior of the declared span: the axis is integrated more finely over exactly the range given, and a mode outside it shows up as mass at the edge instead of moving the range. Inert whenrefinable = FALSE.