get_density: Calculates density for regions around units.

Description Usage Arguments Details Value

Description

Takes an incidence matrix with regions in rows and units in columns, where elements are a binary incidence (RCA), and unit-unit similarity matrix. Calculates the density around each nit for each region, based on units present in the region in the incidence matrix. Outputs a region x unit matrix with density in elements.

Usage

1
get_density(rca_mat, sim_mat, binary = TRUE)

Arguments

rca_mat

Binary matrix that contains regions in rows, units in columns and presence/incidence in elements.

sim_mat

Unit x unit matrix with similarity-values in elements

binary

logical. If false, a non-binary RCA matrix is allowed as input. This means that RCA is used as weights to similarity values.

Details

General method: density of a region around a unit U is defined as the sum of all similarity-values between the units contained in the region (the 1s in the incidence matrix) and the unit U, divided by the sum of Us similarity-values to all other individual units. By taking the dot product between the incidence matrix and the relatedness matrix, we get a matrix the shape of the incidence matrix, but for each unit (column) the value is the sum of contained prducts relatedness to that product. This matrix is divided by the columnsums of the relatedness_matrix (which is the sum of all global unit relatedness scores).

Value

Region x unit matrix that contains density for regions around units in elements.


sbpdata/compost documentation built on Nov. 5, 2019, 6:17 a.m.