Description Usage Arguments Value Examples

View source: R/simulate_populations.R

Simulate a structured population with temporal autocorrelation using standard Leslie matrices. Each element in the Leslie matrix has a specified mean, variance, and temporal autocorrelation value. The matrix can have arbitrary dimensions and can have transitions besides linear survival. This model includes environmental stochasticity with colored noise. Density dependence and demographic stochasticity not currently supported.

1 2 3 4 5 6 7 8 9 10 |

`data` |
The input data can be one of two formats: a list of three matrices, or a data frame
with three columns. |

`initialPop` |
An initial population vector. The length must be the same as the number of classes in the matrices. |

`timesteps` |
The number of timesteps you would like to simulate the population. |

`covMatrix` |
Optional: Add a covariance matrix describing within-year covariances between matrix elements. The matrix elements must be in the same order as they are in the data frame format above: a Leslie matrix turned into a vector row-wise. There should be as many columns as matrix elements, excluding repeat elements (see below) or structural zeros. |

`colNames` |
Optional: If the mean, sd, and autocorrelation columns of your data frame input are not named 'mean', 'sd', and 'autocorrelation', provide their names here in a character vector, e.g., ‘c(mean = ’Mean', sd = 'Standard Deviation', autocorrelation = 'phi')' |

`matrixStructure` |
Optional: By default, the function assumes that the first row of the matrix gives fecundities while the rest of the matrix gives transition or survival probabilities. However, these assumptions do not apply to many plant matrices. If your matrix has transition probabilities in the first row or fecundities beyond the first row (e.g., clonal reproduction), provide a character matrix here with the same dimensions as your matrix that gives in strings whether each element is 'fecundity' or 'transition'. |

`repeatElements` |
Optional: Sometimes not all matrix elements can be measured, and some transitions or fertilities
are generalized across classes. If you have any matrix elements that are copies of other matrix elements (e.g., stage 3
is assumed to have the same fertility as stage 4) indicate them here with a matrix of |

`survivalOverflow` |
If the survival for a stage is very high or very variable, the function may sometimes generate projection matrices with survival that exceeds 1 for that stage. The function has two methods of dealing with this problem: either discard all projection matrices and generate new ones until the survival falls within acceptable bounds ("redraw") or divide all the non-fertility matrix elements for that stage by the survival such that they add to 1 ("scale"). The default is "scale". |

A data frame with n + 2 columns, where n is the number of stages in the matrix. One column indicates the timestep, there is one column with the population size for each stage, and one column for total population size.

1 2 3 4 5 6 |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.