Uses growth and survival objects to construct a matrix defining probabilities for transitions between sizes due to growth and survival. Extensions for transition to discrete classes are possible.
NOTE - old createIPMPmatrix is being deprecated; use makeIPMPmatrix instead.
numeric, number of environmental classes, always = 1 for
non-compound matrices.
nBigMatrix
numeric, number of size bins in the P matrix, defaults to 50.
minSize
numeric, minimum size of the P matrix, defaults to -1.
maxSize
numeric, maximum size of the P matrix, defaults to 50.
chosenCov
data-frame indicating level of the discrete covariate, or
range of values where multiple covariates are modeled.
growObj
growth object.
survObj
survival object.
discreteTrans
object of class discreteTrans, or numeric.
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 none. The first option is constant which will multiply every column of the IPM by a constant sufficient to adjust values to those predicted for survival at that size. The second option is discretizeExtremes which will place all transitions to sizes smaller than minSize into the smallest bin, and transitions to sizes larger than maxSize into the largest bin.
Details
The number of bins (nBigMatrix) is combined with the minimum and
maximum size to define the meshpoints of the IPM. Bins should be
sufficient and the size range should encompass the size range of the
data. If a "discreteTrans" exists, then discrete stages will be added
to the IPM structure. If multiple discrete covariate levels are available,
chosenCov identifies the covariate value for which an IPM is
required; if a series of covariates are being modeled, chosenCov is a
vector of these covariates, and growth will reflect these values.
Value
an object of class IPMmatrix with dimensions nBigMatrix*nBigMatrix, or
nbig.matrix+nrow(discreteTrans).
Author(s)
C. Jessica E. Metcalf, Sean M. McMahon, Roberto Salguero-Gomez, Eelke Jongejans & Cory Merow.
References
Easterling, Ellner & Dixon. 2000. Size-specific sensitivity: a new structured population model. Ecology 81, p694-708.
Ellner & Rees. 2006. Integral projection models for species with complex demography. The American Naturalist 167, p410-428.
For information on P matrix: Caswell. 2001. Matrix population models: construction, analysis, and interpretation. 2nd ed. Sinauer. p110-112.
For information on unintentional eviction from IPMs (which the various corrections try and account for) see Williams et al. 2012 Avoiding unintentional eviction from integral projection models. Ecology.
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/makeIPMPmatrix.Rd_%03d_medium.png", width=480, height=480)
> ### Name: makeIPMPmatrix
> ### Title: Builds P matrices.
> ### Aliases: makeIPMPmatrix createIPMPmatrix
>
> ### ** Examples
>
> dff <- generateData()
> Pmatrix <- makeIPMPmatrix(minSize = min(dff$size, na.rm = TRUE),
+ maxSize=max(dff$size, na.rm=TRUE), growObj = makeGrowthObj(dff),
+ survObj = makeSurvObj(dff))
>
> image(Pmatrix@meshpoints, Pmatrix@meshpoints, t(Pmatrix),
+ xlab = "Continuous (e.g. size) stage at t",
+ ylab = "Continuous (e.g. size) stage at t+1")
>
> Pmatrix <- makeIPMPmatrix(minSize = min(dff$size, na.rm = TRUE),
+ maxSize=max(dff$size, na.rm=TRUE),
+ growObj = makeGrowthObj(dff,regType="changingVar"),
+ survObj = makeSurvObj(dff))
>
> image(Pmatrix@meshpoints, Pmatrix@meshpoints, t(Pmatrix),
+ xlab = "Continuous (e.g. size) stage at t",
+ ylab = "Continuous (e.g. size) stage at t+1")
>
> #example with discrete transition matrix
> dff <- generateData(type="discrete")
> Pmatrix <- makeIPMPmatrix(minSize = min(dff$size, na.rm = TRUE),
+ maxSize=max(dff$size, na.rm=TRUE), discreteTrans=makeDiscreteTrans(dff),
+ growObj = makeGrowthObj(dff),
+ survObj = makeSurvObj(dff))
>
> #discrete stages not plotted
> image(Pmatrix@meshpoints, Pmatrix@meshpoints,
+ t(log(Pmatrix[2:length(Pmatrix@meshpoints),2:length(Pmatrix@meshpoints)])),
+ xlab = "Continuous (e.g. size) stage at t",
+ ylab = "Continuous (e.g. size) stage at t+1")
>
>
>
>
>
>
>
> dev.off()
null device
1
>