Description Usage Arguments Value Note Author(s) See Also Examples
A function that fits regressions that define offspring size and from these build growth objects for which methods to build an IPM object are defined; alternatively, the function creates offspring objects following a specified formula with specified coefficients and sd. Note that if an "offspringNext" column is available in the data, the data will be subsetted based on whether offspringType="sexual" or "clonal" (the default is "sexual"); - otherwise, appropriate data must be supplied.
1 2 3 |
dataf |
a dataframe with columns ‘size’ and ‘sizeNext’(‘size’ is size of parent at t, and may not be known, ‘sizeNext’ is offspring size at t+1); facultatively, dataf may include ‘covariate’ and ‘covariatel’ for a single discrete covariate, indicating values at t, and at t+1, respectively; these must take values of sequential integers, starting at ‘1’. |
Formula |
a formula describing the desired
explanatory variables (interactions, etc) according to the R notation for |
regType |
possible values include ‘constantVar’ or ‘changingVar’ |
Family |
possible values include ‘gaussian’, ‘poisson’, ‘negbin’ |
link |
defaults to NULL, currently only relevant with Family="negbin", and only "log" and "identity" are permitted |
coeff |
numeric vector of required coefficients to be imposed if dataf is NULL; must be compatible with Formula |
sd |
numeric of required sd to be imposed if dataf is NULL |
reproductionType |
whether the relationship should be fitted for sexual or clonal offspring; the default is "sexual"; this will only be relevant if data is provided and has a column "offspringNext" |
An object of class growthObj, or growthObjPois, growthObjIncr, or growthObjLogIncr; or growthObjDeclineVar, or growthObjIncrDeclineVar, or growthObjLogIncrDeclineVar. These are S4 objects which contain the slots:
fit |
an object of class |
Slots can be listed by using slotNames(growthObj)
Note that DeclineVar objects cannot currently be constructed without a data-frame.
C. Jessica E. Metcalf, Sean M. McMahon, Roberto Salguero-Gomez & Eelke Jongejans
makeGrowthObj
, makeSurvObj
, makeFecObj
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 28 29 | #generate data
dff <- generateData()
#make simple linear regression growth object relating size to size at t+1
off1 <- makeOffspringObj(dataf = dff, Formula = sizeNext~1)
#now specifying parameters and supplying no data
off1 <- makeOffspringObj(Formula = incr ~ size + covariate,coeff=c(1,1,1),sd=1)
##make an Fmatrix with this
dff<-generateData()
dff$fec[dff$fec==0] <- NA
off1 <- makeOffspringObj(dataf = dff, Formula = sizeNext~1)
fv1 <- makeFecObj(dff, Formula = fec~size, Transform = "log",
doOffspring=FALSE)
Fmatrix1 <- makeIPMFmatrix(fecObj = fv1, nBigMatrix = 20,
minSize = min(dff$size, na.rm = TRUE), maxSize = max(dff$size,
na.rm = TRUE), correction="constant", offspringObj=off1)
#compare with the other approach (where offspring object is not separate)
fv2 <- makeFecObj(dff, Formula = fec~size, Transform = "log",
offspringSizeExplanatoryVariables = "1", doOffspring=TRUE)
Fmatrix2 <- makeIPMFmatrix(fecObj = fv2, nBigMatrix = 20,
minSize = min(dff$size, na.rm = TRUE), maxSize = max(dff$size,
na.rm = TRUE), correction="constant", offspringObj=NULL)
par(mfrow=c(1,2))
image(Fmatrix1); image(Fmatrix2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.