Skip to contents

Finalises each row (see finalize_row_connections()) and sums the rows: tma's aggregation of apply_tensor()$row_connection_counts, with the weight model applied per line before the unit sum.

Usage

aggregate_row_connections(
  row_conn,
  n_codes,
  ordered = FALSE,
  weight = NULL,
  diagonal = FALSE
)

Arguments

row_conn

Numeric matrix (n_response_rows x n_codes^2) of per-row directed counts, i.e. apply_tensor()$row_connection_counts

n_codes

Number of codes

ordered

TRUE = keep directed n*n rows; FALSE = fold to choose(n, 2)

weight

Weight model name ("binary", "product", "sqrt", "log1p"), or TRUE/FALSE for the legacy binary flag (TRUE = "binary", FALSE = "product"). NULL (default) = "binary".

diagonal

Unordered only: keep self-connections in the folded rows, as columns A & A, A & B, B & B, ... (ordered rows always carry them)

Value

Numeric vector of length n_codes^2 (ordered) or choose(n_codes, 2)