R: Estimates passage time in a discretely varying environment.
stochPassageTime
R Documentation
Estimates passage time in a discretely varying environment.
Description
Estimates the time in units of the chosen time steps (see convertIncrement()) that it will take to reach a chosen continuous stage value for the first time conditional on surviving from each of the meshpoints of the IPM for each starting environment.
numeric, target size for which passage time is desired.
IPMmatrix
object of class IPMmatrix describing survival related transitions only.
envMatrix
object of class envMatrix describing transitions between discrete environmental states.
Details
Passage time for values exactly equal to the target size are one year, because of how the conditionals are framed. Values slightly less than the target size may on average take longer due to variance in growth, mortality, leading to discontinuities in the pattern of passage time over age. Passage time from values > than the chosenSize should be ignored (space to the right of the red vertical line in example below).
Value
vector containing passage times across size in the first discrete environmental state, then in the second, etc.
Author(s)
C. Jessica E. Metcalf, Sean M. McMahon, Roberto Salguero-Gomez & Eelke Jongejans
References
Caswell, 2001. Matrix population models: analysis, construction and
interpretation. 2nd ed. Sinauer.
Metcalf, Horvitz, Tuljapurkar, Clark. 2009. A time to grow and a time to die: a new way to analyze the dynamics of size, light, age and death of tropical trees. Ecology 90, p2766-2778.
For bias in this estimation where variance in growth is small relative to the size range: Zuidema, Jongejans, Chien, During & Schieving. 2010. Integral Projection Models for trees: a new parameterization method and a validation of model output. Journal of Ecology 98, p345-355.
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/stochPassageTime.Rd_%03d_medium.png", width=480, height=480)
> ### Name: stochPassageTime
> ### Title: Estimates passage time in a discretely varying environment.
> ### Aliases: stochPassageTime
>
> ### ** Examples
>
> dff <- generateData()
> Pmatrix <- makeCompoundPmatrix(minSize = min(dff$size, na.rm = TRUE),
+ maxSize=max(dff$size, na.rm = TRUE),
+ growObj = makeGrowthObj(dff, Formula=sizeNext~size+covariate),
+ survObj = makeSurvObj(dff, Formula = surv~size+covariate),
+ envMatrix = makeEnvObj(dff), correction="constant")
> targetSize <- 8
>
> passage <- stochPassageTime(targetSize, Pmatrix, makeEnvObj(dff))
>
> plot(Pmatrix@meshpoints,passage[1:length(Pmatrix@meshpoints)],
+ ylab = "Passage time", xlab = "Continuous (e.g. size) stage",
+ type = "l", col = "dark gray",
+ xlim=c(Pmatrix@meshpoints[1],targetSize),
+ ylim = c(0, max(passage)))
> abline(v = targetSize, col = "red")
> points(Pmatrix@meshpoints,
+ passage[(length(Pmatrix@meshpoints)+1):(2*length(Pmatrix@meshpoints))],
+ type="l",col="green")
>
>
>
>
>
> dev.off()
null device
1
>