convergeIPM: Iteratively find best number of bins for a given tolerance...

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/IPMpack-Analyses.r

Description

Iteratively increases the number of bins specified in binIncrease until the difference in the chosen measure falls below the selected tolerance level.

Usage

1
2
3
4
convergeIPM(growObj, survObj, fecObj, nBigMatrix, minSize, maxSize,
  discreteTrans = 1, integrateType = "midpoint", correction = "none",
  preCensus = TRUE, tol = 1e-04, binIncrease = 5, chosenBin = 1,
  response = "lambda")

Arguments

growObj

An object of class growObj

survObj

An object of class survObj

fecObj

An object of class fecObj

nBigMatrix

A numeric specifying the initial number of bins used in the matrix. This number will be increased in the function

minSize

A numeric specifying the lower size bound for the big matrix's meshpoints

maxSize

A numeric specifying the upper size bound for the big matrix's meshpoints

discreteTrans

A matrix of discrete transitions. If there are none, specify as 1

integrateType

The type of function to integrate over. The default is midpoint. This uses the probability density function. cumul is the other option. This uses the cumulative density function.

correction

The type of correction to use for eviction. 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.

preCensus

A logical defining whether the fecObj is pre or post-census. The default is pre-census.

tol

The desired tolerance level for response.

binIncrease

The number of bins to add in each successive iteration.

chosenBin

The desired bin for which life expectancy should be assessed. The default is the first.

response

The variable to test for convergence. The options are lambda, R0, and lifeExpect. The latter will calculate the life expectancy for individuals in chosenBin.

Details

Different choices for responses will yield different values. The pattern of change in lambda (or other response variables) can be complex, so it is advisable to start with large binIncrease and small tolerance, and then once one knows a general idea of how big the matrix needs to be, run the function again with a smaller binIncrease but start it closer to the goal.

For the life expectancy option, if discrete stages are included via discreteTrans then if chosenBin=1, this function will use the first discrete bin.

Value

A list with the following elements:

Note

This code was modified from original code by Melissa Eitzel.

Author(s)

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

See Also

diagnosticsPmatrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
dff<-generateData()
gr1<-makeGrowthObj(dff)
sv1<-makeSurvObj(dff)
fv1<-makeFecObj(dff,Transform="log")
res <- convergeIPM(growObj=gr1, 
                   survObj=sv1, fecObj=fv1, 
                   nBigMatrix=10, minSize=-2,
                   maxSize=15,discreteTrans = 1, 
                   integrateType = "midpoint", 
                   correction = "none", 
                   preCensus = TRUE, tol=1e-3,binIncrease=10)
res <- convergeIPM(growObj=gr1, 
                   survObj=sv1, fecObj=fv1, 
                   nBigMatrix=10, minSize=-2,
                   maxSize=15,discreteTrans = 1, 
                   integrateType = "midpoint", 
                   correction = "none", 
                   preCensus = TRUE, tol=1e-3,
                   binIncrease=10, response="R0")

res <- convergeIPM(growObj=gr1, survObj=sv1, fecObj=fv1, 
                   nBigMatrix=10, minSize=-2,
                   maxSize=15,discreteTrans = 1, 
                   integrateType = "midpoint", 
                   correction = "none", 
                   preCensus = TRUE, tol=1e-3,binIncrease=10, 
                   response="lifeExpect")

levisc8/IPMpack documentation built on May 7, 2019, 3:20 p.m.