strata_to_residency_counts: Helper function for lumped population strata (counts)

View source: R/utils.R

strata_to_residency_countsR Documentation

Helper function for lumped population strata (counts)

Description

If input is given as a matrix of population counts per strata (columns) and patch (rows), this function calculates the residency matrix and population size for the overall stratification of both residency and strata.

Usage

strata_to_residency_counts(H_counts)

Arguments

H_counts

a matrix of population counts

Value

a list with three elements:

  • J: the residency matrix mapping elements in H to patches

  • H: the overall population distribution over strata and patches

Examples

# taken from package tests
J <- matrix(
   c(0.3, 0.5, 0.2,
   0.1, 0.6, 0.3), nrow = 3, ncol = 2, byrow = FALSE
)
H <- c(50, 60)
H_overall <- J %*% diag(H)
residency <- strata_to_residency_proportion(H_strata = H, J_strata = J)

MicroMoB documentation built on Jan. 17, 2023, 9:06 a.m.