Skip to contents

Keeps scripts written for the original interface running. L1 and L2 are no longer needed (they are computed from the data) and are only checked.

Usage

DenMarkmain(
  grid_size,
  dataset,
  basis,
  boundfactor,
  L1 = NULL,
  L2 = NULL,
  denmark_version = "M2",
  ...
)

Arguments

grid_size

Grid cells per axis, or c(nx, ny).

dataset

Data frame with columns x, y and one expression column.

basis

HSGP basis functions per axis, or c(m1, m2).

boundfactor

HSGP boundary factor (>= 1).

L1, L2

Optional half-ranges, only checked against the data.

denmark_version

"M2" (the default) fits the DenMark model; any other value is taken as the path to a Stan file (as in the earlier tutorial) and passed to DenMark() as stan_file.

...

Further arguments passed to DenMark().

Value

An object of class denmark, see DenMark().

Examples

toy <- denmark_toy_data()
tissue <- denmark_alpha_shape(toy$x, toy$y)
tumor <- toy[toy$celltype == "Tumor", c("x", "y", "geneA")]
fit <- DenMarkmain(grid_size = 10, dataset = tumor,
                   basis = 10, boundfactor = 1.5, boundary = tissue,
                   chains = 2, iter_warmup = 300, iter_sampling = 300,
                   seed = 2024, quiet = TRUE)
fit$rhat
#>      beta0      beta1     ell[1]     ell[2] Astar[2,1]   sigma[1]   sigma[2] 
#>   1.003058   1.002995   1.010649   1.005955   1.009571   1.001273   1.008189