Skip to contents

Uses the one-dimensional Matern-3/2 recommendations of Riutort-Mayol et al. (2023, Statistics and Computing): with S the half-range of the domain, c the boundary factor and m the number of basis functions, the smallest length-scale that is well approximated is ell_min = 3.42 * c * S / m, and the boundary factor should satisfy c >= max(1.2, 4.5 * ell / S). Applied per axis; a message is issued when the posterior median length-scale is below ell_min (increase basis) or c is too small. The rule targets an accurate approximation of the latent function itself and is conservative for estimating rho; treat it as guidance.

Usage

denmark_check_hsgp(obj, warn = TRUE)

Arguments

obj

A denmark object from DenMark().

warn

Issue a message when the rule is not met.

Value

Data frame with one row per field and axis: field, axis, ell_median, ell_min, c_needed, basis_ok and boundary_ok.

Examples

toy <- denmark_toy_data()
tissue <- denmark_alpha_shape(toy$x, toy$y)
tumor <- subset(toy, celltype == "Tumor", select = -celltype)
fit <- DenMark(tumor, gene = "geneA", boundary = tissue,
               grid_size = 10, basis = 10,
               chains = 2, iter_warmup = 300, iter_sampling = 300,
               seed = 2024, quiet = TRUE)
denmark_check_hsgp(fit, warn = FALSE)
#>        field axis ell_median   ell_min c_needed basis_ok boundary_ok
#> 1    density    x  0.5819691 1.3083393 1.200000    FALSE        TRUE
#> 2 expression    x  0.7263959 1.3083393 1.281690    FALSE        TRUE
#> 3    density    y  0.5819691 0.6535387 2.055694    FALSE       FALSE
#> 4 expression    y  0.7263959 0.6535387 2.565854     TRUE       FALSE