R: Estimates survivorship between two time censuses.
survivorship
R Documentation
Estimates survivorship between two time censuses.
Description
Calculates the fraction of the cohort surviving across age for a chosen starting continuous stage value.
Usage
survivorship(IPMmatrix, loc, maxAge)
Arguments
IPMmatrix
an IPMmatrix object describing growth and survival transitions across stage (e.g. size) and environment.
loc
a starting size location in the IPM matrix for age 1 (i.e., either the index
of the desired size in the meshpoints, or, if there are discrete stages, the index
+ the number of discrete stages; if this is not an integer, then it will be assumed that the rounded version is desired)
maxAge
the maximum age up to which survivorship is desired for or possible.
Value
surv.curv
vector of length maxAge providing survivorship at each
age from 1 to maxAge.
stageAgeSurv
matrix of dimensions nBigMatrix*maxAge providing
the population structure at every age for a cohort starting with an
individual of size size1.
mortality
vector of length maxAge providing mortality at each
age from 1 to maxAge.
Author(s)
C. Jessica E. Metcalf, Sean M. McMahon, Roberto Salguero-Gomez, Eelke Jongejans & Cory Merow.
References
Tuljapurkar & Horvitz. 2006. From stage to age in variable
environments. Life expectancy and survivorship. Ecology 87, p1497-1509.
Examples
# For only continuous stages (e.g. size)
dff <- generateData()
Pmatrix <- makeIPMPmatrix(minSize = min(dff$size, na.rm = TRUE),
maxSize = max(dff$size, na.rm = TRUE), growObj = makeGrowthObj(dff),
survObj = makeSurvObj(dff))
su <- survivorship(Pmatrix, 1, 300)
plot(su$surv.curv, type = "l", col = "dark gray", ylab = "survivorship",
xlab= "Continuous (e.g. size) stage", ylim = c(0,1))
# For continuous (e.g. size) and discrete (e.g. seedbank) stages
Pmatrix <- makeCompoundPmatrix(minSize = min(dff$size,na.rm = TRUE),
maxSize = max(dff$size,na.rm = TRUE), envMatrix = makeEnvObj(dff),
growObj = makeGrowthObj(dff, Formula = sizeNext~size+size2+covariate),
survObj = makeSurvObj(dff, Formula = surv~size+size2+covariate),
discreteTrans = 1)
su <- survivorship(Pmatrix,1,300)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(IPMpack)
Loading required package: Matrix
Loading required package: MASS
Loading required package: nlme
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/IPMpack/survivorship.Rd_%03d_medium.png", width=480, height=480)
> ### Name: survivorship
> ### Title: Estimates survivorship between two time censuses.
> ### Aliases: survivorship
>
> ### ** Examples
>
> # For only continuous stages (e.g. size)
> dff <- generateData()
> Pmatrix <- makeIPMPmatrix(minSize = min(dff$size, na.rm = TRUE),
+ maxSize = max(dff$size, na.rm = TRUE), growObj = makeGrowthObj(dff),
+ survObj = makeSurvObj(dff))
> su <- survivorship(Pmatrix, 1, 300)
> plot(su$surv.curv, type = "l", col = "dark gray", ylab = "survivorship",
+ xlab= "Continuous (e.g. size) stage", ylim = c(0,1))
>
> # For continuous (e.g. size) and discrete (e.g. seedbank) stages
> Pmatrix <- makeCompoundPmatrix(minSize = min(dff$size,na.rm = TRUE),
+ maxSize = max(dff$size,na.rm = TRUE), envMatrix = makeEnvObj(dff),
+ growObj = makeGrowthObj(dff, Formula = sizeNext~size+size2+covariate),
+ survObj = makeSurvObj(dff, Formula = surv~size+size2+covariate),
+ discreteTrans = 1)
> su <- survivorship(Pmatrix,1,300)
>
>
>
>
>
> dev.off()
null device
1
>