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

View source: R/IPMpack-Analyses.r

Uses perturbation to estimate the sensitivity and elasticity of all the parameters underlying an IPM.

1 2 3 4 5 6 7 8 | ```
sensParams(growObj, survObj, fecObj=NULL, clonalObj=NULL,
nBigMatrix, minSize, maxSize,
chosenCov = data.frame(covariate = 1), discreteTrans = 1,
integrateType = "midpoint", correction = "none", preCensusFec = TRUE,
postCensusSurvObjFec = NULL, postCensusGrowObjFec = NULL,
preCensusClonal = TRUE, postCensusSurvObjClonal = NULL,
postCensusGrowObjClonal = NULL, delta = 1e-04,
response="lambda", chosenBin=1)
``` |

`growObj` |
a growth object. |

`survObj` |
a survival object. |

`fecObj` |
a fecundity object (not necessary for life expectancy analysis). |

`clonalObj` |
a clonality object (not necessary for life expectancy analysis). |

`nBigMatrix` |
numeric, number of bins of size used in the IPM matrix. |

`minSize` |
numeric, minimum size used for meshpoints of the IPM matrix. |

`maxSize` |
numeric, maximum size used for meshpoints of the IPM matrix. |

`chosenCov` |
level or value of the covariate(s) at which sensitivity estimation is desired |

`discreteTrans` |
matrix of discrete transitions; or 1 if there is none |

`integrateType` |
integration type, defaults to "midpoint" (which uses probability density function); other option is "cumul" (which uses the cumulative density function) |

`correction` |
correction type, defaults to |

`preCensusFec` |
logical (TRUE or FALSE), indicating whether the fecundity object represents an interval between pre-breeding or a post-breeding censusses. Defaults to TRUE (pre-breeding census), meaning that all reproduction and offspring rates required for the F matrix are embedded in fecObj. Alternatively, an F matrix based on post-breeding census (preCensusFec=FALSE) uses postCensusSurvObjFec and postCensusGrowObjFec, to cover the survival and growth of the parents until the reproduction event. (not necessary for life expectancy analysis) |

`postCensusSurvObjFec` |
survival object representing the survival of the parents until the reproduction event. If not specified (and preCensusFec = FALSE) it is assumed that all parents survive until the reproduction event. (not necessary for life expectancy analysis) |

`postCensusGrowObjFec` |
growth object representing the growth of surviving parents until the reproduction event. If not specified (and preCensusFec = FALSE) it is assumed that the parents do not grow until the reproduction event. (not necessary for life expectancy analysis) |

`preCensusClonal` |
logical (TRUE or FALSE), indicating whether the clonality object represents an interval between pre-breeding or a post-'breeding' censusses. Defaults to TRUE (pre-'breeding' census), meaning that all clonal propagation and offspring rates required for the C matrix are embedded in clonalObj. Alternatively, an C matrix based on post-'breeding' census (preCensusClonal=FALSE) uses postCensusSurvObjClonal and postCensusGrowObjClonal, to cover the survival and growth of the parents until the clonal propagation event. (not necessary for life expectancy analysis) |

`postCensusSurvObjClonal` |
survival object representing the survival of the parents until the clonal propagation event. If not specified (and preCensusClonal = FALSE) it is assumed that all parents survive until the clonal propagation event. (not necessary for life expectancy analysis) |

`postCensusGrowObjClonal` |
growth object representing the growth of surviving parents until the clonal propagation event. If not specified (and preCensusClonal = FALSE) it is assumed that the parents do not grow until the clonal propagation event. (not necessary for life expectancy analysis) |

`delta` |
size of the perturbation desired |

`response` |
whether lambda, R0 or life expectancy of a desired bin (lifeExpect with chosenBin) is required |

`chosenBin` |
for analysis of life expectancy, which bin in the IPM Life expectancy should be compared for |

The values returned by sensParam are calculated by first calculating lambda for the chosen IPM; then modifying the focal parameter c by a very small amount, c.new=c*(1+delta) (the default for delta =1e-4, but users may specify the value that they want). The function then rebuilds the T and F matrices, and re-calculates lambda. Sensitivity is calculated as:

sens = df(x)/dx = (lam.new-lam)/(c*delta)

i.e., the function estimates the degree to which a small change in the parameter results in a small change in lambda; and elasticity is calculated as:

elas = sens*c/lam = (lam.new-lam)/(lam*delta)

which corresponds to the proportional change in lambda as an outcome of the proportional change in the parameter; analagous calculations are used for R0 and life expectancy.

NOTE: in previous versions of IPMpack (pre 2.0), the output of this function was mis-aligned.

`sens ` |
a vector of sensitivities of lambda or other variable with names corresponding to parameters. |

