R/st_grid_class.R
compute_k_ripley-STGrid-method.RdThis method calculates Ripley's reduced second moment function, K(r), for each feature in a spatial grid.
# S4 method for STGrid
compute_k_ripley(
object,
rmax = 80,
nlarge = 2e+06,
var.approx = FALSE,
ratio = FALSE,
sampling_rate = 0.25,
seed = 123,
verbose = TRUE
)An object of class "STGrid".
Maximum desired value of the argument r.
Efficiency threshold. If the number of points exceeds nlarge, then only the border correction will be computed (by default), using a fast algorithm.
Logical. If TRUE, the approximate variance of K(r) under CSR will also be computed.
Logical. If TRUE, the numerator and denominator of each edge-corrected estimate will also be saved, for use in analyzing replicated point patterns.
By default a subset of molecules is sampled. Set sampling_rate to 1 to keep all molecules.
The seed for sampling_rate.
Whether to print porgress bar.
An updated object of class "STGrid" with the Ripley's K function estimates stored in the slot 'ripley_k_function'.
example_dataset()
#> |-- INFO : Dataset 11284233/files/Xenium_Mouse_Brain_Coronal_7g was already loaded.
Xenium_Mouse_Brain_Coronal_7g <- compute_k_ripley(Xenium_Mouse_Brain_Coronal_7g, verbose=FALSE)
#> |-- INFO : >>> Estimating Ripley's reduced second moment function for all features.