View source: R/estimate_process_parameters.R
| estimate_process_parameters | R Documentation |
Estimate spatio-temporal point process parameters by maximizing the (approximate)
full log-likelihood using nloptr.
estimate_process_parameters(
data,
process = c("self_correcting"),
grids,
budgets,
parameter_inits = NULL,
delta = NULL,
parallel = FALSE,
num_cores = max(1L, parallel::detectCores() - 1L),
set_future_plan = FALSE,
strategy = c("local", "global_local", "multires_global_local"),
global_algorithm = "NLOPT_GN_CRS2_LM",
local_algorithm = "NLOPT_LN_BOBYQA",
starts = list(global = 1L, local = 1L, jitter_sd = 0.35, seed = 1L),
finite_bounds = NULL,
refine_best_delta = TRUE,
rescore_control = list(enabled = TRUE, top = 5L, objective_tol = 1e-06, param_tol =
0.1, avoid_bound_solutions = TRUE, bound_eps = 1e-08),
verbose = TRUE
)
data |
a data.frame or matrix. Must contain either columns |
process |
type of process used (currently supports |
grids |
a |
budgets |
a |
parameter_inits |
(optional) numeric vector of length 8 giving initialization values
for the model parameters. If |
delta |
(optional) numeric scalar or vector. Used only when
If |
parallel |
|
num_cores |
number of workers to use when |
set_future_plan |
|
strategy |
character string specifying the estimation strategy:
|
global_algorithm, local_algorithm |
NLopt algorithms to use for the global and local optimization stages, respectively. |
starts |
a list controlling restart and jitter behavior:
|
finite_bounds |
(optional) list with components |
refine_best_delta |
|
rescore_control |
controls candidate rescoring and bound-handling behavior in multi-resolution fitting. Can be either:
Defaults are:
|
verbose |
|
For the self-correcting process, arrival times must lie on (0,1) and can be
supplied directly in data as time, or constructed from size
via the gentle-decay (power-law) mapping power_law_mapping using
delta. When delta is a vector, the model is fit for each candidate
value and the best objective is selected.
This function supports multi-resolution estimation via a ldmppr_grids
schedule. If multiple grid levels are provided, the coarsest level may use a global
optimizer followed by local refinement, and subsequent levels run local refinement only.
an object of class "ldmppr_fit" containing the best nloptr fit and
(optionally) stored fits from global restarts and/or a delta search.
Møller, J., Ghorbani, M., & Rubak, E. (2016). Mechanistic spatio-temporal point process models for marked point processes, with a view to forest stand data. Biometrics, 72(3), 687-696. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/biom.12466")}.
# Load example data
data(small_example_data)
# Define grids and budgets
ub <- c(1, 25, 25)
g <- ldmppr_grids(upper_bounds = ub, levels = list(c(10,10,10)))
b <- ldmppr_budgets(
global_options = list(maxeval = 150),
local_budget_first_level = list(maxeval = 50, xtol_rel = 1e-2),
local_budget_refinement_levels = list(maxeval = 25, xtol_rel = 1e-2)
)
# Estimate parameters using a single delta value
fit <- estimate_process_parameters(
data = small_example_data,
grids = g,
budgets = b,
delta = 1,
strategy = "global_local",
global_algorithm = "NLOPT_GN_CRS2_LM",
local_algorithm = "NLOPT_LN_BOBYQA",
starts = list(global = 2, local = 2, jitter_sd = 0.25, seed = 1),
verbose = TRUE
)
coef(fit)
logLik(fit)
# Estimate parameters using multiple delta values (delta search)
g2 <- ldmppr_grids(upper_bounds = ub, levels = list(c(8,8,8), c(12,12,12)))
fit_delta <- estimate_process_parameters(
data = small_example_data, # x,y,size
grids = g2,
budgets = b,
delta = c(0.35, 0.5, 0.65, 0.9, 1.0),
parallel = TRUE,
set_future_plan = TRUE,
num_cores = 2,
strategy = "multires_global_local",
starts = list(local = 1),
refine_best_delta = FALSE,
verbose = FALSE
)
plot(fit_delta)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.