Supplement 1. R source code for parameter estimation, model simulations, and calculation of Sobol' indices.
These are text files (readable by, e.g., Notepad or Wordpad on PCs or by any ASCII text-file editor). They contain R-language source code for the data analyses and model simulations in the paper. Because we are not at liberty to redistribute all of the original data used in the analyses, only some portions of these programs can be run by users. The purpose of presenting the complete source code is to document in full detail calculations that are described conceptually in the paper. A WinZip archive containing all the files is also provided.
FitUnstructuredModel.R contains the statistical analyses behind the models for the distributions of Et and p4t for the unstructured models. As noted in the paper, we considered a number of models for p4t and only the final one is presented in the code here (a truncated logistic distribution). Users cannot run any portions of this code.
IterateUnstructuredModel.R contains code for iterating the structured model, including iterations using bootstrap parameter distributions to account for parameter uncertainty. Users can run portions of this code. The top part of the code (which reads in data and fits models for Et and p4t) cannot be run by users. However at the comment line 'USERS START HERE' we insert 'by hand' the necessary numerical results from the analysis so that the rest of the code can be run, to replicate the process leading to Fig. 2 in the paper.
BootstrapDistributionsStageModel.R contains code for generating the bootstrap distribution of model parameters for the stage-structured model, that is used for Sobol sensitivity indices and confidence interval calculations. Users cannot run any portions of this code.
IterateStageModel.R contains code for an R function that simulates the stage-structured model using user-supplied parameters, and estimates the population growth rate as a function of parameter values by doing multiple simulations of the model. Users can run this file (which will load the model function into the current R workspace), but must supply parameter values when calling the function.
SobolandCI.R contains code to calculate confidence intervals on population growth rate, and Sobol' sensitivity indices, for the structured population model. Users cannot run this code.