Learn R Programming

IPMpack (version 2.1)

addPdfGrowthPic: 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

See Also

makeGrowthObj,makeSurvObj,plotGrowthModelComp, plotSurvModelComp

Examples

Run this code
# 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)

Run the code above in your browser using DataLab