Computes the proportions-at-age (with standard errors) in a larger sample based on an age-length-key created from a subsample of ages through a two-stage random sampling design. Follows the methods in Quinn and Deriso (1999).

1 | ```
alkAgeDist(key, lenA.n, len.n)
``` |

`key` |
A numeric matrix that contains the age-length key. See details. |

`lenA.n` |
A numeric vector of sample sizes for each length interval in the |

`len.n` |
A numeric vector of sample sizes for each length interval in the |

The age-length key in `key`

must have length intervals as rows and ages as columns. The row names of `key`

(i.e., `rownames(key)`

) must contain the mininum values of each length interval (e.g., if an interval is 100-109 then the corresponding row name must be 100). The column names of `key`

(i.e., `colnames(key)`

) must contain the age values (e.g., the columns can NOT be named with “age.1”, for example).

The length intervals in the rows of `key`

must contain all of the length intervals present in the larger sample. Thus, the length of `len.n`

must, at least, equal the number of rows in `key`

. If this constraint is not met, then the function will stop with an error message.

The values in `lenA.n`

are equal to what the row sums of `key`

would have been before `key`

was converted to a row proportions table. Thus, the length of `lenA.n`

must also be equal to the number of rows in `key`

. If this constraint is not met, then the function will stop with an error message.

A data.frame with as many rows as ages (columns) present in `key`

and the following three variables:

age The ages.

prop The proportion of fish at each age.

se The SE for the proportion of fish at each age.

The results from this function perfectly match the results in Table 8.4 (left) of Quinn and Deriso (1999) using `SnapperHG2`

from FSAdata. The results also perfectly match the results from using `alkprop`

in fishmethods.

5-Age-Length Key.

Derek H. Ogle, derek@derekogle.com

Ogle, D.H. 2016. Introductory Fisheries Analyses with R. Chapman & Hall/CRC, Boca Raton, FL.

Lai, H.-L. 1987. Optimum allocation for estimating age composition using age-length key. Fishery Bulletin, 85:179-185.

Lai, H.-L. 1993. Optimum sampling design for using the age-length key to estimate age composition of a fish population. Fishery Bulletin, 92:382-388.

Quinn, T. J. and R. B. Deriso. 1999. Quantitative Fish Dynamics. Oxford University Press, New York, New York. 542 pages.

See `alkIndivAge`

and related functions for a completely different methodology. See `alkprop`

from fishmethods for the exact same methodology but with a different format for the inputs.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
## Get data with length measurements and some assigned ages
data(WR79)
## Example -- Even breaks for length categories
WR1 <- WR79
# add length intervals (width=5)
WR1$LCat <- lencat(WR1$len,w=5)
# get number of fish in each length interval in the entire sample
len.n <- xtabs(~LCat,data=WR1)
# isolate aged sample and get number in each length interval
WR1.age <- subset(WR1, !is.na(age))
lenA.n <- xtabs(~LCat,data=WR1.age)
# create age-length key
raw <- xtabs(~LCat+age,data=WR1.age)
( WR1.key <- prop.table(raw, margin=1) )
# use age-length key to estimate age distribution of all fish
alkAgeDist(WR1.key,lenA.n,len.n)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.