All the input and output data for a calibration is located in an Access database titled “CalibrationSupport_xx.mdb”, where the “xx” signifies a name/date that uniquely identifies the calibration. An effort was made to capture nearly all input data and manipulations in the database and program code for documentation and reproducibility purposes.
Calibration Database Table Descriptions
AEQTable<-as.data.frame(read.csv("objects/AEQ.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:AEQTable)",
"Adult Equivalent Values",
"</caption>"),
"</p>")
AEQTable
BPCohortTable<-as.data.frame(read.csv("objects/BaseCohort.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:BPCohortTable)",
"Base Period Cohort Sizes",
"</caption>"),
"</p>")
BPCohortTable
BPRate<-as.data.frame(read.csv("objects/BaseExploitationRate.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:BPRate)",
"Base Period Exploitation Rates",
"</caption>"),
"</p>")
BPRate
MrkCatch<-as.data.frame(read.csv("objects/BasePeriodCatch.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:MrkCatch)",
"Base Period Marked Catches",
"</caption>"),
"</p>")
MrkCatch
TotalCatch<-as.data.frame(read.csv("objects/BasePeriodCatch_Tot.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:TotalCatch)",
"Base Period Total Catches (Marked + Unmarked)",
"</caption>"),
"</p>")
TotalCatch
MrkEscape<-as.data.frame(read.csv("objects/BPEscapements.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:MrkEscape)",
"Base Period Marked Escapements",
"</caption>"),
"</p>")
MrkEscape
TotalEscape<-as.data.frame(read.csv("objects/BPEscapements_Tot.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:TotalEscape)",
"Base Period Total Escapements (Marked + Unmarked)",
"</caption>"),
"</p>")
TotalEscape
Sinclair<-as.data.frame(read.csv("objects/CWT 10E adjustments.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:Sinclair)",
"Sinclair Inlet CWT Adjustments",
"</caption>"),
"</p>")
Sinclair
WhiteOOB<-as.data.frame(read.csv("objects/CWT_WhiteOOB.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:WhieOOB)",
"White River Out-of-Base CWT Recoveries",
"</caption>"),
"</p>")
WhiteOOB
CWTAll<-as.data.frame(read.csv("objects/CWTAll.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:CWTAll)",
"Coded-Wire-Tag Recovery Data",
"</caption>"),
"</p>")
CWTAll
Fish<-as.data.frame(read.csv("objects/Fishery.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:Fish)",
"JDF Surrogate CWTs",
"</caption>"),
"</p>")
Fish
MSP<-as.data.frame(read.csv("objects/FisheryModelStockProportion.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:MSP)",
"Marked Model Stock Proportions",
"</caption>"),
"</p>")
MSP
MSPTot<-as.data.frame(read.csv("objects/FisheryModelStockProportion_Tot.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:MSPTot)",
"Total (Marked + Unmarked) Model Stock Proportions",
"</caption>"),
"</p>")
MSPTot
FishScaler<-as.data.frame(read.csv("objects/FishScalar.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:FishScaler)",
"Fishery Scalers",
"</caption>"),
"</p>")
FishScaler
VBGrowth<-as.data.frame(read.csv("objects/Growth.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:VBGrowth)",
"Von Bertalaffy Growth Parameters",
"</caption>"),
"</p>")
VBGrowth
CWTSurrogate<-as.data.frame(read.csv("objects/ImputeRecoveries.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:CWTSurrogate)",
"Instructions for Imputing Surrogate CWT Recoveries",
"</caption>"),
"</p>")
CWTSurrogate
Incidental<-as.data.frame(read.csv("objects/IncidentalRate.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:Incidental)",
"Incidental Mortality Rates",
"</caption>"),
"</p>")
Incidental
MatRate<-as.data.frame(read.csv("objects/MaturationRate.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:MatRate)",
"Maturation Rates",
"</caption>"),
"</p>")
MatRate
NatRate<-as.data.frame(read.csv("objects/NaturalMortality.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:NatRate)",
"Natural Mortality Rates",
"</caption>"),
"</p>")
NatRate
NR<-as.data.frame(read.csv("objects/NonRetention.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:NR)",
"Marked Non-Retention Chinook Encounters",
"</caption>"),
"</p>")
NR
NRTot<-as.data.frame(read.csv("objects/NonRetention_Tot.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:NRTot)",
"Total (Marked + Unmarked) Non-Retention Chinook Encounters",
"</caption>"),
"</p>")
NRTot
SLRate<-as.data.frame(read.csv("objects/ShakerMortRate.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:SLRate)",
"Sublegal Mortality Rates",
"</caption>"),
"</p>")
SLRate
SizeL<-as.data.frame(read.csv("objects/SizeLimits.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:SizeL)",
"Minimum Size Limits",
"</caption>"),
"</p>")
SizeL
Stocks<-as.data.frame(read.csv("objects/Stocks.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:Stocks)",
"Maturation Rates",
"</caption>"),
"</p>")
Stocks
Run<-as.data.frame(read.csv("objects/SummaryInfo.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:Run)",
"Run Summary Information",
"</caption>"),
"</p>")
Run
SurrogateBPER<-as.data.frame(read.csv("objects/SurrogateFishBPER.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:SurrogateBPER)",
"Surrogate Fishery Base Period Exploitation Rates",
"</caption>"),
"</p>")
SurrogateBPER
TargetER<-as.data.frame(read.csv("objects/TargetEncounterRates.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:TargetER)",
"Target Encounter Rates",
"</caption>"),
"</p>")
TargetER
TermFlags<-as.data.frame(read.csv("objects/TerminalFisheryFlag.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:TermFlags)",
"Terminal Fishery Flags",
"</caption>"),
"</p>")
TermFlags
TimeSteps<-as.data.frame(read.csv("objects/TimeStep.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:TimeSteps)",
"FRAM Time Steps",
"</caption>"),
"</p>")
TimeSteps
Log<-as.data.frame(read.csv("objects/UpdateLog.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:Log)",
"Base Period Update Log",
"</caption>"),
"</p>")
Log
Weighting<-as.data.frame(read.csv("objects/Weighting.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:Weighting)",
"CWT Weighting",
"</caption>"),
"</p>")
Weighting
WhiteMatR<-as.data.frame(read.csv("objects/WhiteMatRate.csv"), header = TRUE)|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
rownames = FALSE,
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:WhiteMatR)",
"White River Maturation Rates",
"</caption>"),
"</p>")
WhiteMatR
lengthtable<-as.data.frame(read.csv("objects/Length at Age.csv", header = TRUE))|>
DT::datatable(filter = 'top',
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
cat("<p>", paste0("<caption>",
"(#tab:LAge)",
"Length-At-Age Distribution Parameters
Stage 1 analysis results. Maximum likelihood estimates of the mean, SD, and CV of fork length (FL, mm) by age (in months) for stock-time estimation strata for which sufficient records occurred to estimate distributional parameters (N = 20). Note, the two suspected outliers that were included in VBGF estimation but not in the CV function analysis are denoted by ‘**’; columns ‘Age’ and ‘Mean FL (cm)’ are the values used for fitting VBGFs.",
"</caption>"),
"</p>")
lengthtable
##WinBUGS code for VB Growth fxn #####
### Specs for FRAM VBGF parameter estimation:
## N = 3 chains, thinned to 1 in 50
## N = 31k total interations (1k initial, 30k thereafter, summarize 5001+)
model
{
# priors
mu.a0~dnorm(0, 0.001) # Mean hyperparameter for a0
mu.Linf~dnorm(0, 0.001) # Mean hyperparameter for Linf
mu.k~dnorm(0, 0.001) # Mean hyperparameter for k
sigma.a0~dunif(0, 10000) # SD hyperparameter for a0
sigma.Linf~dunif(0, 10000) # SD hyperparameter for Linf
sigma.k~dunif(0, 10000) # SD hyperparameter for k
sigma~dunif(0, 10000) # Residual standard deviation
tau.a0 <- 1/(sigma.a0*sigma.a0)
tau.Linf <- 1/(sigma.Linf*sigma.Linf)
tau.k <- 1/(sigma.k*sigma.k)
tau <- 1/(sigma*sigma) # Residual precision
# hierarchical parmeters
for (i in 1:P) {
Linf[i]~dnorm(mu.Linf, tau.Linf)
k[i]~dnorm(mu.k, tau.k)#I(0,)
a0[i]~dnorm(mu.a0, tau.a0)
}
# likelihood
for (i in 1:N) {
li[i] ~ dnorm(Lai[i],tau)
Lai[i]<-Linf[pop[i]]*(1-exp(-k[pop[i]]*(ai[i]-a0[pop[i]])))
# Observation-level GOF calcs
pred[i] <- Lai[i]
rep_li[i] ~ dnorm(pred[i], tau) #simulate perfect dataset
rep_resid[i] <- rep_li[i]-pred[i] #calc resid for simulated data
resid[i] <- li[i] - pred[i] #calc resid for actual data
sq[i] <- pow(resid[i],2) #calc squared resids for actual data sq_new[i] <- pow(rep_resid[i],2) #calc squared resids for simulated data
}
# Dataset-level GOF calcs
fit<-sum(sq[]) #sum squared resids for actual data
fit_new<-sum(sq_new[]) #sum squared resids for simulated data
test<-step(fit_new-fit) #determine which is greater (0s and 1s)
bpvalue<-mean(test) #mean of 0,1 gives Bayesian P-value
}
# inits
list(a0=c(-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5), k=c(0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03), Linf=c(950,950,950,950,950,950,950,950,950,950,950,950,950),mu.a0=-5,mu.k=0.03,mu.Linf=950,sigma.a0=1,sigma.Linf=1,sigma.k=1,sigma=1)
#data -- also must load secondary data file (Appendix A) with stock-month means
list(N=164, P=13) #n is 165 observations (0 indexed) and 13 stock aggregates