Fits three growth models to length and weight-at-age data.

```
growth(intype=1,unit=1,size=NULL,age=NULL,calctype=1,wgtby=1,s2=NULL,error=1,
specwgt=0.0001,Sinf=NULL,K=NULL,t0=NULL,B=3,graph=TRUE,
control=list(maxiter=10000,minFactor=1/1024,tol=1e-5))
```

intype

the input format: 1= individual size data; 2 = mean size data. Default intype=1.

unit

the size unit: 1= length; 2 = weight. Default unit=1.

size

the vector of size (length or weight) data.

age

the vector of ages associated with the size vector.

calctype

if intype=1, 1 = use individual size data; 2 = calculate mean size from individual size data. Default calctype=1.

wgtby

weighting scheme: 1 = no weighting; 2 = weight means by inverse variance. Weighting of individual data points is not allowed. Default wgtby=1.

s2

if intype=2 and wgtby=2, specify vector of sample variances associated with mean size-at-age data.

error

the error structure: 1 = additive; 2 = multiplicative. Default error=1.

specwgt

if *intype*=1 and *wgtby*=2, the weight value to use for cases where var=0 or only one individual is available at a given age.

Sinf

the starting value for *L-infinity or W-infinity* of the growth models. Required.

K

the starting value for *K* of the growth models.

t0

the starting value for *t0* of the growth models.

B

the length-weight equation exponent used in the von Bertalanffy growth model for weight. Default B=3.

graph

logical value specifying if fit and residual plots should be drawn. Default graph = TRUE.

control

see function *nls*.

List containing list elements of the equation/structure and *nls* output for each model.
Information from *nls* output can be extracted using standard functions (e.g., *summary()*).

Three growth models (von Bertalanffy, Gompert and logistic) are fitted to length- or weight-at-age data using nonlinear least-squares (function *nls*).
If individual data are provided, mean size data can be calculated by specifying *calctype*=2. When fitting mean size data,
observations can be weighted by the inverse sample variance(*wgtby*=2), resulting in weighted nonlinear least squares. Additive or multiplicative
error structures are specified via *error*. See page 135 in Quinn and Deriso (1999) for more information on error structures.

If unit is weight,
the exponent for the von Bertalanffy growth in weight model is not estimated and must be specified (*B*).

Plots of model fit and residuals are generated unless *graph*=FALSE.

Quinn, T. J. and R. B. Deriso. 1999. Quantitative fish dynamics. Oxford University Press. 542 pages.

```
# NOT RUN {
data(pinfish)
growth(intype=1,unit=1,size=pinfish$sl,age=pinfish$age,
calctype=1,wgtby=1,error=1,Sinf=200,K=0.3,t0=-1)
# }
```

Run the code above in your browser using DataLab