# projectn: Demographic Projections In Rramas: Matrix Population Models

## Description

Make deterministic and stochastic demographic projections according to a transition matrix.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```projectn(v0, mat, matsd = NULL, estamb = FALSE, estdem = FALSE, equalsign = TRUE,stmat=NULL, fecundity1=TRUE, nrep = 1, time = 10, management=NULL, round=TRUE) project1(v0, mat, matsd=NULL, estamb=FALSE, estdem=FALSE, equalsign=TRUE, stmat=NULL, fecundity1=TRUE) estambi(mat, matsd, equalsign) estdemo(v0,mat,stmat=NULL, fecundity1=TRUE) ## S3 method for class 'rmas' plot(x, sum = TRUE, mean=FALSE, type="l", harvest=FALSE, ...) ## S3 method for class 'rmas' summary(object, stage=NULL, harvest=FALSE,...) ## S3 method for class 'summary.rmas' plot(x, ylim=NULL, col=NULL, xlab=NULL, ylab=NULL, main=NULL,...) ```

## Arguments

 `v0` Vector with the initial abundance of each stage. `mat` Transition matrix. `matsd` Matrix with the standard deviation of the probabilities in `mat`. `estamb` Logical. Should environmental stochasticity be considered to projet the dynamics of the population? `estdem` Logical. Should demographic stochasticity be employed to project the dynamics of the population? `equalsign` Logical. Should the environmental deviations have all the same sign and magnitude? See details section. `stmat` Matrix indicating for each transition probability in `mat` which part (i.e. which proportion) should be considered resulting from fecundity (and the rest will be considered resulting from survival). See details. `fecundity1` Logical. Should the first row of `mat` be considered exclusively as fecundities? See details `nrep` Number of replications to evaluate the effects of stochasticity. `time` length of the demographic trajectory `management` Vector (or matrix) of management actions to be applied each time step. `round` Logical. Should the projections be rounded to the next integer each time step (i.e. consider finite indiviuals)? `object` An object of class `rmas`, i.e. resulting from `projectn`. `x` An object resulting from `projectn` or `summary.rmas`. `stage` Print only the trajectory of the stage called ... `harvest` Logical. Should the harvest history be summarized or ploted instead of the population one? `sum` Logical. If `TRUE`, print the trajectory of the whole population. If `FALSE`, print the individual trajectory of all stages. `mean` Logical. If `TRUE`, print the mean trajectory of all replications. If `FALSE`, print all the replicated trajectories. `type` Type of plot to represent the trajectories. By default, a line. `ylim` Vector with max and min values of the y (abundances) axis. `col` Color or vector of colors to draw the trajectories. `xlab` Label for the x-axis. `ylab` Label for the y-axis. `main` Text to appear as title. `...` Other parameters passed to plot and other methods.

## Details

The function `projectn` makes demographic proyections by repetedly calling (as long as the time argument) to `project1`. If no environmental or demographic stochasticity is required, `project1` will multiply the transition matrix `mat` by the vector of stage abundances.

If demographic stochasticity is required, `project1` will call to `estdemo` function, that for each time will assign abundances to each stage based in sampling from both a binomial and a poisson distribution. Sampling from rbinom with probability `mat[i,j]` will assign "survival" chances to each individual accounted for in the abundance vector, i.e. it would allow some of them to remain in the same stages (for transitions `mat[i,i]`) or to pass to another stage (for transitions `mat[i,j]`). Sampling from rpois with mean `mat[i,j]` will assign to each individual of `stage[j]` a random number of offspring of type `stage[i]`.

In the current implementation there are 3 options to generate demographic stochasticity. By deafult ( `stmat=NULL` and `fecundity1=TRUE`) probabilities in the first row of the transition matrix (i.e `mat[1,j]`) are assumed to represent only fecundities, i.e., they would not account for "survival" transitions from stage[j] to stage, but only for newborns. This means that these probabilities will only be used as the mean for sampling from rpois. Transitions in rows others than first row will be assumed to represent "survival" transitions if its value is <=1 and accordingly will be employed to sample from rbinom. Transitions >1 will be assumed to represent fecundities and will be employed to sample from rpois.

If `stmat=NULL` and `fecundity1=FALSE` transition probabilities in all the rows of the matrix `mat` are treated in the same way, i.e. probabilities <=1 will be sampled from rbinom and probabilities >1 will be sampled from rpois.

If a `stmat` matrix (a matrix with values between 0 and 1) is provided, it will be used to divide transition probabilities `mat[i,j]` into fecundities (`mat[i,j] * stmat[i,j]`) and survival probabilities (`mat[i,j] - (mat[i,j] * stmat[i,j])`) and these matrices will be used to sample from rbinom and rpois respectively.

The current implementation of `estdemo` assumes that reproduction takes place before "survival sorting", so even for individuals that wouldn't survive (according to its sampled binomial probability) offspring is computed (if approppriate) and accounted for.

