Learn R Programming

IPMpack (version 1.6)

makeFecObjInteger: Function to build fecundity objects

Description

Allows a series of different glms to be fit all on the way to fecundity, e.g., probability of reproducing, number of reproductive structures produced (e.g. flowers), etc; as well as fecundity into different discrete classes.

Usage

makeFecObjInteger(dataf,
		fecConstants = data.frame(NA),
		Formula = list(fec~size),
		Family = "gaussian",
		Transform = "none",
		meanOffspringSize = NA,
		thetaOffspringSize = NA,
		offspringSplitter = data.frame(continuous=1),
		vitalRatesPerOffspringType=data.frame(NA),
		fecByDiscrete = data.frame(NA),
		offspringSizeExplanatoryVariables = "1",
		distOffspring = "poisson")

makeClonalObjInteger(dataf, fecConstants = data.frame(NA), Formula = list(fec~size), Family = "gaussian", Transform = "none", meanOffspringSize = NA, thetaOffspringSize = NA, offspringSplitter = data.frame(continuous=1), vitalRatesPerOffspringType = data.frame(NA), fecByDiscrete = data.frame(NA), offspringSizeExplanatoryVariables = "1", distOffspring = "poisson")

Arguments

dataf
a dataframe with columns "size", "sizeNext", "stage", "stageNext", and any additional columns with fecundity data. If fecundity data is transformed via log, etc, this MUST BE MADE CLEAR in the argument Transform since the fecundity object pro
fecConstants
a list containing the value by which each of the fecundity rates will be multiplied in the order defined by the order in Formula. This data frame adjusts the probability of establishment of seeds or other stages in sexual reproduct
Formula
a formulas describing the desired explanatory variables (interactions, etc) in classical R style, i.e. separated by `+', `*', `:' and the response variables of choice. Possible covariates include `size', 'size2' (size^2), `size3' (size^3),`logsize' (log(
Family
a character vector containing the names of the families to be used for the glms, e.g., binomial, poisson, etc. Again, these must appear in the order defined by Formula
Transform
a character vector containing the names of the transforms to be used for the response variables, e.g., log, sqrt, -1, etc. Again, these must appear in the order defined by Formula
meanOffspringSize
numeric vector, defining mean offspring size. Defaults to NA, in which case the function will use to data to assess the mean offspring size according to the relationship defined in offspringSizeExplanatoryVariables (which either simply fits a mean, or may
thetaOffspringSize
numeric vector, defining size parameter of offspring size. It is only required if the family of offspring size is negative binomial (rather than poisson). Defaults to NA, in which case the function will use the data to assess this parameter using dbinom.
offspringSplitter
dataframe with values defining the number of offspring going into the indicated offspring category; will be re-scaled to sum to 1 within the function. This argument needs to be entered as a data.frame, and the names in the data.frame need to preci
vitalRatesPerOffspringType
dataframe defining which fecundity rates (both functions and constants) apply to which offspring category. This only needs to be specified when some fecundity rates do not apply to all offspring categories. The offspring categories in the column names of
fecByDiscrete
data.frame defining number of offspring produced by each discrete class ; defaults to 0. If specified, ALL discrete classes MUST appear in alphabetical order, so NO "continuous". e.g. fecByDiscrete=data.frame(dormant=0,seedAge1=4.2,seedOld=0)
offspringSizeExplanatoryVariables
a character defining the relationship defining offspring size; the default is "1", indicating simply fitting a mean and a variance; alternatives would including defining offspring size as a function of maternal size (i.e., offspringSizeExplanatoryVariable
distOffspring
character indicating the desired distribution of offspring sizes (poisson or negative binomial)

Value

  • an object of class fecObjInteger

Details

See help for makeFecObj; this is exactly analagous, except that it uses the poisson or negative binomial as descriptors for offspring size

See Also

makeSurvObj, makeGrowthObj,makeFecObj

Examples

Run this code
# Open dataset for the herbaceous perennial Cryptantha flava where the state variable is integer (number of rosettes)
data(cryptaDataCovSubset)
head(cryptaDataCovSubset)
d <- cryptaDataCovSubset

#See the description of the data for information on the variables
help(cryptaDataCovSubset)

# For this example, focus only on the first annual transition available in the dataset
d1 <- d[d$year==2004, ]

#Create fecundity object with integer data
fo <- makeFecObjInteger(d1, Formula = fec1~size, distOffspring = "poisson")

Run the code above in your browser using DataLab