# Simulating more complex mating systems

#### 2018-02-15

The easiest simulations to parameterize in rmetasim are ones in which hermaphroditic individuals are simulated. This works really well in the majority of cases. There are times, however, where simulating more complex sexuality and mating is required. No problem, but more complex sexuality means more complex parameterization.

I find that drawing a picture that illustrates the fate of individuals each time-click is very helpful

## Hermaphrodites

The following figure illustrates a simple life-cycle.

The local demography matrices that encode this demography look like this (remember transitions go from columns to rows):

## [1] "LocalS:"
##      [,1] [,2]
## [1,]  0.0 0.00
## [2,]  0.6 0.85
## [1] "LocalR:"
##      [,1] [,2]
## [1,]    0    1
## [2,]    0    0
## [1] "LocalM:"
##      [,1] [,2]
## [1,]    0    0
## [2,]    0    1

## Dioecy with equal probability of producing males and females from a mating

Here are the local-demographic matrices. Now there are 4 stages within a population: male juveniles (1), male adults(2), female juveniles(3) and female adults (4)

## [1] "LocalS:"
##      [,1] [,2] [,3] [,4]
## [1,]  0.0 0.00  0.0 0.00
## [2,]  0.5 0.75  0.0 0.00
## [3,]  0.0 0.00  0.0 0.00
## [4,]  0.0 0.00  0.6 0.85
## [1] "LocalR:"
##      [,1] [,2] [,3] [,4]
## [1,]    0    0    0  0.5
## [2,]    0    0    0  0.0
## [3,]    0    0    0  0.5
## [4,]    0    0    0  0.0
## [1] "LocalM:"
##      [,1] [,2] [,3] [,4]
## [1,]    0    0    0    0
## [2,]    0    0    0    1
## [3,]    0    0    0    0
## [4,]    0    0    0    0

One could imagine additional elements in the LocalS matrix that might encode changes in sexuality during the course of an individual’s life.