estimate_pals: Estimate PALS parameters

View source: R/estimate.R

estimate_palsR Documentation

Estimate PALS parameters

Description

Estimates the PALS smoothing parameters by minimizing the mean great-circle (Haversine) distance between observed event locations and the locations predicted from each event's preceding history ("marching forward": every prediction uses only events strictly earlier than the event being predicted).

Usage

estimate_pals(
  events,
  fit_events = NULL,
  model = c("four", "one"),
  start = NULL,
  method = NULL,
  aggregate = c("mean", "sum"),
  alter_weight = c("normalized", "legacy"),
  eps = 0.01,
  radius = 6371.0088,
  cutoff = c("day", "month", "year"),
  control = list()
)

Arguments

events

A pal_events object providing the actor histories.

fit_events

Optional data.frame of target events to fit against (needs actor1, actor2, time, lon, lat). Defaults to all of events; events with no usable history contribute nothing and are ignored.

model

"four" (full: focal + alter histories, estimates alpha, beta, gamma, eta) or "one" (focal-only; estimates alpha, with pi = 0).

start

Optional numeric starting vector on the optimizer's scale (c(gamma, eta, log_alpha, log_beta) for the four-parameter model, log_alpha for the one-parameter model). Sensible defaults are used if NULL.

method

Optimizer method passed to stats::optim ("Nelder-Mead" for the four-parameter model, "Brent" for the one-parameter model by default).

aggregate

"mean" (default) or "sum" of per-event distances.

alter_weight, eps, cutoff

See project_pal.

radius

Sphere radius for the Haversine objective (km).

control

A list of control parameters for stats::optim.

Value

An object of class pals_fit with components params (estimated pals_params), model, objective (minimized mean/sum distance), n_used (events contributing), convergence, optim (raw optimizer output), events, settings, and call. Methods: print(), summary(), coef(), predict(), plot().

See Also

project_pals(), predict_event_locations(), bootstrap_pals().

Examples

ev  <- simulate_conflict_events(n_actors = 10, n_events = 300, seed = 1)
fit <- estimate_pals(ev, model = "one")
fit
coef(fit)


palsr documentation built on July 1, 2026, 5:07 p.m.