adv.FLIBM: Advance FLIBM stock

View source: R/adv.FLIBM.R

adv.FLIBMR Documentation

Advance FLIBM stock

Description

Advance FLIBM stock

Usage

adv.FLIBM(obj, years = NULL, seasons = NULL, monitor = TRUE, purgeProb = 0.05)

Arguments

obj

object of class FLIBM

years

character vector. years to cycle for advancement. Defaults to full length of dimension. Vector should follow chronological order.

seasons

character vector. seasons to cycle for advancement. Defaults to full length of dimension. Vector should follow chronological order. If shorter than a full year, then the year argument should be for a single year.

monitor

logical. Should progression be printed.

purgeProb

probability of purging empty inds during time step (between 0 and 1)

Value

FLIBM object

Examples


stk <- create.FLIBM(years=ac(2000:2009))
stk$rec$params$season_wt[] <- c(0,0,0.25,1,0.25,0,0,0,0,0,0,0)
dimnames(stk$stock.l@stock.n)['year']
nrow(stk$inds)
stk$stock.a@stock.n[,'2000',,,,]

set.seed(1)
stk <- adv.FLIBM(obj = stk, years = ac(2000:2009))
plot(stk$stock.a@stock.n)

# plot length-frequency
DIM <- dim(stk$stock.l@catch.n)
DIMNAMES <- dimnames(stk$stock.l@catch.n)

lfq <- flquant2lfq(stk$stock.l@catch.n)

pal <- colorRampPalette(c("grey30",5,7,2), bias=1.5)
with(lfq, image(x=dates, y=midLengths, z=t(catch), col=pal(100)))


# numbers by age at start of the year
stk$stock.a@range[c("minfbar", "maxfbar")] <- c(2,4)
stk.yr <- simplifySeason(stk)
stk.yr <- stk.yr[2:dim(stk.yr)[1],] # removes age=0 class
plot(stk.yr)

# Biomass at age
plot(stk$stock.a@stock.n[,,,1,,]*stk$stock.a@stock.wt[,,,1,,])

# catch curve
tmp <- stk.yr@catch.n[,"2009"]
tmp
plot(1:6, log(c(tmp)))
df <- data.frame(logN = log(c(tmp))[1:4], age = 1:4)
fit <- lm(logN ~ age, df)
fit
abline(fit, col=2)



marchtaylor/FLIBM documentation built on Jan. 19, 2025, 10:56 p.m.