Last data update: 2014.03.03

R: Builds IPM matrices.
makeIPMmatrixR Documentation

Builds IPM matrices.

Description

Uses survival/growth, fecundity and optionally clonal kernels to make an IPM kernel.

Usage

makeIPMmatrix(Pmatrix,Fmatrix,Cmatrix=NULL)

Arguments

Pmatrix

A survival/growth kernel constructed with makeIPMPmatrix().

Fmatrix

A fecundity kernel constructed with makeIPMFmatrix().

Cmatrix

A clonal kernel, constructed with makeIPMCmatrix(). Defaults to NULL since clonal reproduction may not be applicable for many species.

Details

A convenience function that makes an IPM kernel from the component kernels with all the same slots. All kernels being combined must have the same dimension, i.e. dim(Pmatrix@.Data) is the same as dim(Fmatrix@.Data).

Value

an object of class IPMmatrix with dimensions nBigMatrix*nBigMatrix, or nbig.matrix+nrow(discreteTrans).

Author(s)

Cory Merow, 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.

See Also

makeIPMPmatrix,makeIPMFmatrix,makeIPMCmatrix, diagnosticsPmatrix, makeDiscreteTrans

Examples

dff <- generateData()
Pmatrix <- makeIPMPmatrix(
						growObj = makeGrowthObj(dff), 
						survObj = makeSurvObj(dff),
						nBigMatrix=20,
						minSize = min(dff$size, na.rm = TRUE), 
						maxSize=max(dff$size, na.rm=TRUE))	
dff$fec[dff$fec==0] <- NA
fv1 <- makeFecObj(dff, Formula = fec~size, Transform = "log")
Fmatrix <- makeIPMFmatrix(
						fecObj = fv1, 
						nBigMatrix = 20, 
						minSize = min(dff$size, na.rm = TRUE), 
						maxSize = max(dff$size, na.rm = TRUE))
IPMmatrix <- makeIPMmatrix(Pmatrix,Fmatrix)
slotNames(IPMmatrix)

require(fields)
par(mfrow=c(2,2))
image.plot(IPMmatrix@meshpoints, IPMmatrix@meshpoints, t(Pmatrix), 
	xlab = "Size(t)", 
	ylab = "Size(t+1)",
	main = "Survival/Growth Kernel")
image.plot(IPMmatrix@meshpoints, IPMmatrix@meshpoints, t(Fmatrix), 
	xlab = "Size (t)", 
	ylab = "Size(t+1)",
	main = "Fecundity Kernel")
image.plot(IPMmatrix@meshpoints, IPMmatrix@meshpoints, t(IPMmatrix), 
	xlab = "Size(t)", 
	ylab = "Size(t+1)",
	main = "IPM Kernel")
# trick to visualize the whole IPM kernel when the Fmatrix has values>>Pmatrix
image.plot(IPMmatrix@meshpoints, IPMmatrix@meshpoints, t(IPMmatrix)^.1, 
	xlab = "Size(t)", 
	ylab = "Size(t+1)",
	main = "IPM Kernel^(.01)")

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/makeIPMmatrix.Rd_%03d_medium.png", width=480, height=480)
> ### Name: makeIPMmatrix
> ### Title: Builds IPM matrices.
> ### Aliases: makeIPMmatrix
> 
> ### ** Examples
> 
> dff <- generateData()
> Pmatrix <- makeIPMPmatrix(
+ 						growObj = makeGrowthObj(dff), 
+ 						survObj = makeSurvObj(dff),
+ 						nBigMatrix=20,
+ 						minSize = min(dff$size, na.rm = TRUE), 
+ 						maxSize=max(dff$size, na.rm=TRUE))	
> dff$fec[dff$fec==0] <- NA
> fv1 <- makeFecObj(dff, Formula = fec~size, Transform = "log")
> Fmatrix <- makeIPMFmatrix(
+ 						fecObj = fv1, 
+ 						nBigMatrix = 20, 
+ 						minSize = min(dff$size, na.rm = TRUE), 
+ 						maxSize = max(dff$size, na.rm = TRUE))
> IPMmatrix <- makeIPMmatrix(Pmatrix,Fmatrix)
> slotNames(IPMmatrix)
[1] ".Data"          "nDiscrete"      "nEnvClass"      "nBigMatrix"    
[5] "meshpoints"     "env.index"      "names.discrete"
> 
> require(fields)
Loading required package: fields
Loading required package: spam
Loading required package: grid
Spam version 1.3-0 (2015-10-24) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction 
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.

Attaching package: 'spam'

The following objects are masked from 'package:base':

    backsolve, forwardsolve

Loading required package: maps

 # maps v3.1: updated 'world': all lakes moved to separate new #
 # 'lakes' database. Type '?world' or 'news(package="maps")'.  #


> par(mfrow=c(2,2))
> image.plot(IPMmatrix@meshpoints, IPMmatrix@meshpoints, t(Pmatrix), 
+ 	xlab = "Size(t)", 
+ 	ylab = "Size(t+1)",
+ 	main = "Survival/Growth Kernel")
> image.plot(IPMmatrix@meshpoints, IPMmatrix@meshpoints, t(Fmatrix), 
+ 	xlab = "Size (t)", 
+ 	ylab = "Size(t+1)",
+ 	main = "Fecundity Kernel")
> image.plot(IPMmatrix@meshpoints, IPMmatrix@meshpoints, t(IPMmatrix), 
+ 	xlab = "Size(t)", 
+ 	ylab = "Size(t+1)",
+ 	main = "IPM Kernel")
> # trick to visualize the whole IPM kernel when the Fmatrix has values>>Pmatrix
> image.plot(IPMmatrix@meshpoints, IPMmatrix@meshpoints, t(IPMmatrix)^.1, 
+ 	xlab = "Size(t)", 
+ 	ylab = "Size(t+1)",
+ 	main = "IPM Kernel^(.01)")
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>