Version 1.25 2020 Status Review
This the version of NWCTrends used in the 2020 Status Review.
Some notes for trend document 2020 versus 2015.
In 2015, I used all the data available to estimate the Q matrix (equalvarcov) and R matrix (diagonal and equal). So if one population had data back to 1949, say, and another data til 2015, say, then the data matrix was 1949:2015. Missing values were filled with NAs. So many NAs if one population happened to have a long dataset. The 2015 data_setup() function had min.year=1975, max.year=2014, which makes it seem that it was fitting to min 1975, but that's not what it did. For 2020, I added fit.min.year and fit.max.year to data_setup(), and that forces a min year and a max year that you pass in. Note that if you don't have data up to fit.max.year, it will fill in a bunch of NAs up to fit.max.year.
Ozette Lake sockeye. For 2015, I hard-coded in the Q estimate. It is in trend_fits(). In 2020, I removed this.
The following is the script that was run to produce the figure and tables in the 2020 Status Review:
# June 27, 2021
library(NWCTrends)
fils <- dir("Data/SR2020")
fils <- fils[stringr::str_detect(fils, "csv")]
for(fil in fils){
infil <- file.path("Data/SR2020", fil)
outdir <- paste0("Output/", stringr::str_split(fil, "[.]csv")[[1]][1])
cat("\n", infil, "\n")
ans <- readline("Run this file? (y/n)")
if (substr(ans, 1, 1) == "n") next
NWCTrends::NWCTrends_report(inputfile=infil,
fit.min.year=1949, fit.max.year = 2019,
plot.min.year=1980, plot.max.year = 2019,
geomean.table.control=list(
min.year=1990, max.year=2019, lenbands=5,
min.band.points=2, change.col="last.two"),
trend.table.control=list(
year.ranges=list(1990:2005,2004:2019)),
output.type = "word",
output.dir = outdir
)
}