strata_to_residency_proportion {MicroMoB}R Documentation

Helper function for lumped population strata (proportional assignment)

Description

If input is given as a vector of population sizes per-strata, lumped over patches, and a separate matrix whose columns describe how each strata is distributed over patches, this function calculates the residency matrix and population size for the overall stratification of both residency and strata.

Usage

strata_to_residency_proportion(H_strata, J_strata)

Arguments

H_strata

a vector of population size by strata

J_strata

a matrix whose columns sum to one giving the distribution of strata (columns) populations over patches (rows)

Value

a list with three elements:

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)
# get the overall assignment of strata (cols) across patches (rows)
H_overall <- J %*% diag(H)
residency <- strata_to_residency_proportion(H_strata = H, J_strata = J)

[Package MicroMoB version 0.1.2 Index]