Description Usage Arguments Details Value Note Author(s) Source References See Also Examples

This function runs a series of stochastic PVA population projections by sampling vital rates from a beta, stretched beta, or lognormal distribution and includes within-year, auto-, and cross-correlations.

1 2 3 |

`vrmeans` |
means of vital rates |

`vrvars` |
variance of vital rates |

`corrin` |
within year correlation |

`corrout` |
between year correlations |

`makemx` |
a function that creates a square projection matrix
from a vector of |

`n0` |
initial population vector |

`yrspan` |
the number of years of correlations to build into the M12 matrix |

`Ne` |
quasi-extinction threshold |

`tmax` |
latest time to calculate extinction probability, default 50 |

`runs` |
the number of trajectories, default is 500. 1000 is recommended |

`vrtypes` |
identifies the distribution for each rate in vrmeans where 1 = beta, 2 = stretched beta, 3 = lognormal, default is all ones |

`vrmins` |
minimum value for each vital rate; use zeros for rates that are not stretched betas, default is all zeros |

`vrmaxs` |
maximum value for each vital rate; use zeros for rates that are not stretched betas, default is all zeros |

`sumweight` |
a vector of weights, with 0 to omit a class and 1 to include it when computing the summed density to compare to the quasi-extinction threshold, default is to include all classes |

Vital rates used must be either fertility values or binomial probabilities, i.e., probabilities for events with only two possible outcomes (such as survival). Means and variances of the vital rates should preferably be corrected to remove sampling errors and demographic stochasticity. Note that this version of the function does not simulate demographic stochasticity and is density-independent.

The function plots a histogram of log stochastic growth rates and the cumulative probability of quasi-extinction and returns a list with 4 items:

`detLambda` |
the deterministic population growth rate computed from the mean matrix |

`stochlambda` |
the mean stochastic growth rate with 95% confidence intervals. |

`logLambdas` |
a vector of all log stochastic growth rates in first plot |

`CDFExt` |
a vector of cumulative probabilities of quasi-extinction in second plot |

The correlation matrices for *Hudsonia* in
Morris and Doak 2002 include some
correlations > 1. A corrected set of correlations was sent by D. Doak
on 8/4/2007. Therefore the results from the simulation below are
different than the book.

Original MATLAB program by Morris and Doak (2002: 301 - 304). Adapted to R by Patrick Nantel, 12 July 2005.

converted Matlab code from Box 8.10 in Morris and Doak (2002)

Morris, W. F., and D. F. Doak. 2002. Quantitative conservation biology: Theory and practice of population viability analysis. Sinauer, Sunderland, Massachusetts, USA.

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 | ```
## load vital rates and correlation matrices
data(hudvrs)
data(hudcorrs)
## set vrtypes
hudvrtypes <- c(rep(1,13), rep(3,5), rep(1,6))
## run Full model- using 100 runs here for speed
full <- vitalsim(hudvrs$mean, hudvrs$var, hudcorrs$corrin,
hudcorrs$corrout, hudmxdef, vrtypes=hudvrtypes,
n0=c(4264,3,30,16,25,5), yrspan=20 , runs=100)
## deterministic and stochastic lambda
full[1:2]
## log stochastic lambda
log(full$stochLambda)
sd(full$logLambdas)
## SKIP the next two simulations- however, sample output is included for plotting
#NO between year correlations so corrout = diag(0,13) - all zeros
# no.between <- vitalsim(hudvrs$mean, hudvrs$var, hudcorrs$corrin,
# diag(0,13), hudmxdef, vrtypes=hudvrtypes,
# n0=c(4264,3,30,16,25,5), yrspan=20 )
no.between <- list(CDFExt=c(rep(0,40),0.01,0.04,0.12,0.15,
0.20,0.31,0.49,0.58,0.72,0.78))
#NO correlations so corrout = diag(0,13) AND corrin=diag(13) - ones on diagonal
# no.corr<-vitalsim(hudvrs$mean, hudvrs$var, diag(13),
# diag(0,13), hudmxdef, vrtypes=hudvrtypes,
# n0=c(4264,3,30,16,25,5), yrspan=20 )
no.corr <- list(CDFExt=c(rep(0,39),0.03,0.03,0.06,0.12,0.20,
0.30,0.42,0.52,0.65,0.76,0.83))
## Figure 8.3 with corrected correlation matrices for full model
matplot(cbind(a=full$CDFExt, no.between$CDFExt, no.corr$CDFExt), type='l',
ylim=c(0,1), lty=1:3, col=2:4, lwd=2, las=1,
xlab="Years into the future", ylab="Cumulative probability of quasi-extinction")
legend(2,1, c("Full model", "No between-year correlations", "No correlations"),
lty=1:3, col=2:4, lwd=2)
``` |

```
[1] Generating beta distributed values for vital rates
[1] Calculating the multi-year correlation matrix
[1] Correcting negative eigenvalues
[1] Running projections to get growth rate and extinction risk
[1] Starting run 1
[1] Starting run 10
[1] Starting run 20
[1] Starting run 30
[1] Starting run 40
[1] Starting run 50
[1] Starting run 60
[1] Starting run 70
[1] Starting run 80
[1] Starting run 90
[1] Starting run 100
$detLambda
[1] 0.9585986
$stochLambda
lambda lc uc
0.9554607 0.9412566 0.9698791
lambda lc uc
-0.04556169 -0.06053953 -0.03058385
[1] 0.007641753
```

popbio documentation built on May 4, 2018, 1:04 a.m.

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.