View source: R/hyper_quadrature.R
| tulpa_hyper_grid_supports | R Documentation |
The natural-scale support of every axis in specs that carries one, as a
named list of intervals – the region each axis's outer-grid measure
actually integrates, including levels a refinement pass added. Intended for
recovering an axis's integrated span from a settled grid, e.g. so a
sampled-hyperparameter prior can be derived from what the outer
integration used rather than restated alongside it.
tulpa_hyper_grid_supports(theta_grid, specs, refining = NULL)
theta_grid |
A named |
specs |
Per-axis spec list, e.g. from
|
refining |
Optional per-cell refinement tag vector (see
|
A named list of natural-scale c(lo, hi) intervals, one per axis
in specs that carries a declared coordinate, or NULL if theta_grid
or specs is NULL.
tulpa_joint_axis_specs_from_grid(), tulpa_hyper_slice_home()
set.seed(1)
S <- 30L # spatial units in a chain
nb <- lapply(seq_len(S), function(s) setdiff(c(s - 1L, s + 1L), c(0L, S + 1L)))
nn <- lengths(nb)
field <- as.numeric(scale(cumsum(rnorm(S, 0, 0.4))))
idx <- rep(seq_len(S), each = 6L); n <- length(idx); x <- rnorm(n)
y <- rbinom(n, 1L, plogis(-0.2 + 0.6 * x + field[idx]))
prior <- list(type = "icar", n_spatial_units = S, spatial_idx = idx,
adj_row_ptr = c(0L, cumsum(nn)), adj_col_idx = unlist(nb) - 1L,
n_neighbors = nn, tau_grid = c(0.5, 1, 2, 4, 8))
fit <- tulpa_nested_laplace(y, rep(1L, n), cbind(1, x), prior = prior,
family = "binomial",
control = list(progress = FALSE))
tg <- tulpa_theta_matrix(fit)
tulpa_hyper_grid_supports(tg, tulpa_joint_axis_specs_from_grid(tg))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.