predict_event_locations: Predict dyadic event locations

View source: R/distance.R

predict_event_locationsR Documentation

Predict dyadic event locations

Description

For each dyadic target (a pair of actors at a time), predicts the interaction location as the mean of the two actors' Projected Actor Locations. Optionally scores the prediction against an observed location.

Usage

predict_event_locations(
  events,
  targets,
  params,
  alter_weight = c("normalized", "legacy"),
  eps = 0.01,
  cutoff = c("day", "month", "year")
)

Arguments

events

A pal_events object supplying the histories.

targets

A data.frame with columns actor1, actor2, time, and optionally lon/lat giving the observed event location (for error scoring).

params

A pals_params or fitted estimate_pals object.

alter_weight, eps, cutoff

See project_pal.

Value

targets augmented with pred_lon, pred_lat, and (if observed lon/lat were supplied) error_km, the Haversine distance between predicted and observed locations. Predictions are NA when both actors lack usable history.

Examples

ev  <- simulate_conflict_events(n_actors = 10, n_events = 300, seed = 1)
fit <- estimate_pals(ev, model = "one")
tg  <- ev[ev$time > as.Date("2012-01-01"), ]
head(predict_event_locations(ev, tg, fit))


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