Supplement 1. R code and example data set for fitting the Bayesian model of tree growth.
diametergrow.R (md5: b1008ce912f0b0a15a9464b23095c6e7)
diametergrow_functions.R (md5: 84fd1c6aaf3d96cf64802cfdb4153735)
diametergrow_evaluation.R (md5: b1f159cb1eba83540645f63b7a565823)
diametergrow_prediction.R (md5: 628ba7956ec2440ee0184c8257adc8f4)
microphylla.RData (md5: 24c613a8b8b12bf505345ef39a052214)
Disclaimer: Code provided in this supplement was not developed for general distribution. It is included at the request of the editor. The funding for this project does not provide for software development of a user interface or for full documentation. The example is one of many working versions that are under continued development and being used in several projects. The basic approach builds on Clark et al. (2007), further described in Clark et al. (2010). The code generates objects that are used as inputs for purposes other than those described here. Unfortunately, we do not have resources to engage in active software support, but welcome feedback.
The supplement contains R scripts for running the Bayesian state space model (diametergrow.r), functions used in the model (diametergrow_functions.r), calculating parameters and graphing used in evaluating model performance (diametergrow_evaluation.r), and predicting growth of trees of different sizes and light environments (diametergrow_prediction.r). An example data set is included for one of our species.
Data used in the modeling are loaded as several objects. diameters, increment, and surviv are lists, with each matrix in the list containing data for a different plot. For the example data set each of these lists has length one. diametergrow.r can include a random plot effect if the list is longer than length one. If stems are organized by species instead of plots, a random species effect can be included instead of a random plot effect. In each of these lists and covars, each row of data is a separate stem, and the order of rows is the same in each. Different covariates may be included in the model; they can be factors. Below are the first few rows of data for one of the species analyzed as an example.
Data structure of objects included in .Rdata file loaded into diametergrow.r:
diameters - list of matrices containing diameter measurements in cm for each year surveyed:-- TABLE: Please see in attached file. --
increment - list of matrices with measured diameter increment in cm for each year:-- TABLE: Please see in attached file. --
surviv - list of matrices indicating whether a stem was alive in each year of the survey; 0 = dead, 1 = alive, NA = not surveyed:-- TABLE: Please see in attached file. --
covars - matrix of covariates, three were used in this analysis: elev (in km), dbh (in dm), and C.St2 (ordinal):-- TABLE: Please see in attached file. --
yrvec - list of years included in the analysis:-- TABLE: Please see in attached file. --
mtree - vector of number of stems included in dataset, one value for each plot when including a random plot effect:
plotnames - not used in this example, but a vector of names when there are multiple plots:
spgroup - name of species being analyzed, used to label model output: