meanLifeExpect: Extracts 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 object of class IPMmatrix

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
46
47
48
49
 
## Not run: 
# 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=""))	
}

## End(Not run)

levisc8/IPMpack documentation built on May 7, 2019, 3:20 p.m.