R/mpm_rearrange.R
mpm_rearrange.Rd
Rearrange stages of a matrix population model so that all inter-reproductive stages fall in the final rows/columns of the matrix. This is a preparatory step to collapsing the matrix model into a standardized set of stages (e.g., propagule, pre-reproductive, reproductive, and post-reproductive).
mpm_rearrange(matU, matF, matC = NULL, repro_stages, matrix_stages)
The survival component of a matrix population model (i.e., a square projection matrix reflecting survival-related transitions; e.g., progression, stasis, and retrogression)
The sexual component of a matrix population model (i.e., a square projection matrix reflecting transitions due to sexual reproduction)
The clonal component of a matrix population model (i.e., a square
projection matrix reflecting transitions due to clonal reproduction).
Defaults to NULL
, indicating no clonal reproduction (i.e.,
matC
is a matrix of zeros).
Logical vector of length ncol(matU)
indicating
which stages are reproductive. Alternatively, a vector of stage indices or
stage names of the reproductive classes.
A character vector identifying organized matrix stages.
Returns a list with 6 elements:
Rearranged survival matrix
Rearranged sexual reproduction matrix
Rearranged clonal reproduction matrix
Rearranged vector of organized matrix stages
Rearranged logical vector of reproductive stages
Numeric index for any rearranged inter-reproductive stages
Other transformation:
is_leslie_matrix()
,
leslie_collapse()
,
mpm_collapse()
,
mpm_split()
,
mpm_standardize()
,
name_stages()
,
repro_stages()
,
standard_stages()
matU <- rbind(
c(0.1, 0, 0, 0, 0),
c(0.5, 0.2, 0.1, 0, 0),
c(0, 0.3, 0.3, 0.1, 0),
c(0, 0, 0.4, 0.4, 0.1),
c(0, 0, 0, 0.1, 0.4)
)
matF <- rbind(
c(0, 1.1, 0, 1.6, 0),
c(0, 0.8, 0, 0.4, 0),
c(0, 0, 0, 0, 0),
c(0, 0, 0, 0, 0),
c(0, 0, 0, 0, 0)
)
repro_stages <- c(2, 4)
matrix_stages <- c("prop", "active", "active", "active", "active")
mpm_rearrange(matU, matF,
repro_stages = repro_stages,
matrix_stages = matrix_stages
)
#> $matU
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.1 0.0 0.0 0.0 0.0
#> [2,] 0.5 0.2 0.0 0.0 0.1
#> [3,] 0.0 0.0 0.4 0.1 0.4
#> [4,] 0.0 0.0 0.1 0.4 0.0
#> [5,] 0.0 0.3 0.1 0.0 0.3
#>
#> $matF
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0 1.1 1.6 0 0
#> [2,] 0 0.8 0.4 0 0
#> [3,] 0 0.0 0.0 0 0
#> [4,] 0 0.0 0.0 0 0
#> [5,] 0 0.0 0.0 0 0
#>
#> $matC
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0 0 0 0 0
#> [2,] 0 0 0 0 0
#> [3,] 0 0 0 0 0
#> [4,] 0 0 0 0 0
#> [5,] 0 0 0 0 0
#>
#> $matrix_stages
#> [1] "prop" "active" "active" "active" "active"
#>
#> $repro_stages
#> [1] FALSE TRUE TRUE FALSE FALSE
#>
#> $nonRepInterRep
#> [1] 3
#>