Skip to contents

Posterior means (and optional quantiles) of

  • eta1 = beta0 + a11 w1, the log cell intensity per unit area;

  • a11w1 = a11 w1, the density latent field;

  • eta2 = beta1 + a21 w1 + a22 w2, the log expression per cell;

  • a21w1 = a21 w1, the density-shared part of expression;

  • a22w2 = a22 w2, the expression-specific part.

Usage

denmark_fields(obj, probs = NULL)

Arguments

obj

A denmark object fitted with keep_fit = TRUE.

probs

Optional probabilities; for each, the posterior quantiles of the five fields are added in columns such as eta1_q2.5.

Value

Data frame with one row per grid cell: grid_index, i, j, x, y, Y, M, the five fields, log_lambda1 and log_lambda2.

Details

The full linear predictors are log_lambda1 = log|g| + eta1 and log_lambda2 = log(Y + 0.05) + eta2.

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)
fields <- denmark_fields(fit)
head(fields)
#>   grid_index i j        x         y  Y  M     eta1      a11w1      eta2
#> 1          3 3 1 1.891507 0.7530424 12 18 6.061543  0.4602119 0.5019067
#> 2          4 4 1 2.401581 0.7530424 29 63 5.720620  0.1192884 0.8170485
#> 3          5 5 1 2.911655 0.7530424 31 78 5.415823 -0.1855085 0.9240433
#> 4          6 6 1 3.421729 0.7530424 14 13 5.029744 -0.5715874 0.0353098
#> 5          7 7 1 3.931803 0.7530424  1  1 5.444391 -0.1569405 0.0186064
#> 6         12 2 2 1.381434 1.0078334  8 15 6.268291  0.6669597 0.7402424
#>        a21w1     a22w2 log_lambda1 log_lambda2
#> 1  0.3874448 0.1213282   2.4511213  2.99097136
#> 2  0.1017701 0.7221446   3.3396454  4.18606696
#> 3 -0.1558314 1.0867410   3.2502438  4.35964207
#> 4 -0.4759146 0.5180906   2.6924697  2.67793219
#> 5 -0.1278886 0.1533612   0.7622484  0.06739657
#> 6  0.5620494 0.1850593   1.8897101  2.82591452