View source: R/growthmultifit.R
growthmultifit | R Documentation |
Fits a von Bertalanffy, Gompertz or logistic growth curve to length and age for two or more groups.
growthmultifit(len=NULL,age=NULL,group=NULL,model=1,fixed=c(1,1,1),error=1,
select=1,Linf=c(NULL),K=c(NULL),t0=c(NULL),plot=FALSE,
control=list(maxiter=10000,minFactor=1/1024,tol=1e-5))
len |
the vector of lengths of individual fish. |
age |
the vector of ages associated with the length vector. |
group |
the vector of character names specifying group association. The first character in the name must be a letter. |
model |
which model to fit. 1= von Bertalanffy, 2= Gompertz, and 3 = logistic. Default=1. |
fixed |
arguments specifying that Linf, K or t0 should be fitted as a constant between groups or as separate parameters for each group. 1 = single parameter between groups, 2 = separate parameters for each group. The order of fixed is c(Linf,K,t0). |
error |
the error variance assumption. 1= constant variance for all lijs; 2= constant variance for all mean lengths at age; 3=var of lij varies with age. See methods a-c in Kimura (1980: pp. 766). The required statistics for each type of error are calculated from the individual length-age observations. |
select |
the selection of starting values of L-infinity, K, and t0. 1=automatic selection, 2=user-specified. If select=1, initial starting values of L-infinity, K, and t0 are calculated from Walford lines (Everhart et al. 1975), and ages represented as decimal values are truncated to the integer before linear regression is applied. If select=2, the user must specify values of L-infinity, K, and t0 for each group. |
Linf |
if select=2, the starting values for L-infinity of the von Bertalanffy equation, one for each group. |
K |
if select=2, the starting values for K of the von Bertalanffy equation, one for each group. |
t0 |
if select=2, the starting value for t0 of the von Bertalanffy equation, one for each group. |
plot |
logical argument specifying whether observed versus predicted and residuals graphs should be plotted. Default is FALSE. |
control |
see function nls. |
A von Bertalanffy, Gompertz or logistic model is fitted to the length and age data of two or more groups using function nls (nonlinear least squares). Parameters can be estimated for each group or as constants across groups. Individual observations of lengths-at-age are required. If error variance assumptions 2 or 3, mean lengths and required statistics are calculated. The parameters are fitted using a model.matrix where the 1st column is a row of 1s representing the parameter estimate of the reference group (group with lowest alpha-numeric order) and the remaining group columns have 1 if group identifier is the current group and 0 otherwise. See function model.matrix. This is a companion function to function growthlrt. If errors arise using automatic selection, switch to select=2.
When separate parameters are estimated for each group, estimates for the the non-reference groups would be the reference-group estimated parameters (e.g., Linf1 or K1 or t01) plus the coefficent estimate for the nth group (e.g., group 2: Linf2 or K2, or t02) based on the alpha-numeric order. If the parameter is assumed constant across groups, then estimates of Linf1 or K1 or t01 is used as the parameter for each group. The von Bertalanffy equation is Lt=Linf*1-exp(-K*(age-t0)). The Gompertz equation is Lt=exp(-exp(-K*(age-t0))). The logistic equation is Lt=Linf/(1+exp(-K*(age-t0))).
results |
list element containing summary statistics of nls fit |
residuals |
list element with the residuals from the model. |
Gary A. Nelson, Massachusetts Division of Marine Fisheries gary.nelson@mass.gov
Everhart, W. H., A. W. Eipper, and W. D. Youngs. 1975. Principles of Fishery Science. Cornell University Press.
Kimura, D. K. 1980. Likelihood methods for the von Bertalanffy growth curve. U. S. Fish. Bull. 77(4): 765-776.
growthlrt
data(Kimura)
growthmultifit(len=Kimura$length,age=Kimura$age,group=as.character(Kimura$sex),
model=1,fixed=c(2,1,1),
error=1,select=1,Linf=NULL,K=NULL,t0=NULL,plot=FALSE,control=list(maxiter=10000,
minFactor=1/1024,tol=1e-5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.