infill: Infill spawner/recruit abundance

View source: R/infillMatrices.R

infillR Documentation

Infill spawner/recruit abundance

Description

This function infills matrices based on observed geometric mean abundances and relative size of other CUs. In other words abundance is a function of average stock size and the observed return to observed stocks in a given year.

Usage

infill(mat)

Arguments

mat

A matrix of observed abundances with nrow equal to number of years and ncol equal to the number of stocks.

Details

Generally used with stocks that have gappy data, particularly in recent years because the closed-loop simulation model requires a seamless tran- sition between retrospective and forward simulated data.

Depends on helper function geoMean used to calculate geometric means.

Value

Returns a matrix of the same dimensions with NAs replaced by infilled values

Examples

set.seed(123)
#matrix of random time series representing stock abundance
popDat <- cbind(popA = round(exp(rnorm(20, 7, 1))),
                popB = round(exp(rnorm(20, 8, 1))),
                popC = round(exp(rnorm(20, 9, 1)))
)
#remove 20% of values
gaps <- floor(runif(n = 0.2 * length(popDat), min = 1, max = length(popDat)))
popDat[gaps] <- NA


CamFreshwater/samSim documentation built on Sept. 25, 2023, 10:22 a.m.