Uses fecundity object, and environmental transition objects to construct a matrix defining probabilities for transitions between sizes due to fecundity given both a continuous state (e.g. size) and environmental state, as well as a discrete stage if necessary (e.g. seedbank).
NOTE - old createCompoundFmatrix is being deprecated; use makeCompoundFmatrix instead.
numeric, number of environmental classes, defaults to 2.
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.
envMatrix
envMatrix object defining transitions between environmental states
for each size.
fecObj
fecundity object.
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 total fertility 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.
preCensus
logical (TRUE or FALSE), indicating whether the fecundity object should
represent 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 (preCensus=FALSE)
requires additional survObj and growObj, to cover the survival and growth
of the parents until the reproduction event.
survObj
suvival object, describing the survival of parents from a census until
the reproduction event starts (at some point during the inter-census time step.
growObj
growth object, describing the growth of parents that survive until the
reproduction event starts. Warning: this growth object is still ignored in
makeIPMFmatrix in the current version of IPMpack. It will become functional
in coming versions.
offspringObj
growth object, describing the size of offspring (this process may alternatively appear in fecObj).
Value
an object of class IPMmatrix with dimensions
nBigMatrix*nEnvClass, or if discrete transitions exist
(nBigMatrix+nDisc)*nEnvClass
Author(s)
C. Jessica E. Metcalf, Sean M. McMahon, Roberto Salguero-Gomez, Eelke Jongejans & Cory Merow.
References
For information on F matrix: Caswell. 2001. Matrix population models: construction, analysis, and interpretation. 2nd ed. Sinauer. p110-112.
For midpoint: Zuidema, Jongejans, Chien, During & Schieving. Integral projection models for trees: a new parameterization method and a validation of model output. Journal of Ecology 98, p345-355.
For multiple-vital rate integration on fecundity: Yang, Jongejans, Yang & Bishop. 2011. The effect of consumers and mutualists of Vaccinum membranaceum at Mount St. Helens: dependence on successional context. PLoS One 10, p1-11.
See Also
makeCompoundPmatrix,makeIPMFmatrix
Examples
# Data with only continuous stage and two habitats
dff <- generateData()
dff$fec[dff$fec==0] <- NA
Fmatrix <-makeCompoundFmatrix(nBigMatrix = 20,
minSize = min(dff$size, na.rm = TRUE),
maxSize = max(dff$size, na.rm=TRUE),
envMatrix = makeEnvObj(dff),
fecObj = makeFecObj(dff, Formula = fec~size+size2+covariate,
Transform = "log"))
image(1:nrow(Fmatrix), 1:ncol(Fmatrix), t(log(Fmatrix)),
xlab="Continuous state (e.g. size) at t",
ylab="Continuous state (e.g. size) at t+1", axes = FALSE)
axis(1, at = 1:nrow(Fmatrix), lab = round(rep(Fmatrix@meshpoints,
Fmatrix@nEnvClass), 2))
axis(2,at = 1:nrow(Fmatrix), lab = round(rep(Fmatrix@meshpoints,
Fmatrix@nEnvClass), 2))
abline(h = length(Fmatrix@meshpoints)*(1:Fmatrix@nEnvClass))
abline(v = length(Fmatrix@meshpoints)*(1:Fmatrix@nEnvClass))
# Data with continuous and discrete stages
dff <- generateData(type="discrete")
dff$fec[dff$fec==0] <- NA
dff$covariate <- sample(1:3, size = nrow(dff), replace = TRUE)
dff$covariateNext <- sample(1:3, size = nrow(dff), replace = TRUE)
fv1 <- makeFecObj(dff, Formula = fec~size, Transform = "log",
offspringSplitter=data.frame(continuous = 0.9, dormant = 0.1))
Fmatrix <- makeCompoundFmatrix(minSize = min(dff$size, na.rm=TRUE),
maxSize = max(dff$size, na.rm = TRUE), envMatrix = makeEnvObj(dff),
fecObj = fv1)
Results
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/makeCompoundFmatrix.Rd_%03d_medium.png", width=480, height=480)
> ### Name: makeCompoundFmatrix
> ### Title: Builds a compound F matrix.
> ### Aliases: makeCompoundFmatrix createCompoundFmatrix
>
> ### ** Examples
>
> # Data with only continuous stage and two habitats
> dff <- generateData()
> dff$fec[dff$fec==0] <- NA
> Fmatrix <-makeCompoundFmatrix(nBigMatrix = 20,
+ minSize = min(dff$size, na.rm = TRUE),
+ maxSize = max(dff$size, na.rm=TRUE),
+ envMatrix = makeEnvObj(dff),
+ fecObj = makeFecObj(dff, Formula = fec~size+size2+covariate,
+ Transform = "log"))
>
> image(1:nrow(Fmatrix), 1:ncol(Fmatrix), t(log(Fmatrix)),
+ xlab="Continuous state (e.g. size) at t",
+ ylab="Continuous state (e.g. size) at t+1", axes = FALSE)
> axis(1, at = 1:nrow(Fmatrix), lab = round(rep(Fmatrix@meshpoints,
+ Fmatrix@nEnvClass), 2))
> axis(2,at = 1:nrow(Fmatrix), lab = round(rep(Fmatrix@meshpoints,
+ Fmatrix@nEnvClass), 2))
> abline(h = length(Fmatrix@meshpoints)*(1:Fmatrix@nEnvClass))
> abline(v = length(Fmatrix@meshpoints)*(1:Fmatrix@nEnvClass))
>
> # Data with continuous and discrete stages
> dff <- generateData(type="discrete")
> dff$fec[dff$fec==0] <- NA
> dff$covariate <- sample(1:3, size = nrow(dff), replace = TRUE)
> dff$covariateNext <- sample(1:3, size = nrow(dff), replace = TRUE)
> fv1 <- makeFecObj(dff, Formula = fec~size, Transform = "log",
+ offspringSplitter=data.frame(continuous = 0.9, dormant = 0.1))
[1] "Warning - offspring splitter indicates more than just continuous stages. No fecundity by the discrete stages supplied in fecByDiscrete; assumed that is 0"
> Fmatrix <- makeCompoundFmatrix(minSize = min(dff$size, na.rm=TRUE),
+ maxSize = max(dff$size, na.rm = TRUE), envMatrix = makeEnvObj(dff),
+ fecObj = fv1)
[1] "Dim of envMatrix not equal to nEnvClass. Adjusted to 3"
>
>
>
>
>
> dev.off()
null device
1
>