If environmental stochasticity is required (i.e., a `matsd` matrix is provided), `project1` will call to `estambi` function, that for each time will change `mat[i,j]` probabilities sampling from rnorm with `mean= mat[i,j]` and `sd = matsd[i,j]`. If `equalsign=TRUE` the random changes in all cells of `mat` will have the same sign and the same magnitude (relative to each individual `matsd[i,j]`). If `equalsign=FALSE` every transition probability will change independently.

If both environmental and demographic stochasticity are required `project1` will call first to `estambi` and using the modified `mat` will call to `estdemo`.

If management is required, a vector or matrix of magement actions should be provided. In the simplest case (i.e., a vector), each element in the vector will be interpreted as the management action that will be applied each time step to the corresponding stage. Positive and negative elements in the vector represent respectively the introduction or extraction of individuals from the corresponding stage. Elements whose absolute value is >= 1 will be interpreted as the introduction or extraction of exactly that number of individuals; absolute values < 1 will be interpreted as the introduction or extraction of that proportion of individuals from the existing individuals in the corresponding stage. If "management" is a matrix, each time step the management actions represented by each column of the matrix will be applied sequentially, from first to last.

## Value

`project1`, `estdemo` and `estambi` return a vector of stage abundances with the same length that `v0`.

`projectn` return an object of class `rmas`, basically a list with four elements: `vn`, with length = (`nrep`) where each of its elements represents a replicate simulation and consist of a matrix of dimensions `[lengtth(v0), time]` representing the abundance of each stage at each time. If the simulation included management actions, `harvest` will be a list of length (`nrep`) where each of its elements represents the trajectory of harvest in a replicate simulation and consist of a matrix of dimensions `[lengtth(v0), time]` representing the number of individuals extracted of each stage at each time. The other two elements, `mat` and `management`, are respectively the transition matrix and the managenet matrix employed in the simulations. The `plot` method will draw the demographic trajectory of the population. By default (`sum = TRUE, mean=FALSE`) it will plot the abundance of the whole population (i.e. the the sum of abundances in each stage) vs. time. If nrep >1 it will plot together the trajectory of each replicated population. If ( `sum = TRUE, mean=TRUE`) it will plot the mean of all repplicated populations. If (`sum = FALSE, mean=TRUE`) it wil plot the abundance (or the mean abundance in all the replications) of each stage vs. time.

The `summary` and `plot.summary` methods will print a table and draw a plot respectively with the maximun, mean + 1 sd, mean, mean - 1 sd and minimum values of population abundance in all the simulations.

## Author(s)

Marcelino de la Cruz Rot

## References

Akcakaya, H. R., Burgman, M. A. and Ginzburg L.R. 1999. Applied Population Ecology. Sinauer.

Caswell, H. 2003. Matrix Population Models: Construction, Analysis, and Interpretation . Sinauer.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56``` ``` data(coryphanthaA) coryphanthaA <- as.tmatrix(coryphanthaA) # run a deterministic simulation of 20 years from an initial state of # 100 small juveniles: v0 <- c(100,0,0) simu20 <- projectn(v0=v0, mat=coryphanthaA, time = 20) plot(simu20, sum=FALSE) summary(simu20) # run 100 simulations of 20 years with demographic stochasticity: simu20.ds <- projectn(v0=v0, mat=coryphanthaA, time = 20, estdem=TRUE, nrep=100) plot(simu20.ds) summary(simu20.ds) # run 100 simulations of 20 years with demographic stochasticity but # assuming that the first row of the transition matrix represent both # fecundity and survival, each with a 50% contribution # first generate the stmat matrix: stmat <- (coryphanthaA >0) stmat <- stmat*c(0.5,0,0) stmat simu20.ds2 <- projectn(v0=v0, mat=coryphanthaA, time = 20, estdem=TRUE, stmat=stmat, nrep=100) plot(simu20.ds2) summary(simu20.ds2) # run 100 simulations of 20 years with both demographic and environmental # stochasticity: # first generate a sd matrix to describe environmental stochasticity: sdenv <- coryphanthaA/20 sdenv simu20.eds <- projectn(v0=v0, mat=coryphanthaA, matsd =sdenv, time = 20, estdem=TRUE,estamb=TRUE, nrep=100) plot(simu20.eds) summary(simu20.eds) # Example of management actions # each time step, 10 individuals will be added to the first stage ,10 individuals # will be added to the second stage, and 50 percent of the individuals in the # third stage will be extracted man <- c(10, 10, -0.5) p1 <- projectn(v0 = c(100, 100,100), mat= coryphanthaA, management=man) # summarize and plot population trajectory summary(p1) # summarizes and plots harvest history summary(p1, harvest=TRUE) ```

Rramas documentation built on May 2, 2019, 6:52 a.m.