meanLifeExpect: Calculates the mean life expectancy.

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

View source: R/IPMpack-Analyses.r

Description

Provided a P matrix, which defines survival transitions across stages, this function outputs a vector defining life expectancy in units of the time step used (see convertIncrement()), for each of the size bins.

Usage

1
meanLifeExpect(IPMmatrix)

Arguments

IPMmatrix

an IPMmatrix object defining survival transitions.

Details

Note that more complex approaches for discretely varying environments (e.g., as in Tuljapurkar & Horvitz 2006.) have yet to be implemented.

Value

A vector of life expectancies each corresponding to a value of the size bins defined by Pmatrix@meshpoints.

Author(s)

C. Jessica E. Metcalf, Sean M. McMahon, Roberto Salguero-Gomez, Eelke Jongejans & Cory Merow.

References

Caswell, 2001. Matrix population models: analysis, construction and interpretation. 2nd ed. Sinauer. p118-120.

Cochran & Ellner. 1992. Simple methods for calculating age-based life history parameters for stage-structured populations. Ecological Monographs 62, p345-364.

Tuljapurkar & Horvitz. 2006. From stage to age in variable environments. Life expectancy and survivorship. Ecology 87, p1497-1509.

See Also

makeIPMPmatrix

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
# With a single continuous state variable (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))
meanLifeExpect(Pmatrix)

Pmatrix <- makeIPMPmatrix(minSize = min(dff$size, na.rm = TRUE),
maxSize = max(dff$size, na.rm = TRUE), growObj = makeGrowthObj(dff),
survObj = makeSurvObj(dff))

plot(meanLifeExpect(Pmatrix), ylab = "Mean life expectancy", 
xlab = "Continuous (e.g. size) stage", type = "l", col="dark gray", 
ylim = c(0,max(meanLifeExpect(Pmatrix))))

# With continuous (e.g. size) and discrete (e.g. seedbank) stages:
dff <- generateData(type="discrete")
dff$covariate <- sample(1:3, size = nrow(dff), replace = TRUE)
dff$covariateNext <- sample(1:3, size = nrow(dff), replace = TRUE)
discM <- makeDiscreteTrans(dff)
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 = discM)
mLE <- meanLifeExpect(Pmatrix)

# showing three environments on different panels, 
# life expectancy of discrete stages
# shown at level of the first size class
par(mfrow=c(max(Pmatrix@env.index),1))

xvals <- c(rep(Pmatrix@meshpoints[1],ncol(discM@discreteTrans)-1),
    Pmatrix@meshpoints)

for (k in 1:max(Pmatrix@env.index)) { 
	indx <- ((k-1)*(ncol(discM@discreteTrans)-1+length(Pmatrix@meshpoints))+1):
		(k*(ncol(discM@discreteTrans)-1+length(Pmatrix@meshpoints)))
	
	plot(xvals,mLE[indx], 
		ylab = "Mean life expectancy", 
		xlab = "Continuous (e.g. size) and discrete (e.g. seedbank) stages", 
		type = "l", col = "dark gray", ylim = c(0,max(mLE)), 
		main=paste("habitat ",k,sep=""))	
	}

Example output

Loading required package: Matrix
Loading required package: MASS
Loading required package: nlme
 [1] 1.259288 1.291546 1.322998 1.353213 1.381939 1.409107 1.434799 1.459219
 [9] 1.482645 1.505385 1.527751 1.550029 1.572467 1.595273 1.618613 1.642618
[17] 1.667389 1.693009 1.719541 1.747038 1.775547 1.805105 1.835747 1.867505
[25] 1.900405 1.934472 1.969727 2.006190 2.043875 2.082796 2.122961 2.164377
[33] 2.207045 2.250965 2.296130 2.342528 2.390141 2.438938 2.488875 2.539882
[41] 2.591849 2.644602 2.697869 2.751231 2.804055 2.855421 2.904031 2.948137
[49] 2.985487 3.013327
[1] "Dim of envMatrix not equal to nEnvClass. Adjusted to 3"

IPMpack documentation built on May 2, 2019, 4:59 p.m.