Learn R Programming

IPMpack (version 1.6)

makeGrowthObj: Functions to build growth objects for constant environments, or discretely varying environments

Description

A function that fits regressions that define growth (following next size, size increment, or log size increment) and from these build growth objects for which methods to build an IPM object are defined.

Usage

makeGrowthObj(dataf, Formula = sizeNext ~ size, 
	regType = "constantVar", Family = "gaussian", link = NULL)

Arguments

dataf
a dataframe with columns `size' and `sizeNext'(`size' is size at t, `sizeNext' is 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
Formula
a formula describing the desired explanatory variables (interactions, etc) according to the R notation for formula. style, i.e. separated by `+', `*', `:' and response variable. Possible covariates include `size', 'size2' (size^2), `s
regType
possible values include `constantVar' or `declineVar'
Family
possible values include `gaussian', `poisson', `negbin'
link
defaults to NULL, currently only relevant with Family="negbin", and only "log" and "identity" are permitted

Value

  • An object of class growthObj, or growthObjPois, growthObjIncr, or growthObjLogIncr; or growthObjDeclineVar, or growthObjIncrDeclineVar, or growthObjLogIncrDeclineVar. These are S4 objects which contain the slots:
  • fitan object of class lm or glm or gls that can be used with predict in the survival methods

See Also

makeSurvObj, makeFecObj

Examples

Run this code
#generate data
dff <- generateData()
#make simple linear regression growth object relating size to size at t+1
(gr1 <- makeGrowthObj(dataf = dff, Formula = sizeNext~size))
#same but relating size to incr
(gr1 <- makeGrowthObj(dataf = dff, Formula = incr ~ size))

#assess fit 
picGrow(dff,gr1)

#same but relating size to incr and discrete covariate
(gr1 <- makeGrowthObj(dataf = dff, Formula = incr ~ size + covariate, 
	regType = "declineVar"))
#with declining increment
(gr1 <- makeGrowthObj(dataf = dff, Formula = incr ~ size + covariate, 
	regType = "declineVar"))

Run the code above in your browser using DataLab