Learn R Programming

MicroMoB (version 0.1.2)

strata_to_residency_counts: 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)

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

Arguments

H_counts

a matrix of population counts

Examples

Run this code
# 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)

Run the code above in your browser using DataLab