Last chance! 50% off unlimited learning
Sale ends in
The dataframe must contain columns "stage" and "stageNext" with values of the names of the discrete classes and the name "continuous" where appropriate, in the current and subsequent time step. Continuous categories are also defined by their measurements, contained in "size" and "sizeNext". This is necessary for defining the mean and variance of the continuous stage of individuals emerging from discrete stages. Alternatively, you can enter the transition matrix for the discrete stages in the 'discreteTrans' argument.
makeDiscreteTrans(dataf, stages = NA, discreteTrans = NA, meanToCont = NA, sdToCont = NA, continuousToDiscreteExplanatoryVariables = "size")
as.factor
) containing either names of discrete stages or "continuous" or "dead"), "size", "sizeNext", and "surv" (continuous and boolean variables respectively).Ellner & Rees. 2006. Integral projection models for species with complex demography. The American Naturalist 167, p410-428.
createIPMPmatrix
dff <- generateDataDiscrete()
discTrans <- makeDiscreteTrans(dff)
createIPMPmatrix(nBigMatrix = 10, growObj = makeGrowthObj(dff),
survObj = makeSurvObj(dff), discreteTrans = discTrans)
# Often some data needed for makeDiscreteTrans are not available as individual records in your data file. For instance the fate of seeds in the seedbank of the generateDataDiscrete() example:
dff<-generateData()
# Now the transition matrix needs to be entered as an argument, as well as the mean and sd of sizeNext values for discrete to continuous transitions.
discTrans <- makeDiscreteTrans(dff,
discreteTrans = matrix(c(.5,.1,.4,0,1,0),
nrow=3, ncol=2, dimnames = list(c("seedbank","continuous","dead"),
c("seedbank","continuous"))),
meanToCont = matrix(c(mean(dff$sizeNext[is.na(dff$stage)&dff$stageNext=="continuous"],na.rm=TRUE)),
nrow=1, ncol=1, dimnames = list(1,c("seedbank"))),
sdToCont = matrix(c(sd(dff$sizeNext[is.na(dff$stage)&dff$stageNext=="continuous"],na.rm=TRUE)),
nrow=1, ncol=1, dimnames = list(1,c("seedbank"))))
Pmatrix<-createIPMPmatrix(nBigMatrix = 10, growObj = makeGrowthObj(dff),
survObj = makeSurvObj(dff), discreteTrans = discTrans)
Fmatrix<-createIPMFmatrix(nBigMatrix = 10, fecObj = makeFecObj(dff))
dim(Pmatrix)
dim(Fmatrix)
# To fix this mismatch, all discrete classes (1 in this case) need to be added to the Fmatrix as well, e.g.:
Fmatrix<-createIPMFmatrix(nBigMatrix = 10, fecObj = makeFecObj(dff, offspringSplitter=data.frame(seedbank=.3,continuous=.7)))
IPM <- Pmatrix + Fmatrix
Run the code above in your browser using DataLab