Skip to contents

A function to generate simulated double reading data with given properties

Usage

SimulatorFn(
  Nreaders,
  M,
  SelexForm,
  ErrorParams,
  BiasParams,
  SelexParams,
  ReadsMat,
  RecCv = 0.6,
  RecAr1 = 0.8,
  Amax = 100
)

Arguments

Nreaders

The number of ageing readers

M

True natural mortality

SelexForm

Form of selectivity-at-age (logistic selex-at-age is the only one that is implemented).

ErrorParams

Error type CV in the following equation: VarAgeRead = (CV*TrueAge)^2

BiasParams

Bias type b in the following equation: EAgeRead = b*TrueAge

SelexParams

Selectivity parameters, which are standard to the logistic equation.

ReadsMat

Matrix describing number of reads per reader combination. Where each row specifies how many reads (in the first column) have a particular pattern of double reads (in the second through Nreaders+1 columns).

RecCv

CV of recruitment, and it shoudl be noted that recruitment is assumed to be stationary over time.

RecAr1

First-order autoregressive coefficient for recruitment

Amax

True maximum age

Value

Returns a simulated double read matrix

References

Punt, A.E., Smith, D.C., KrusicGolub, K., and Robertson, S. 2008. Quantifying age-reading error for use in fisheries stock assessments, with application to species in Australias southern and eastern scalefish and shark fishery. Can. J. Fish. Aquat. Sci. 65: 1991-2005.

Author

James T. Thorson

Examples

# Parameters for generating data
# This represents 2 unique readers
# Row 1 -- Otoliths read only once by reader
# Row 2 -- Otoliths read twice by reader 1
# Row 2 -- Otoliths read only once by reader 2
# Row 4 -- Otoliths read twice by reader 2
# Row 5 -- Otoliths read once by reader 1 and once by reader 2
ReadsMat <- structure(matrix(
  nrow = 5, ncol = 5,
  c(
    rep(25, 5),
    1, 1, 0, 0, 1,
    0, 1, 0, 0, 0,
    0, 0, 1, 1, 1,
    0, 0, 0, 1, 0
  )
), dimnames = list(
  c(
    "Reader1_Only", "Reader1_DoubleReads",
    "Reader2_Only", "Reader2_DoubleReads",
    "Reader1_&_Reader2"
  ),
  c(
    "NumberOfReads",
    "Reader1", "Reader1_DoubleReads",
    "Reader2", "Reader2_DoubleReads"
  )
))

# Generate data
set.seed(2)
AgeReads <- SimulatorFn(
  Nreaders = 4, M = 0.2,
  SelexForm = "Logistic",
  SelexParams = c(5, 0.2), BiasParams = c(1, 1, 1.1, 1.1),
  ErrorParams = c(0.2, 0.2, 0.2, 0.2), ReadsMat = ReadsMat,
  RecCv = 0.6, RecAr1 = 0.8, Amax = 100
)