Learn R Programming

IPMpack (version 1.6)

makePostGrowthObjs: Make list of growth objects corresponding to posterior of Bayes fit

Description

Model takes a data-frame and fits a Bayesian model to the chosen "responseType" (sizeNext, incr, etc) using the chosen explanatory variable, and the package MCMCglmm; then creates the resulting list of growth objects necessary to get Bayes posteriors of IPM outputs. Note that priors are not yet implemented and growth methods for multiple covariates likewise.

Usage

makePostGrowthObjs(dataf, explanatoryVariables,responseType,
meanB = rep(0, 3), varB = rep(1e+10), burnin=3000,nitt = 50000)

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' (discrete or continuous) or other covariates
explanatoryVariables
a formula 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' (log(size)), `logsize2' (log(siz
responseType
possible values include `sizeNext' (size in one discrete time step) and `incr' and `logincr'
meanB
vector defining the means of the priors of the coefficients for growth (should be the same length as desired coeff). CURRENTLY NOT IMPLEMENTED.
varB
vector defining the variance of the prior of the coeff for growth, as for the mean. CURRENTLY NOT IMPLEMENTED.
burnin
numeric defining burn in for MCMCglmm
nitt
numeric defining the number of iterations

Value

  • a list of growth objects

Details

Note that the use of priors is not yet implemented, and the function does not return output of Bayes analysis which might be useful for assessment; in development.

See Also

makePostSurvivalObjs, makeListPmatrix

Examples

Run this code
dff <- generateData()
grlist <- makePostGrowthObjs(dataf=dff,
			explanatoryVariables="size+size2+covariate",
            responseType="sizeNext",
            meanB=rep(0,3),varB=rep(1e10),burnin=100,nitt = 500)
            
grlist[[1]]

Run the code above in your browser using DataLab