R source code, examples, and documentation for the main fitting functions.
Ecological Archives E083-042-S1.
Stephen P. Ellner, Cornell University
Department of Ecology and Evolutionary Biology
Ithaca NY 14853-2701 USA
GradFuncs.zip - Zip archive of all files
Readme.txt - Readme file for the Zip archive
GradFuncs.R - R source code for the fitting functions. Requires the MASS and quadprog libraries and version 1.1 or higher of R
TestGradFuncs.R - Examples of using the main fitting functions, extensively commented. Requires the mgcv library.
GradFuncs.doc - Documentation in MS Word for Windows format
GradFuncs.pdf - Documentation in PDF format
Nichadults.txt - Data file used by the examples: every-other-day count of adult numbers in series "I" from Nicholson (1957). The example code assumes that this file is sitting in C:\\GradFuncs; if you put it anywhere else you will need to edit the example code appropriately
DescriptionA set of R functions for the main fitting procedures used in the paper, including functions for smoothing the time series to estimate its gradient, and to fit univariate and additive bivariate regression spline models with and without constraints. The examples file TestGradFuncs.R illustrates how the functions are used, including an example of a SIMEX bias-correction for measurement errors. The code was developed originally under version 1.1 of R and has been tested under version 1.3.0 with associated library versions, on PCs running Windows NT 4.0 and Windows 2000 Professional. Please note that this is not a library; the script file GradFuncs.R must be source'd to make the functions available in the current session. There is also no online help provided.
Not all of the functions run under Splus, though adapting them to do so should not be too difficult. The main R-specific feature is the use of optim() with method = "Nelder-Mead" to fit the two smoothing parameters for the ridge functions in additive models by minimizing the GCV score; a call to nlmin() could be substituted. Also, one commented-out line near the top of GradFuncs.R needs to have the "#" removed so that the Splus solve.matrix() is called in place of solve(). Several of the examples use plotting parameters specific to R.
ESA Publications | Ecological Archives | Permissions | Citation | Contacts