pal_distance: Dyadic distance between Projected Actor Locations

View source: R/distance.R

pal_distanceR Documentation

Dyadic distance between Projected Actor Locations

Description

Builds the dyadic distance covariate used to model interaction likelihood: the Haversine distance between the two actors' Projected Actor Locations.

Usage

pal_distance(
  events,
  dyads,
  params,
  transform = c("none", "log"),
  offset = 0.01,
  alter_weight = c("normalized", "legacy"),
  eps = 0.01,
  cutoff = c("day", "month", "year")
)

Arguments

events

A pal_events object.

dyads

A data.frame with columns actor1, actor2, time.

params

A pals_params or fitted estimate_pals object.

transform

"none" (default) returns distance in km; "log" returns log(distance + offset), as used for interstate-conflict-style specifications.

offset

Offset added before logging (default 0.01).

alter_weight, eps, cutoff

See project_pal.

Value

dyads augmented with pal_distance (and, for transform = "log", pal_log_distance).

Examples

ev  <- simulate_conflict_events(n_actors = 8, n_events = 200, seed = 1)
fit <- estimate_pals(ev, model = "one")
dy  <- data.frame(actor1 = "G01", actor2 = "G02",
                  time = as.Date("2012-12-01"))
pal_distance(ev, dy, fit)


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