Skip to contents

Density process: r1(d) = M(d; ell1). Expression process: r2(d) = [a21^2 M(d; ell1) + a22^2 M(d; ell2)] / (a21^2 + a22^2), with M the Matern-3/2 correlation. The practical range is the distance at which the correlation falls to threshold (default 0.05), computed per posterior draw.

Usage

denmark_decay(obj, distances = NULL, probs = c(0.025, 0.975), threshold = 0.05)

Arguments

obj

A denmark object from DenMark().

distances

Distances at which to evaluate the curves (data units); default: 200 points from 0 to the maximum distance between grid centroids.

probs

Lower and upper probabilities of the posterior band.

threshold

Correlation level that defines the practical range.

Value

A list with curves (data frame: field, distance, posterior mean, lower and upper band), ranges (data frame: posterior mean, median and interval of the practical range of each field), range_draws (the practical ranges per draw) and threshold.

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)
decay <- denmark_decay(fit)
decay$ranges
#>        field     mean   median    lower    upper
#> 1    density 1.657047 1.593938 1.035153 2.606365
#> 2 expression 2.066634 1.923209 1.206821 3.781755