Learn R Programming

IPMpack (version 1.6)

makePostFecObjs: Make list of fecundity objects corresponding to posterior of Bayes fit

Description

Allows a series of different glms to be fit all on the way to fecundity, e.g., probability of flowering, number of flower heads produced, etc. using a Bayesian framework via the MCMCglmm package. Needs work on priors.

Usage

makePostFecObjs(dataf,
		fecConstants=data.frame(NA),fecNames=NA,
		explanatoryVariables="size",
		Family="gaussian",
		Transform="none",
		meanOffspringSize=NA,
		sdOffspringSize=NA,
		offspringSplitter=data.frame(continuous=1),
		vitalRatesPerOffspringType=data.frame(NA),
		fecByDiscrete=data.frame(NA),
		offspringSizeExplanatoryVariables="1",
		burnin=3000,nitt=50000)

Arguments

dataf
a dataframe with columns "size", "sizeNext", "stage", "stageNext", "fec1", "fec2" or other names containing fec; up to nine are currently possible (and note that ANY name containing "fec" will be included and these MUST NOT be transforme
fecNames
a character vector containing the names of the columns of the dataframe from which fecundity data will be analysed (one column at a time). If the fecNames argument is not specified (as by default, NA), fecNames will be filled by the names of all column na
fecConstants
a dataframe containing the value by which each of the fecundity transforms will be multplied in the order defined by the alphabetical order of column names containing "fec"; these might capture for example the probability of e
explanatoryVariables
a character vector containing formulas describing the desired explanatory variables (interactions, etc) in classical R style, i.e. separated by `+', `*', `:'. Possible covariates include `size', 'size2' (size^2), `size3' (size^3),`logsize' (lo
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 the alphabetical order of column names containing "fec"
Transform
a character vector containing the names of the transforms to be used for the response variables, e.g., log, sqrt, etc. Again, these must appear in the order defined by the alphabetical order of column names containing "fec"
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
sdOffspringSize
numeric vector, defining sd of offspring size. Defaults to NA, in which case the function will use to data to assess the mean offspring size
offspringSplitter
dataframe, with column headings for EVERY category, so always at minimum containing a column called "continuous" but also including every discrete category that will enter into the Fmatrix (and, if compatibility is required, the Pmatrix), with
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 name
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
burnin
numeric defining burn in for MCMCglmm
nitt
number of iterations

Value

  • list of fecundity objects

Details

NOTE: priors not implemented; also uncertainty / variation in mean seedling size, variance in seedling size is not implemented. Requires MCMCglmm. Function does not return output of Bayes analysis which might be useful for assessment; in development.

See Also

makeListIPMs, makePostGrowthObjs, makeFecObj

Examples

Run this code
dff <- generateData()
fvlist <- makePostFecObjs(dataf=dff,
	explanatoryVariables="size+size2+covariate",
                               burnin=100,nitt = 500)
                               
fvlist[[1]]

Run the code above in your browser using DataLab