Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
okenk committed Dec 11, 2024
2 parents 1ce5596 + 5e5099d commit f420065
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Rscripts/explore_indices.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# load new triennial index run with indexwc/sdmTMB
tri_new <- read.csv("\\\\nwcfile/fram/Assessments/CurrentAssessments/yellowtail_rockfish_north/data/surveys/triennial/delta_gamma/index/est_by_area.csv")
# repurpose area column to indicate which model run
tri_new <- tri_new |>
dplyr::filter(area == "North of Cape Mendocino") |>
dplyr::mutate(area = "new indexwc")

# load old model (3.30.23 version separates input and adjusted SE in output)
yt1 <- SS_output("Model_Runs/base_2017_3.30.23")
# format old model index to match indexwc output
tri_old <- yt1$cpue |>
dplyr::filter(Fleet_name == "Triennial" & Use == 1) |>
dplyr::select(Yr, Obs, SE_input) |>
dplyr::mutate(area = "old VAST from 2017", .before = "Yr") |>
dplyr::rename(year = "Yr", est = Obs, se = SE_input) |>
dplyr::mutate(
lwr = qlnorm(p = 0.025, meanlog = log(est), sdlog = se),
upr = qlnorm(p = 0.975, meanlog = log(est), sdlog = se),
log_est = log(est),
.before = "se"
) |>
dplyr::mutate(type = "index")

# use indexwc function
index_compare <- indexwc::plot_indices(rbind(tri_new, tri_old)) +
ggplot2::scale_color_discrete() # viridis default yellow was too pale
# replace file saved by indexwc::plot_indices() with viridis colors
ggsave("figures/index_comparisons_triennial_sdmTMB_vs_VAST.png")

0 comments on commit f420065

Please sign in to comment.