View source: R/predict_marks.R
predict_marks | R Documentation |
Predict values from the mark distribution
predict_marks(
sim_realization,
raster_list = NULL,
scaled_rasters = FALSE,
mark_model = NULL,
xy_bounds = NULL,
include_comp_inds = FALSE,
competition_radius = 15,
correction = "none"
)
sim_realization |
a data frame containing a thinned or unthinned realization from |
raster_list |
a list of raster objects. |
scaled_rasters |
'TRUE' or 'FALSE' indicating whether the rasters have been scaled. |
mark_model |
a model object (typically from |
xy_bounds |
a vector of domain bounds (2 for x, 2 for y). |
include_comp_inds |
'TRUE' or 'FALSE' indicating whether to generate and use competition indices as covariates. |
competition_radius |
distance for competition radius if |
correction |
type of correction to apply ("none" or "toroidal"). |
a vector of predicted mark values.
# Simulate a realization
generating_parameters <- c(2, 8, .02, 2.5, 3, 1, 2.5, .2)
M_n <- matrix(c(10, 14), ncol = 1)
generated_locs <- simulate_sc(
t_min = 0,
t_max = 1,
sc_params = generating_parameters,
anchor_point = M_n,
xy_bounds = c(0, 25, 0, 25)
)
# Load the raster files
raster_paths <- list.files(system.file("extdata", package = "ldmppr"),
pattern = "\\.tif$", full.names = TRUE
)
rasters <- lapply(raster_paths, terra::rast)
# Scale the rasters
scaled_raster_list <- scale_rasters(rasters)
# Load the example mark model
file_path <- system.file("extdata", "example_mark_model.rds", package = "ldmppr")
example_mark_model <- readRDS(file_path)
# Unbundle the model
mark_model <- bundle::unbundle(example_mark_model)
# Predict the mark values
predict_marks(
sim_realization = generated_locs$thinned,
raster_list = scaled_raster_list,
scaled_rasters = TRUE,
mark_model = mark_model,
xy_bounds = c(0, 25, 0, 25),
include_comp_inds = TRUE,
competition_radius = 10,
correction = "none"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.