`elas ` |
a vector of elasticities to lambda or other variable with names corresponding to parameters. |

Modified following code developed by Rees & Rose 2002 (above).

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

Rees and Rose. 2002. Evolution of flowering strategies in Oenothera glazioviana: an integral projection model approach. Proceedings of the Royal Society London Seres B 269, p1509-1515.

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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | ```
dff <- generateData()
#lambda
res <- sensParams(growObj = makeGrowthObj(dff),
survObj = makeSurvObj(dff), fecObj = makeFecObj(dff, Transform="log"),
nBigMatrix = 50, minSize = min(dff$size, na.rm=TRUE),
maxSize = max(dff$size, na.rm = TRUE))
par(mfrow = c(2, 1), bty = "l", pty = "m")
barplot(res$sens,
main = expression("Parameter sensitivity of population growth rate "* lambda),
las = 2, cex.names = 0.5)
barplot(res$elas,
main = expression("Parameter elasticity of population growth rate "* lambda),
las = 2, cex.names = 0.5)
#R0
resR0 <- sensParams(growObj = makeGrowthObj(dff),
survObj = makeSurvObj(dff), fecObj = makeFecObj(dff, Transform="log"),
nBigMatrix = 50, minSize = min(dff$size, na.rm=TRUE),
maxSize = max(dff$size, na.rm = TRUE), response="R0")
par(mfrow = c(2, 1), bty = "l", pty = "m")
barplot(resR0$sens,
main = expression("Parameter sensitivity of net reproductive rate R"[0]),
las = 2, cex.names = 0.5)
barplot(resR0$elas,
main = expression("Parameter elasticity of net reproductive rate R"[0]),
las = 2, cex.names = 0.5)
#life expectancy
resLE <- sensParams(growObj = makeGrowthObj(dff),
survObj = makeSurvObj(dff), nBigMatrix = 50,
minSize = min(dff$size, na.rm=TRUE), maxSize = max(dff$size, na.rm =
TRUE), chosenBin=1, response="lifeExpect")
par(mfrow = c(2, 1), bty = "l", pty = "m")
barplot(resLE$sens,
main = expression("Parameter sensitivity of Life Expectancy"*eta[0]),
las = 2, cex.names = 0.5)
barplot(resLE$elas,
main = expression("Parameter elasticity of Life expectancy"*eta[0]),
las = 2, cex.names = 0.5)
# Same as lambda above, but with two fecundity functions
dff$fec2 <- dff$fec>0 #create binomial describing e.g., prob of flowering
dff$fec[dff$fec==0] <- NA #take out zeros to avoid Inf when fit with log
fv1 <- makeFecObj(dff, Formula = c(fec~size+size2,fec2~size),
Transform=c("log","none"),Family = c("gaussian","binomial"))
res <- sensParams(growObj=makeGrowthObj(dff), survObj = makeSurvObj(dff),
fecObj = fv1, nBigMatrix = 50, minSize = min(dff$size, na.rm = TRUE),
maxSize = max(dff$size, na.rm = TRUE))
par(mfrow = c(2, 1), bty = "l", pty = "m")
barplot(res$sens,
main = expression("Parameter sensitivity of population growth rate " *lambda),
las = 2, cex.names = 0.5)
barplot(res$elas,
main = expression("Parameter elasticity of population growth rate " *lambda),
las = 2, cex.names = 0.5)
# Same but with two fecundity functions and a constant
fv1@fecConstants[1] <-0.5
res <- sensParams(growObj = makeGrowthObj(dff), survObj = makeSurvObj(dff),
fecObj = fv1, nBigMatrix = 50, minSize = min(dff$size, na.rm = TRUE),
maxSize = max(dff$size, na.rm = TRUE))
par(mfrow = c(2, 1), bty = "l", pty = "m")
barplot(res$sens,
main = expression("Parameter sensitivity of population growth rate " *lambda),
las = 2, cex.names = 0.5)
barplot(res$elas,
main = expression("Parameter elasticity of population growth rate " *lambda),
las = 2, cex.names = 0.5)
# Same but with a discrete class
dff <- generateData(type="discrete")
res <- sensParams(growObj = makeGrowthObj(dff), survObj = makeSurvObj(dff),
fecObj = makeFecObj(dff), discreteTrans=makeDiscreteTrans(dff),
nBigMatrix = 50, minSize = min(dff$size, na.rm = TRUE),
maxSize = max(dff$size, na.rm = TRUE))
par(mfrow = c(2, 1), bty = "l", pty = "m")
barplot(res$sens,
main = expression("Parameter sensitivity of population growth rate " *lambda),
las = 2, cex.names = 0.5)
barplot(res$elas,
main = expression("Parameter elasticity of population growth rate " *lambda),
las = 2, cex.names = 0.5)
``` |

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.