Equivalent to tma's accumulate_network() but without R-env-var setup. The decay function receives a distance vector (response=0, older rows have larger values) and returns a weight vector of the same length.

lq_accumulate_unit_with_rows(codes, unit_rows, decay_fn, ordered = FALSE)

Arguments

codes

Numeric matrix (n_rows x n_codes)

unit_rows

0-based integer vector of rows belonging to this unit

decay_fn

R function(distances) -> weights

ordered

TRUE = directed (full p^2); FALSE = undirected (upper-tri)

Value

List with `networks` (vector) and `row_networks` (matrix)