Under construction
For performing bayesian IPM analyses the following function might be of use:
## A function that outer can use showing numbers from x to y via production, growth, survival and distribution offspring
.fecPostCensus <- function(x,y,cov=data.frame(covariate=1),fecObj, growObj,survObj) {
newd <- data.frame(cbind(cov,size=x),
stringsAsFactors = FALSE)
newd$size2 <- x^2
newd$size3 <- x^3
if (length(grep("expsize",fecObj@offspringRel$formula))>0 |
length(grep("expsize", growObj@fit$formula))>0) { newd$expsize <- exp(x)}
if (length(grep("logsize",fecObj@offspringRel$formula))>0 |
length(grep("logsize", growObj@fit$formula))>0) { newd$logsize <- log(x)}
u <- .fecRaw(x=x,cov=cov,fecObj=fecObj)[[1]]*
dnorm(y,predict(fecObj@offspringRel, newdata=newd, type="response"), fecObj@sdOffspringSize) *
surv(size=x, cov=cov, survObj=survObj)
return(u)
}
back to the main page
|