Last data update: 2014.03.03

R: Adds probability density functions of density function of...
addPdfGrowthPicR Documentation

Adds probability density functions of density function of size or increment given current size and growth to plots.

Description

Function generates pdfs (probability density functions) corresponding to chosen sizes and adds them to a figure using growth methods.

Usage

addPdfGrowthPic(respType = "sizeNext", sizesPlotAt = c(20, 50, 60),
                            sizeRange = c(20, 400), incrRange = c(-10, 50), 
                            scalar = 100, growthObjList,
                            cols = 1:5,
                            cov = data.frame(covariate=1),
                            minShow = 1e-2,
                            jitt = 2,  
                            ...)
		

Arguments

respType

character string identifying the response variable for the growthModelComp. wither "sizeNext", "logincr" or "incr". Defaults to sizeNext.

sizesPlotAt

vector, list of sizes at which pdfs should be plotted.

sizeRange

sizeRange for which pdf should be estimated

incrRange

increment range for which pdf should be estimated

scalar

value by which pdf may be multiplied to improve visibility

growthObjList

list of growth objects for which pdfs are desired to be plotted

cols

colours corresponding to the list of growth objects for plotting

cov

a data-frame with one row containing all covariates other than size related covariates; defaults to 1; will be ignored if no covariates are fitted

minShow

minimum value below which pdf lines will not be shown (to avoid ugly vertical lines)

jitt

amount by which sequential pdfs should be separated on the x axis, for visibility

...

extra arguments to pass to the plot function.

Value

none

Author(s)

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

See Also

makeGrowthObj,makeSurvObj,plotGrowthModelComp, plotSurvModelComp

Examples

# Data with size and sizeNext
dff <- generateData()

a1 <- growthModelComp(dff, makePlot = TRUE)
addPdfGrowthPic(respType = "sizeNext", 
	sizesPlotAt = c(2, 6, 10), scalar = 1, jitt = 0.1, 
		sizeRange = c(-5, 25), 
			growthObjList = a1$growthObjects, cols = 2:5)

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/addPdfGrowthPic.Rd_%03d_medium.png", width=480, height=480)
> ### Name: addPdfGrowthPic
> ### Title: Adds probability density functions of density function of size
> ###   or increment given current size and growth to plots.
> ### Aliases: addPdfGrowthPic
> 
> ### ** Examples
> 
> # Data with size and sizeNext
> dff <- generateData()
> 
> a1 <- growthModelComp(dff, makePlot = TRUE)
> addPdfGrowthPic(respType = "sizeNext", 
+ 	sizesPlotAt = c(2, 6, 10), scalar = 1, jitt = 0.1, 
+ 		sizeRange = c(-5, 25), 
+ 			growthObjList = a1$growthObjects, cols = 2:5)
Warning message:
In log(incr) : NaNs produced
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>