First step of the Electronic LEngth Frequency ANalysis (ELEFAN), which is restructuring length-frequency data (lfq). This is done according to a certain protocol, described by many authors (see Details or References for more information).

`lfqRestructure(param, MA = 5, addl.sqrt = FALSE)`

param

a list consisting of following parameters:

**midLengths**midpoints of the length classes**dates**dates of sampling times (class Date)**catch**matrix with catches/counts per length class (row) and sampling date (column)

MA

number indicating over how many length classes the moving average should be performed (default: 5)

addl.sqrt

additional squareroot transformation of positive values according to Brey et al. (1988) (default: FALSE). Particularly useful if many observations have a low frequency (<10)

A list with the input parameters and following list objects:

**rcounts**: restructured frequencies,**peaks_mat**: matrix with uniquely numbered positive peaks,**ASP**: available sum of peaks, sum of posititve peaks which could be potential be hit by growth curves. This is calculated as the sum of maximum values from each run of posive restructured scores,**MA**: moving average used for restructuring.

This function is used prior to fitting of growth curves (e.g. in
`ELEFAN`

, `ELEFAN_SA`

functions). It restructures a length
frequency data set according to a list of steps to emphasise cohorts in the data.
The steps can be found in various publications, see e.g. Brey et al. (1988) or
Pauly and David (1981). Here, the most recent steps documented in Gayanilo (1997)
are followed.

Brey, T., Soriano, M., and Pauly, D. 1988. Electronic length frequency analysis: a revised and expanded user's guide to ELEFAN 0, 1 and 2.

Gayanilo, Felimon C. FAO-ICLARM stock assessment tools: reference manual. No. 8. Food & Agriculture Org., 1997.

Pauly, D. 1981. The relationship between gill surface area and growth performance in fish:
a generalization of von Bertalanffy's theory of growth. *Meeresforsch*. 28:205-211

Pauly, D. and N. David, 1981. ELEFAN I, a BASIC program for the objective extraction of
growth parameters from length-frequency data. *Meeresforschung*, 28(4):205-211

Pauly, D., 1985. On improving operation and use of ELEFAN programs. Part I: Avoiding
"drift" of K towards low values. *ICLARM Conf. Proc.*, 13-14

Pauly, D., 1987. A review of the ELEFAN system for analysis of length-frequency data in
fish and aquatic invertebrates. *ICLARM Conf. Proc.*, (13):7-34

Pauly, D. and G. R. Morgan (Eds.), 1987. Length-based methods in fisheries research. (No. 13). WorldFish

Pauly, D. and G. Gaschuetz. 1979. A simple method for fitting oscillating length growth data, with a program for pocket calculators. I.C.E.S. CM 1979/6:24. Demersal Fish Cttee, 26 p.

Pauly, D. 1984. Fish population dynamics in tropical waters: a manual for use with programmable calculators (Vol. 8). WorldFish.

Quenouille, M. H., 1956. Notes on bias in estimation. *Biometrika*, 43:353-360

Somers, I. F., 1988. On a seasonally oscillating growth function. ICLARM Fishbyte 6(1): 8-11.

Sparre, P., Venema, S.C., 1998. Introduction to tropical fish stock assessment.
Part 1. Manual. *FAO Fisheries Technical Paper*, (306.1, Rev. 2): 407 p.

Tukey, J., 1958. Bias and confidence in not quite large samples.
*Annals of Mathematical Statistics*, 29: 614

Tukey, J., 1986. The future of processes of data analysis. In L. V. Jones (Eds.), The Collected Works of John W. Tukey-philosophy and principles of data analysis: 1965-1986 (Vol. 4, pp. 517-549). Monterey, CA, USA: Wadsworth & Brooks/Cole

```
# NOT RUN {
# data and plot of catch frequencies
data(synLFQ4)
plot(synLFQ4, Fname="catch")
# restructuring and calculation of ASP
synLFQ4 <- lfqRestructure(synLFQ4, MA=11)
synLFQ4$ASP
# plot of restructured scores and fit of soVBGF growth curves
plot(synLFQ4)
lfqFitCurves(synLFQ4,
par=list(Linf=80, K=0.5, t_anchor=0.25, C=0.75, ts=0),
draw=TRUE
)$fASP
# }
```

Run the code above in your browser using DataLab