-
Notifications
You must be signed in to change notification settings - Fork 0
/
ER_comp_fram_rmis.Rmd
1864 lines (1550 loc) · 83.7 KB
/
ER_comp_fram_rmis.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Comparing Coho FRAM and RMIS estimates of exploitation"
date: "`r Sys.Date()`"
editor_options:
chunk_output_type: console
output:
bookdown::html_document2:
self_contained: true
fig_caption: yes
theme: cerulean
toc: yes
toc_depth: 3
toc_float: yes
code_folding: hide
---
```{r setup, results = FALSE, warning = FALSE, message = FALSE}
knitr::opts_chunk$set(echo = TRUE, results = FALSE, warning = FALSE, message = FALSE, fig.width = 9, fig.height = 9)
library("tidyverse")
library("gt")
library("patchwork")
library("odbc"); library("DBI")
theme_set(theme_light())
pal_ftype <- c("escp" = "#483778", "net" = "#D2A554", "sport" = "#626B5D", "troll" = "#8C8F9E")
dir_proj <- "T:/DFW-Salmon Mgmt Modeling Team - General/Southern Fund Projects/Coho FRAM MSM CWT analysis"
fp <- list(
#RMIS query dataset construction shown below
rmis_recs = file.path(dir_proj, "rmis_coho_recoveries_86_2020.rds"),
rmis_rel = file.path(dir_proj, "rmis_coho_releases_for_rec_86_2020.rds"),
rmis_rec_rel = file.path(dir_proj, "rmis_coho_rec_rel_86_2020.rds"),
mdb_pst = "O:/code/coho/fram_mdbs/PSC_CoTC_PostSeason_CohoFRAMDB_thru2020_021622.mdb",
lu_stock = "lu_cct_MSM_Stock_CWT_20220913.csv",
lu_fish = "lu_ahb_FishMap_20220826.csv",
samp_catch_coef = "fram_samp_fulla.csv"
)
lu <- list(
##CCT queried tag_codes of marked releases, QAQC'd and assigned to PR and PR_MU
##these are assigned to FRAM StockIDs
cwt_stk = readr::read_csv(fp$lu_stock, col_select = -Comment) |>
mutate(tag_code = str_remove(CWT_Code, "'")) |>
select(tag_code, n_rel = Number_Released, Release_name, Hatchery_name, Stock_name, StockID) |>
filter(!is.na(StockID))
,
##AHB extended prior FRAM fishery mapping on RMIS recovery_location_code and fishery/gear
##various QAQC during earlier project phases
ahb_fishmap = readr::read_csv(fp$lu_fish) |>
select(FisheryID, FisheryName, fishery_single = Gear, Num_Chars, PSC_Code) |>
distinct(FisheryID, FisheryName, fishery_single, Num_Chars, PSC_Code)
)
# escp <- readxl::read_excel("T:/DFW-Salmon Mgmt Modeling Team - General/Escapement files/Coho/fram_coho_escapement_2022.xlsx", sheet = "dataset") |>
# select(StockID, StockLongName, year, escp_val, escp_val_data_source)
# #for AHB, merging into her script
# saveRDS(list(
# lu = lu,
# pal_ftype = pal_ftype, rmis_rr_rgn = rmis_rr_rgn,
# rmis_n_recs_per_stock = rmis_n_recs_per_stock,
# samp_catch_coef_vals = samp_catch_coef_vals,
# er_fram = er_fram, er_rmis = er_rmis, er_fram_rmis = er_fram_rmis,
# gg_stk = gg_stk
# ), file = "T:/DFW-Salmon Mgmt Modeling Team - General/Southern Fund Projects/Coho FRAM MSM CWT analysis/ER_comp_fram_rmis_obj.rds")
```
This analysis examines post-season ("validation") estimates of stock and fishery specific mortality generated by [coho FRAM](https://framverse.github.io/fram_doc/calcs_data_coho.html), comparing them to patterns of coded wire tag (CWT) recoveries housed in the Regional Mark Information System [(RMIS)](https://www.rmpc.org/).
Coho FRAM predicts impacts to modeled stocks according to a "base period" drawn from CWT recoveries in catch years 1986-1992 (see https://framverse.github.io/fram_doc/index.html for additional description). The continued applicability of this parameterization is of interest to fisheries managers concerned with meeting conservation and harvest allocation objectives.
Comparing a dataset of recent recovery patterns with results based on older CWT recoveries does not address the fundamental assumption that inferences about the harvest of non-hatchery stocks are adequately informed by coded wire tagging that is overwhelmingly focused on hatchery production. Nor does this analysis attempt to determine whether recent year coho FRAM post-season exploitation rates (ER) are quantitatively accurate relative to those that might be reconstructed outside of FRAM: arriving at a "true" stock ER requires data from robust sampling throughout all phases of harvest and post-harvest escapement, and these data are not readily available for most of the coho FRAM stock units.
Instead, this investigation focuses on (dis)agreements in the relative assignment of catch mortality in primarily pre-terminal, highly mixed stock fisheries, seeking to understand how well the FRAM representation accords with current observations in RMIS. That is, we ask, "For a given stock, how well do the magnitude and relative ranks of annual per-fishery exploitation align between datasets?" Attempting to answer this seemingly straightforward question also highlights discrepancies that warrant additional auditing to ensure that data are sufficiently high quality to support management decisions and risk considerations.
# Data
Coho FRAM includes net, troll and sport fisheries that occur in pre-terminal, terminal and freshwater areas. Freshwater sport, most freshwater net and some near-terminal net were excluded from the analysis due to the practical constraint of limited and inconsistent sampling and the conceptual presumption that the stock composition of these fisheries is subject to much less uncertainty, notwithstanding some amount of "dip-ins" from neighboring river systems. In addition, RMIS Catch & Sample data were inspected and compared with fishery catch values used in post-season FRAM runs. Individual fishery-year combinations were removed when the sampled portion of catch diverged substantially from the total reported catch, and fisheries were excluded entirely if the proportion of catch that was sampled was chronically low. Where smaller annual differences occurred more sporadically, an expansion coefficent was generated based on the ratio of sampled to total reported catch (e.g., a total reported catch of 1600 and sampled catch totaling 1300 produced an adjustment coefficient of ~1.23). These coefficients were then applied to the sampling-expansion based "estimated_number" values reported for individual recoveries, thereby better aligning the fishery totals between FRAM and RMIS. See section "Handling of RMIS Catch/Sample data" in the accompanying report for additional description and code.
```{r included_fisheries}
# #excluding:
# - freshwater sport (little/no sampling)
# - most terminal (stock comp presumed less varied; very uneven sampling)
# - others with little/no recent year catch and/or sampling
# included:
fishery_ids <- c(
15, 17, 18, 19, 20, 21, 22, #CA/OR
23:33, 34, 35, 37, 38, 39, 40, 41, 42, 43, #B10/WA Ocn
44, 45, 47, 48, 50, 81, 83, 88, 91, 92, 93,
97, 98, 102, 106, 107, 110, 112, 115,
118, 120, 122, 124, 125, 129, 136, 142, 144,
152, 154, 156, 158, 160, #161, 162, #161 Skok R 162 Quilcene R
171, 172, 174, 175, 178, 179, 182, 189, #BC
194, 195, 196, 197, 198, #AK
#NT members of Tr/NT pairs missing from fram_samp_fulla
80, 82, 87, 96, 101, 109, 111, 119, 121, 123,
130, 132, 137, 139, 141, 143, 145, 153, 155, 157, 159
)
#per AHB request to combine NT & Tr net fisheries
#dropping several NT of now dropped pairs: 130, 132, 137, 139, 146
fishery_ids_paired <- c(
80, 82, 87, 96, 101, 109, 111, 119, 121, 123,
#130, 132, 137, 139,
141, 143,
#145,
153, 155, 157, 159
)
fishery_ids_ps_spt <- c(91:93, 107, 118, 129, 152, 136, 106, 115)
#per-fishery-year coefficients based on the proportion sampled of RMIS-reported catch
#these are applied to adjust the "estimated_number" values of the stock-specific recoveries in that fishery-year
#if a fishery-year reporting a catch of 1000 had sampling for 500, the coefficient value is 2
#attempting to "expand" the sampled portion of the total catch in RMIS
#the ideal situation would have the FRAM landed catch input match the RMIS total and sampled values
samp_catch_coef <- read_csv(fp$samp_catch_coef) |> select(FisheryID:Action)
## fisheries with very large coefficients
# samp_catch_coef |>
# filter(Source=="Xpansion") |>
# select(FisheryID, FisheryName, Action, `2010`:`2019`) |>
# pivot_longer(names_to = "year", values_to = "coef", `2010`:`2019`) |>
# filter(coef >= 2) |> arrange(desc(coef)) |>
# unite("fy", FisheryID, FisheryName, year) |>
# ggplot(aes(coef, fct_reorder(fy, coef))) + geom_col() + geom_vline(xintercept = 8)
# ## fisheries with some years of 0 coefficents (i.e., irregular removal)
# ## note in some versions the FisheryName labeling is reversed for 38 (actually NT A3 trl) and 39 (Treaty)
# ## confirmed that 39/Tr A3 trl is the fishery with weaker sampling
# samp_catch_coef |>
# filter(Source=="Xpansion") |>
# select(FisheryID, FisheryName, Action, `2010`:`2019`) |>
# pivot_longer(names_to = "year", values_to = "coef", `2010`:`2019`) |>
# unite("fn", FisheryID, FisheryName) |>
# filter(coef == 0) |>
# count(fn) |>
# filter(n != 10) |> #filter(n > 4) #c(39, 44, 142, 179, 182, 189)
# arrange(desc(n)) |>
# ggplot(aes(n, fct_reorder(fn, n))) + geom_col() + geom_vline(xintercept = 3)
# samp_catch_coef |> filter(Source == "Xpansion") |> count(Action)
#
# samp_catch_coef |>
# filter(Source == "Xpansion", (Action != "Remove fishery" | is.na(Action))) |>
# distinct(FisheryID) |> paste() |> cat()
## note this appears to have been constructed after "pairing" Tr/NT
## added back missing NT paired members
```
## FRAM
Estimates of landed catch and post-fishing escapement (from the *Mortality* and *Escapement* database tables respectively) were queried from the Pacific Salmon Commission Coho Technical Committee post-season FRAM database for run years 2010 to 2019. The 2015 "crash" and 2016 "post-crash" years were included in the dataset and some analyses but were generally considered uninformative of "typical" patterns.
```{r get_starting_fram_dataset}
fram <- list()
# ## initial focus on relatively data-rich units, particularly with PST relevance
# #Skagit, Sno, Quilcene, George Adams, Nisqually, Green, Quillayute, Queets, Quinault, Chehalis, Willapa, Columbia Early, Columbia Late, Fraser Lower, Fraser Upper
# stock_ids <- c(20, 38, 48, 58, 68, 96, 134, 142, 148, 152, 164, 166, 176, 226, 230)
# #all hatchery stocks, M and UM, including Northern hat/wild
# tbl(db_con, "Stock") |> filter(Species=="COHO") |> collect() |> filter(str_detect(StockLongName, "atch|ens")) |> pluck("StockID") |> paste(collapse = ", ")
stock_ids <- c(3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 19, 20, 21, 22, 25, 26, 27, 28,
31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 47, 48, 49, 50, 53, 54,
57, 58, 65, 66, 67, 68, 71, 72, 73, 74, 77, 78, 79, 80, 83, 84,
87, 88, 91, 92, 95, 96, 99, 100, 103, 104, 109, 110, 113, 114,
119, 120, 125, 126, 129, 130, 133, 134, 137, 138, 141, 142, 143, 144,
147, 148, 151, 152, 155, 156, 159, 160, 163, 164, 165, 166, 167, 168,
175, 176, 177, 178, 181, 182, 185, 186, 189, 190, 191, 192, 193, 194,
197, 198, 201, 202, 205, 206, 209, 210, 213, 214, 217, 218, 221, 222,
225, 226, 229, 230, 233, 234, 235, 236, 237, 238)
run_ids <- 34:44 #2010:2020
db_con <- DBI::dbConnect(
drv = odbc::odbc(),
.connection_string = paste0(
"Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=",
fp$mdb_pst, ";")
)
fram$fishery <- tbl(db_con, "Fishery") |>
filter(Species == "COHO") |>
select(FisheryID:FisheryTitle) |>
collect()
DBI::dbDisconnect(db_con)
fram$escp <- framr::read_coho_escp(fp$mdb_pst, runs = run_ids, stocks = stock_ids)
fram$mort <- framr::read_coho_mort(fp$mdb_pst, runs = run_ids, stocks = stock_ids)
fram$mort |> distinct(StockID, StockLongName) |> arrange(StockID) |> gt()
fram$fishery |> filter(FisheryID %in% fishery_ids) |> gt()
```
## RMIS
All recoveries of marked coho between the years 1986 and 2020 were queried from RMIS, and these were joined with the release data associated with the distinct tag codes in this set. This core dataset was augmented with recent year Canadian stock escapement recovery records provided by DFO. An age field was calculated as the difference between `run_year` and `brood_year`, allowing later limitation to the 3 year old fish tracked in FRAM, and records with a `sample_type` 5 were excluded as uninformative. Finally, the individual records were mapped to FRAM stocks according to a `tag_code` lookup table and to FRAM fisheries via reference to the `recovery_location_code` and `fishery` fields.
The first three chunks preserve one-time operations to generate starting datasets from RMIS, and the fourth performs the stock and fishery mapping.
```{r read_in_rmis_recoveries, eval=FALSE}
dir_rmis_recs <- "T:/DFW-Salmon Mgmt Modeling Team - General/Southern Fund Projects/Coho FRAM MSM CWT analysis/ERAnalysis/RMISRecoveries/"
focal_cols_recs <- c(
"recovery_id", "tag_code", "run_year",
"recovery_location_code", "recovery_location_name",
"fishery", "gear", "estimated_number", "recorded_mark",
"catch_sample_id", "sample_type")
rmis_recs <- purrr::map_dfr(
list.files(dir_rmis_recs, pattern = ".TXT", full.names = T)
,
~readr::read_csv(.x, col_select = all_of(focal_cols_recs)) |>
dplyr::mutate(recorded_mark = as.character(recorded_mark))
)
#saveRDS(rmis_recs, "T:/DFW-Salmon Mgmt Modeling Team - General/Southern Fund Projects/Coho FRAM MSM CWT analysis/rmis_coho_recoveries_86_2020.rds")
```
```{r get_releases_by_tag_code, eval=FALSE}
rmis_recs |>
distinct(tag_code) |> rownames_to_column(var = "id") |>
mutate(
id = as.numeric(id),
block = cut(id, breaks = c(seq(0,20000,by=2000))),
block = letters[as.integer(block)]
) |> #count(block)
split(~block) |>
writexl::write_xlsx("T:/DFW-Salmon Mgmt Modeling Team - General/Southern Fund Projects/Coho FRAM MSM CWT analysis/ERAnalysis/tag_codes_by_block.xlsx")
f <- "T:/DFW-Salmon Mgmt Modeling Team - General/Southern Fund Projects/Coho FRAM MSM CWT analysis/ERAnalysis/tag_codes_by_block.xlsx"
readxl::read_excel(f, sheet = "a") |> pluck("tag_code") |> writeLines("clipboard")
readxl::read_excel(f, sheet = "b") |> pluck("tag_code") |> writeLines("clipboard")
readxl::read_excel(f, sheet = "c") |> pluck("tag_code") |> writeLines("clipboard")
readxl::read_excel(f, sheet = "d") |> pluck("tag_code") |> writeLines("clipboard")
readxl::read_excel(f, sheet = "e") |> pluck("tag_code") |> writeLines("clipboard")
readxl::read_excel(f, sheet = "f") |> pluck("tag_code") |> writeLines("clipboard")
readxl::read_excel(f, sheet = "g") |> pluck("tag_code") |> writeLines("clipboard")
focal_cols_rel <- c(
"tag_code_or_release_id", "brood_year",
"release_location_code", "hatchery_location_code", "stock_location_code",
"release_location_name", "hatchery_location_name", "stock_location_name",
"release_location_state", "release_location_rmis_region", "release_location_rmis_basin",
"cwt_1st_mark", "cwt_1st_mark_count", "cwt_2nd_mark", "cwt_2nd_mark_count"
)
rmis_rel <- map_df(
c(
"https://www.rmis.org/reports/CSV13497.txt",
"https://www.rmis.org/reports/CSV13656.txt",
"https://www.rmis.org/reports/CSV13738.txt",
"https://www.rmis.org/reports/CSV13814.txt",
"https://www.rmis.org/reports/CSV13854.txt",
"https://www.rmis.org/reports/CSV14030.txt",
"https://www.rmis.org/reports/CSV14116.txt"
),
~read_csv(.x, col_select = all_of(focal_cols_rel)) |>
mutate(
cwt_1st_mark = as.character(cwt_1st_mark),
cwt_2nd_mark = as.character(cwt_2nd_mark)
)
)
#saveRDS(rmis_rel, "T:/DFW-Salmon Mgmt Modeling Team - General/Southern Fund Projects/Coho FRAM MSM CWT analysis/rmis_coho_releases_for_rec_86_2020.rds")
```
```{r join_rel_to_rec, eval=FALSE}
left_join(
readRDS(fp$rmis_recs) |>
mutate(
rlsp = str_sub(recovery_location_code, 1, 1),
rlwtr = str_sub(recovery_location_code, 2, 2),
rlsctr = str_sub(recovery_location_code, 3, 3),
rlrgn = str_sub(recovery_location_code, 4, 5),
rlarea = str_sub(recovery_location_code, 6, 9),
rllocn = str_sub(recovery_location_code, 10, 16),
rlsubl = str_sub(recovery_location_code, 17, 19),
f_type = case_when(
between(fishery, 10, 19) ~ "troll",
between(fishery, 20, 39) ~ "net",
between(fishery, 40, 49) ~ "sport",
between(fishery, 50, 59) ~ "escp"
)
)
,
readRDS(fp$rmis_rel) |> select(-contains("n_code")),
by = c("tag_code" = "tag_code_or_release_id")
) |> #saveRDS(file.path(dir_proj, "rmis_coho_rec_rel_86_2020.rds"))
```
```{r rmis_rr}
#primary dataset, constructed and preserved in chunks above
rmis_rr <- readRDS(fp$rmis_rec_rel) |>
filter(
sample_type != 5,
!is.na(release_location_state)
) |> #drop 3 recent
mutate(age = run_year - brood_year) |>
rowid_to_column("uid")
#adding missing Canadian escapements
rmis_rr <- bind_rows(
rmis_rr,
readxl::read_xlsx(
file.path(dir_proj, "ERAnalysis/2022-02-23 StAD Escapement Report_Coho_EPAD.xlsx"),
sheet = "Obs-Est-Exp"
) |>
rowid_to_column(var = "uid") |>
mutate(
uid = uid + last(rmis_rr$uid),
age = `Recovery Year` - `Brood Year`,
fishery = 50,
f_type = "escp"
) |>
select(
uid,
tag_code = Tagcode,
recovery_location_code = `PSC Location Code`,
recovery_location_name = `Recovery Site Name`,
run_year = `Recovery Year`,
brood_year = `Brood Year`,
age,
fishery, f_type,
estimated_number = `Final Expanded`
) |>
filter(
tag_code %in% unique(rmis_rr$tag_code),
age == 3
)
)
#add CCT mapped StockIDs
rmis_rr <- rmis_rr |> left_join(lu$cwt_stk, by = c("tag_code"))
#add AHB mapped FisheryIDs
#cannot directly join on 'PSC_Code'...have to use the Num_Chars field
#but that means using many possible lengths of recovery_location_code
#brute force iterator over Num_chars + uid to allow recombination
#first declare temp object of only key fields
rmis_rr_ahb_map <- rmis_rr |>
select(uid, recovery_location_code, fishery) |>
mutate(fishery_single = floor(fishery/10))
#now overwrite as split-then-bind pattern on Num_Chars
#per AHB request, added explicit right string padding to specified string length
#even when actual strings in RMIS and LU are/use fewer char
rmis_rr_ahb_map <- map_df(
sort(unique(lu$ahb_fishmap$Num_Chars)),
~inner_join(
rmis_rr_ahb_map |>
mutate(PSC_Code = str_sub(recovery_location_code, 1, .x) |> str_pad(width = .x, side = "right"))
,
lu$ahb_fishmap |> filter(Num_Chars == .x) |>
mutate(PSC_Code = str_pad(PSC_Code, width = .x, side = "right"))
,
by = c("PSC_Code", "fishery_single")
)
)
#some cases of same fishery from different n-chars being considered on same recovery_location_code
#some cases initially from simple row duplication in lookup, now fixed on read-in
overmapped <- rmis_rr_ahb_map |> count(uid) |> filter(n>1) |> select(uid)
#now rejoin to full dataset, after making FisheryID distinct per UID
rmis_rr <- left_join(
rmis_rr,
#split out multiple-mapped, make distinct per UID and rebind
bind_rows(
anti_join(rmis_rr_ahb_map, overmapped, by = "uid") |>
select(uid, FisheryID)
,
semi_join(rmis_rr_ahb_map, overmapped, by = "uid") |>
group_by(uid) |>
slice_max(Num_Chars, n = 1, with_ties = F) |>
ungroup() |>
select(uid, FisheryID) #|> count(uid) |> filter(n>1)
)
,
by = "uid") |>
left_join(fram$fishery, by = "FisheryID")
rm(rmis_rr_ahb_map, overmapped)
#split Ocean troll into treaty/non-treaty
rmis_rr <- rmis_rr |>
mutate(
FisheryID = if_else(FisheryID %in% c(35, 38, 42) & fishery==15, FisheryID+1, FisheryID),
FisheryName = if_else(FisheryID==36, "Area2TrlTR", FisheryName),
FisheryName = if_else(FisheryID==39, "Area3TrlTR", FisheryName),
FisheryName = if_else(FisheryID==43, "A4/4BTrlTR", FisheryName)
)
# rmis_rr |> filter(FisheryID %in% c(35, 36, 38, 39, 42, 43)) |> distinct(FisheryID, FisheryName, fishery, gear)
# rmis_rr |>
# #filter(between(run_year, 2010, 2019)) |>
# count(recovery_location_code) |> arrange(desc(n))
```
### Recovery patterns since 1986
As others have noted, recent years have generally seen fewer coho CWT recoveries than during the coho FRAM base period years, within both sampled fisheries and escapement (to hatcheries and in-river).
```{r rmis_rr_rgn}
rmis_rr_rgn <- rmis_rr |>
filter(between(run_year, 1986, 2019), between(as.integer(cwt_1st_mark), 5000, 5500)) |>
count(run_year, f_type, release_location_state, release_location_rmis_region, release_location_rmis_basin) |>
mutate(
rgn = case_when(
release_location_state == "AK" ~ "AK",
release_location_state == "BC" | (is.na(release_location_state) & f_type == "escp") ~ "BC",
release_location_rmis_region == "CECR" | release_location_rmis_region == "CRGN" |
release_location_rmis_region == "LOCR" | release_location_rmis_region == "UPCR" ~ "Columbia R.",
release_location_rmis_region == "HOOD" | release_location_rmis_region == "JUAN" |
release_location_rmis_region == "MPS" | release_location_rmis_region == "NOWA" |
release_location_rmis_region == "NPS" | release_location_rmis_region == "SKAG" |
release_location_rmis_region == "SPS" ~ "WA Puget Sound",
release_location_rmis_region == "GRAY" | release_location_rmis_region == "NWC" |
release_location_rmis_region =="WAGN" | release_location_rmis_region == "WILP" ~ "WA Coastal",
release_location_rmis_region == "SOOR" | release_location_rmis_region == "KLTR" |
release_location_rmis_region == "NOCA" ~ "SONCC",
release_location_rmis_region == "NOOR" | release_location_rmis_region == "ORGN" |
release_location_rmis_region == "CECA" | release_location_rmis_region == "SAFA" |
release_location_rmis_region == "SNAK" ~ "OR,CA,SNAK"
),
yrs = case_when(
between(run_year, 1986, 1992) ~ "1986-1992",
between(run_year, 2010, 2019) ~ "2010-2019"
)
)
```
```{r recs_by_yrs, fig.height=6, fig.width=7}
rmis_rr_rgn |>
group_by(yrs, f_type) |>
summarise(n = sum(n), .groups = "drop") |>
drop_na(yrs, f_type) |>
ggplot(aes(yrs, n, fill = f_type)) +
geom_col(position = position_dodge()) +
scale_fill_manual(values = pal_ftype, name = "") +
scale_x_discrete("") +
scale_y_continuous("CWT count", labels = scales::comma) +
labs(title = "Recovery counts by time period and type")
```
These decreases can be differentiated relative to the locations of tagged releases.
```{r recs_by_rgn_series_cols, fig.height=11, fig.width=9}
(
rmis_rr_rgn |>
filter(f_type != "escp") |>
ggplot(aes(run_year, n, fill = f_type)) +
geom_col() +
scale_x_continuous("", n.breaks = 8, guide = guide_axis(n.dodge = 2)) +
scale_y_continuous("CWT count", labels = scales::comma) +
scale_fill_manual(values = pal_ftype, name = "") + #wacolors::scale_fill_wa_d(palette = "larch", name = "") +
facet_wrap(~rgn, ncol = 1) +
labs(title = "Fishery recoveries")
) + (
rmis_rr_rgn |>
filter(f_type == "escp") |>
ggplot(aes(run_year, n, fill = f_type)) +
geom_col(show.legend = F) +
scale_x_continuous("", n.breaks = 8, guide = guide_axis(n.dodge = 2)) +
scale_y_continuous("", labels = scales::comma) +
scale_fill_manual(values = pal_ftype) + #wacolors::scale_fill_wa_d(palette = "uw") +
facet_wrap(~rgn, ncol = 1) +
labs(title = "Escapement recoveries") #+ theme(legend = element_blank())
) +
plot_layout(nrow = 1, guides = 'collect')
```
```{r}
#appendix table per AHB request
rmis_n_recs_per_stock <- rmis_rr |>
drop_na(estimated_number, StockID) |>
filter(between(run_year, 2010, 2019)) |>
count(StockID, f_type) |>
drop_na(f_type) |>
pivot_wider(names_from = f_type, values_from = n) |>
left_join(fram$mort |> distinct(StockID, StockLongName), by = "StockID") |>
drop_na(StockLongName) |>
select(StockID, StockLongName, everything())
```
# Exploitation calculations
Per stock, per year, a "pseudo-ER" was calculated by dividing the annual per-fishery landed catch (FRAM, non-selective + mark-selective, timesteps 1 to 5) or `estimated_number` (RMIS, summed over individual recoveries) by the sum of the total across fisheries and the non-fishery escapement. For the FRAM case:
$pseudoER_{s,f,y} = \frac{LC_{s,f,y}}{Escp_{s,y} + \sum_{f}LC_{s,f,y}}$
In addition, the "total pseudo-ER" was calculated similarly by dividing the across-fishery total by the sum of this value and escapement. For the RMIS case:
$pseudoER_{s,y} = \frac{\sum_{f}EstNum_{s,f,y}}{Escp_{s,y} + \sum_{f}EstNum_{s,f,y}}$
These values were then joined by year, stock and fishery to allow comparison between the two data sources.
```{r er_objects_included_fisheries}
#limiting expansion to 8x, drops several Canadian fishery-years
samp_catch_coef_vals <- samp_catch_coef |>
filter(Source == "Xpansion", (Action != "Remove fishery" | is.na(Action))) |>
select(FisheryID, `2010`:`2019`) |>
pivot_longer(cols = -FisheryID, names_to = "run_year", values_to = "coef") |>
mutate(
run_year = as.numeric(run_year),
coef = if_else(coef > 8, 0, coef),
coef = if_else(FisheryID %in% c(39, 44, 142, 179, 182, 189), 0, coef)
)
er_fram <- full_join(
fram$mort |>
mutate(
run_year = as.integer(RunYear), RunYear = NULL,
FisheryID = if_else(FisheryID %in% fishery_ids_paired, FisheryID+1, as.double(FisheryID)),
FisheryName = if_else(FisheryID %in% c(fishery_ids_paired, fishery_ids_paired+1),
str_sub(FisheryName, 1,8), FisheryName),
FisheryID = if_else(FisheryID == 98, 97, as.double(FisheryID)),
FisheryName = if_else(FisheryID == 97, "A7BCDNet", FisheryName)
) |>
filter(FisheryID %in% fishery_ids) |>
group_by(run_year, StockID, StockLongName, FisheryID, FisheryName) |>
summarise(
across(c(LandedCatch, MSFLandedCatch), sum), #sum over timesteps
fram_lnd_yr_fsh = LandedCatch + MSFLandedCatch,
.groups = "drop") |>
left_join(
samp_catch_coef_vals |> filter(coef == 0),
by = c("FisheryID", "run_year")
) |>
mutate(fram_lnd_yr_fsh = if_else(!is.na(coef), coef * fram_lnd_yr_fsh, fram_lnd_yr_fsh)) |>
group_by(run_year, StockID, StockLongName) |>
mutate(
LandedCatch = NULL, MSFLandedCatch = NULL,
fram_lnd_yr_tot = sum(fram_lnd_yr_fsh)
) |>
ungroup()
,
fram$escp |>
rename(fram_escp = escp) |>
mutate(run_year = as.integer(RunYear), RunYear = NULL) |>
group_by(run_year, StockID) |>
summarise(across(fram_escp, sum), .groups = "drop")
,
by = c("run_year", "StockID")
) |>
mutate(
fram_abnd = fram_lnd_yr_tot + fram_escp,
fram_er_fsh = fram_lnd_yr_fsh / fram_abnd,
fram_er_tot = fram_lnd_yr_tot / fram_abnd
) |>
select(run_year, everything()) |>
filter(between(run_year, 2010, 2019))
# #large majority of non-escp NA fisheries are 91 from AK
# rmis_rr |>
# drop_na(estimated_number, StockID) |>
# filter(is.na(f_type)) |> count(fishery, rlsp)
er_rmis <- full_join(
#analogous to FRAM mortality table
rmis_rr |>
drop_na(estimated_number, StockID, FisheryID) |>
mutate(
FisheryID = if_else(FisheryID %in% fishery_ids_paired, FisheryID+1, as.double(FisheryID)),
FisheryName = if_else(FisheryID %in% c(fishery_ids_paired, fishery_ids_paired+1),
str_sub(FisheryName, 1,8), FisheryName),
FisheryID = if_else(FisheryID == 98, 97, as.double(FisheryID)),
FisheryName = if_else(FisheryID == 97, "A7BCDNet", FisheryName)
) |>
filter(
age == 3, !between(FisheryID, 24, 32),
between(run_year, min(er_fram$run_year), max(er_fram$run_year)),
StockID %in% stock_ids,
FisheryID %in% fishery_ids
) |> #count(sample_type)
group_by(run_year, StockID, f_type, FisheryID, FisheryName) |>
summarise(rmis_est_num_yr_fsh = sum(estimated_number), .groups = "drop") |>
left_join(
samp_catch_coef_vals,
by = c("FisheryID", "run_year")
) |>
mutate(rmis_est_num_yr_fsh = if_else(!is.na(coef), rmis_est_num_yr_fsh * coef, rmis_est_num_yr_fsh)) |>
group_by(run_year, StockID) |>
mutate(rmis_est_num_yr_tot = sum(rmis_est_num_yr_fsh)) |>
ungroup()
,
#analogous to FRAM escapement table
rmis_rr |>
drop_na(estimated_number, StockID) |>
left_join(
samp_catch_coef_vals |> filter(between(FisheryID, 24, 32)),
by = c("FisheryID", "run_year")
) |>
mutate(estimated_number = if_else(!is.na(coef), estimated_number * coef, estimated_number)) |>
filter(
age == 3, (f_type == "escp" | between(FisheryID, 24, 32)),
between(run_year, min(er_fram$run_year), max(er_fram$run_year)),
StockID %in% stock_ids
) |> #count(f_type, FisheryID)
group_by(run_year, StockID) |>
summarise(rmis_escp = sum(estimated_number), .groups = "drop")
,
by = c("run_year", "StockID")
) |>
mutate(
run_year = as.integer(run_year),
rmis_abnd = rmis_est_num_yr_tot + rmis_escp,
rmis_er_fsh = rmis_est_num_yr_fsh / rmis_abnd,
rmis_er_tot = rmis_est_num_yr_tot / rmis_abnd
)
er_fram_rmis <- full_join(
er_fram |> select(-StockLongName, -FisheryName, -coef),
er_rmis |> select(-FisheryName, -coef),
by = c("run_year", "StockID", "FisheryID")
) |>
left_join(fram$mort |> distinct(StockID, StockLongName), by = "StockID") |>
left_join(fram$mort |> distinct(FisheryID, FisheryName), by = "FisheryID") |>
mutate(
fidnm = paste(FisheryID, FisheryName, sep = ":") |> fct_reorder(.x = FisheryID, .fun = min),
sidnm = paste(StockID, StockLongName, sep = ":") |> fct_reorder(.x = StockID, .fun = min),
d_yr_fsh = fram_lnd_yr_fsh - rmis_est_num_yr_fsh,
d_yr_tot = fram_lnd_yr_tot - rmis_est_num_yr_tot,
d_escp_fram_rmis = fram_escp - rmis_escp,
d_er_fsh = fram_er_fsh - rmis_er_fsh,
d_er_tot = fram_er_tot - rmis_er_tot
) |>
filter(between(run_year, 2010, 2019))
# #a trace smattering of NA fisheries when mapped stock-year escapement recoveries without fishery recoveries
# #prevents comparison even though FRAM has both mort and escp
# er_fram_rmis |> filter(is.na(FisheryID))
# er_rmis |> filter(run_year==2014, StockID==194) #only escapement
# rmis_rr |> filter(run_year==2014, StockID==194) |> count(f_type) #confirming only escapement
# fram$mort |> filter(RunYear==2014, StockID==194)
# fram$escp |> filter(RunYear==2014, StockID==194)
# er_fram_rmis |> filter(run_year==2014, StockID==194)
```
# Results
```{r export_xlsx}
list(
er_fram_rmis = er_fram_rmis
) |>
write.csv(file = paste0("results/er_fram_rmis_",Sys.Date(),".csv"))
# writexl::write_xlsx("T:/DFW-Salmon Mgmt Modeling Team - General/Southern Fund Projects/Coho FRAM MSM CWT analysis/er_fram_rmis_all_hat_stocks_with2020.xlsx")
# writexl::write_xlsx("T:/DFW-Salmon Mgmt Modeling Team - General/Southern Fund Projects/Coho FRAM MSM CWT analysis/er_fram_rmis_CowlitzTest.xlsx")
```
The FRAM and RMIS pseudo-ERs can be compared from "stock-centric" and "fishery-centric" perspectives.
Differences across individual fisheries for single stocks are presented first, followed by differences organized by fishery, across stocks.
```{r gg_stk_function}
gg_stk <- function(sid = 20, min_fram_landed = 10){
tot <- filter(er_fram_rmis, StockID == sid) |>
drop_na(d_er_tot) |>
mutate(run_year = as.character(run_year)) |>
distinct(sidnm, run_year, FRAM = fram_er_tot, RMIS = rmis_er_tot) |>
pivot_longer(-c(sidnm, run_year), names_to = "var", values_to = "val")
tot_d_yr <- filter(er_fram_rmis, StockID == sid) |>
drop_na(d_er_tot) |>
distinct(sidnm, run_year, d_er_tot) |>
pluck("d_er_tot") |> abs()
tot_d_yr = map_chr(
c(0.01, 0.05, 0.1),
~paste0("d_yr<",.x,": ", sum(tot_d_yr < .x))
) |> paste(collapse = "; ")
fsh <- bind_rows(
filter(er_fram_rmis, StockID == sid, fram_lnd_yr_fsh >= min_fram_landed) |>
mutate(run_year = as.character(run_year)),
#across years, end of fishery row
filter(er_fram_rmis, StockID == sid, fram_lnd_yr_fsh >= min_fram_landed) |>
mutate(
d_er_fsh = if_else(is.na(rmis_er_fsh), fram_er_fsh, d_er_fsh),
d_er_fsh = if_else(is.na(fram_er_fsh), -1*rmis_er_fsh, d_er_fsh)
) |>
group_by(sidnm, fidnm) |>
summarise(
run_year = "mean",
d_er_fsh = mean(d_er_fsh, na.rm=T), .groups = "drop"),
#across fisheries, bottom of year col
filter(er_fram_rmis, StockID == sid, fram_lnd_yr_fsh >= min_fram_landed) |>
mutate(
d_er_fsh = if_else(is.na(rmis_er_fsh), fram_er_fsh, d_er_fsh),
d_er_fsh = if_else(is.na(fram_er_fsh), -1*rmis_er_fsh, d_er_fsh)
) |>
mutate(run_year = as.character(run_year)) |>
group_by(sidnm, run_year) |>
summarise(
fidnm = "0: annual mean",
d_er_fsh = mean(d_er_fsh, na.rm=T), .groups = "drop")
)
fsh <- bind_rows(
fsh,
fsh |> filter(fidnm == "0: annual mean") |>
group_by(sidnm, fidnm) |>
summarise(run_year = "mean", d_er_fsh = mean(d_er_fsh, na.rm=T), .groups = "drop")
)
#fishery ranks as all-years summed percentages: sum per fishery / sum all fisheries
#meant to stabilize year-to-year fluctuations in sampling etc.
rnk <- filter(er_fram_rmis, StockID == sid, fram_lnd_yr_fsh > 0) |>
group_by(sidnm, fidnm) |>
summarise(
fram_fsh = sum(fram_lnd_yr_fsh, na.rm = T),
rmis_fsh = sum(rmis_est_num_yr_fsh, na.rm=T),
.groups = "drop") |>
group_by(sidnm) |>
mutate(
fram_tot = sum(fram_fsh),
rmis_tot = sum(rmis_fsh),
fram_fsh_tot = fram_fsh / fram_tot,
rmis_fsh_tot = rmis_fsh / rmis_tot,
across(ends_with("_fsh_tot"), list(rnk = ~min_rank(-.))),
d_rnk = fram_fsh_tot_rnk - rmis_fsh_tot_rnk,
d_rnk_color = case_when(
fram_fsh_tot_rnk == rmis_fsh_tot_rnk ~ "darkgreen", #d_rnk == 0
fram_fsh_tot_rnk < rmis_fsh_tot_rnk ~ "orange", #d_rnk < 0
fram_fsh_tot_rnk > rmis_fsh_tot_rnk ~ "purple" #d_rnk > 0
),
d_rnk_color = if_else(round(fram_fsh_tot, 3) == 0 & rmis_fsh_tot == 0, "grey50", d_rnk_color)
) |>
ungroup() |>
arrange(sidnm, fram_fsh_tot_rnk) |>
mutate(across(c(fram_fsh_tot, rmis_fsh_tot), ~round(.,3))) |>
select(sidnm, fidnm, contains("fsh_tot"), contains("d_rnk")) |>
unite("FRAM", starts_with("fram_")) |>
unite("RMIS", starts_with("rmis_")) |>
pivot_longer(c(FRAM, RMIS), names_to = "var", values_to = "val") |>
separate(val, into = c("pct", "rnk"), sep = "_") |>
mutate(
pct = as.numeric(pct),
rnk = factor(as.numeric(rnk))
)
snm <- tot$sidnm[1]
gg_tot_bars <- bind_rows(
tot,
tot |> group_by(sidnm, var) |> summarise(run_year = "mean", across(val, mean), .groups = "drop")
) |>
ggplot(aes(run_year, val, fill=var)) +
geom_col(position = position_dodge()) +
geom_text(aes(label = if_else(is.na(val), "", paste0(round(100*val, digits = 1), "%"))),
position = position_dodge2(width = 1, preserve = "single"),
size = 2, vjust = -0.5) +
scale_fill_grey() +
scale_x_discrete("", guide = guide_axis(n.dodge = 2)) +
scale_y_continuous("", labels = scales::percent) +
labs(
title = "Annual total pseudo-ER, FRAM & RMIS",
subtitle = tot_d_yr) +
theme(legend.position = "right")
gg_fsh <- fsh |>
mutate(
fidnm = factor(fidnm, levels = c(levels(er_fram_rmis$fidnm), "0: annual mean")),
shp = case_when(
d_er_fsh > 0 ~ "FRAM > RMIS",
d_er_fsh < 0 ~ "FRAM < RMIS",
d_er_fsh == 0 ~ "FRAM = RMIS",
is.na(rmis_er_fsh) ~ "FRAM-only",
is.na(fram_er_fsh) ~ "RMIS-only"
),
#sze = if_else(!is.na(d_er_fsh), abs(d_er_fsh), 0)
sze = if_else(!is.na(d_er_fsh), abs(d_er_fsh), fram_er_fsh)
) |>
ggplot(aes(run_year, fidnm)) +
geom_point(aes(shape = shp), size = 1) +
geom_point(aes(shape = shp, size = sze, fill = d_er_fsh)) +
# geom_text(aes(label = if_else(is.na(d_er_fsh), "", paste0(round(100*d_er_fsh, digits = 0), "%"))), vjust = -0.5, size = 3) +
geom_text(aes(label = if_else(is.na(d_er_fsh), "", paste0(round(100*d_er_fsh, digits = 0), "%"))), hjust = -0.5, size = 3) +
scale_shape_manual(name = "", values = c("FRAM > RMIS" = 24, "FRAM < RMIS" = 25, "FRAM = RMIS" = 22, "FRAM-only" = 20, "RMIS-only" = 3)) +
scale_size("ER diff. abs.", range = c(1.5, 5)) +
scale_fill_fermenter(type = "div", palette = "PuOr", breaks = c(-0.1, -0.05, 0, 0.05, 0.1), limits = c(-.2, .2)) +
# expand_limits(y = c(-0.5, length(levels(factor(fsh$fidnm))) + 1.5)) +
geom_hline(yintercept = length(levels(factor(fsh$fidnm))) - 0.5) +
guides(
fill = guide_colorbar(title="ER difference"),
x = guide_axis("Run Year", n.dodge = 2),
y = guide_axis("")) +
facet_wrap(~sidnm, ncol = 2, scales = "free_y") +
labs(
title = "Per-year per-fishery pseudo-ER difference",
subtitle = paste("FRAM - RMIS, min. annual FRAM landed >=", min_fram_landed, "coho")
)
gg_rnk_col <- rnk |>
ggplot(aes(fct_reorder(fidnm, pct, max), pct, group = var, fill = var)) +
geom_col(position = position_dodge(width = 0.3), alpha = 0.5) +
coord_flip() +
scale_x_discrete("") + scale_y_continuous("", labels = scales::percent) +
scale_fill_manual(values = c(FRAM = "orange", RMIS = "purple")) + #scale_fill_grey() +
theme(legend.position = "bottom")
gg_rnk_ladder <- rnk |>
ggplot(aes(var, rnk, color = d_rnk_color, alpha = pct, group = fidnm)) +
geom_point(aes(size = pct), show.legend = F) +
geom_line(show.legend = F) +
geom_text(
data = filter(rnk, var == "FRAM"),
aes(label = paste(fidnm, scales::percent(pct, accuracy = 0.1), sep = " ")),
size= 2.2, hjust = 1, vjust = -0.2, show.legend = F) +
geom_text(
data = filter(rnk, var == "RMIS"),
aes(label = paste(fidnm, scales::percent(pct, accuracy = 0.1), sep = " ")),
size= 2.2, hjust = -0.1, vjust = -0.2, show.legend = F) +
scale_x_discrete("") +
scale_y_discrete("Rank", limits = rev) +
scale_size(range = c(0.2, 4)) +
scale_color_manual(values = c(darkgreen = "darkgreen", orange = "orange", purple = "purple")) +
scale_alpha_continuous(range = c(0.4, 1)) #+labs(title = "Proportional ranks, 2010-2019")
return(list(
pseudo_er = gg_tot_bars + gg_fsh +
plot_layout(ncol = 1, heights = c(1/4, 3/4)) +
plot_annotation(title = snm),
rel_rank = gg_rnk_col + gg_rnk_ladder +
plot_layout(ncol = 2) +
plot_annotation(title = paste(snm, "Proportional ranking, 2010-2019"))
))
}
#gg_stk()
```
## Puget Sound
### Skagit
- **Total across fisheries**
- pseudo-ER differences less than 0.01, 0.05 and 0.1 in 2, 5 and 7 years respectively
- FRAM value larger in 2013 and 2014, but otherwise RMIS value larger
- RMIS escapement may be low in some years; in 2019 RMIS escp < fisheries, while FRAM escp ~2x fisheries
- **Fishery-specific**
- annually varied +/- differences for most fisheries
- contrasting differences did not fully offset in PS sport: lower FRAM for A10, A5, A9 and A8-2 not compensated by A8-1 and A7
- **Rank agreement**
- both FRAM and current RMIS associate the greatest impacts to A5, and FRAM assigns third-most impacts to A9, the second ranked RMIS fishery
- RMIS indicates a considerably higher proportion of impact in A10, A8-2 and A2 than in FRAM
- RMIS indicates a lower proportion of impact in 4/4B Treaty troll, A6, A8-1, and 8A net than in FRAM
- Counter misalignment in 8-1 & 8-2 may be due to errors in datasets and/or mapping
```{r}
g <- gg_stk(20)
g$pseudo_er; ggsave(file.path("results","f_20_Skagit.png"), width = 9, height = 11)
g$rel_rank; ggsave(file.path("results","f_20_Skagit_rel_rank.png"), width = 9, height = 10)
```
```{r}
er_fram_rmis |>
drop_na(rmis_est_num_yr_tot, fram_lnd_yr_tot) |>
filter(StockID==20, between(run_year, 2017, 2019)) |>
distinct(run_year, sidnm, fram_lnd_yr_tot, fram_escp, rmis_est_num_yr_tot, rmis_escp)
```
### Tulalip
- **Total across fisheries**
- pseudo-ER differences less than 0.1, 0.05 and 0.01 in 1, 5 and 7 years respectively
- FRAM value larger in 2016 only
- RMIS escapement may be low in some years; 2019 escp. missing entirely preventing ER calc (note no 2019 total column)
- **Fishery-specific**
- most fisheries show negative differences where comparison possible, suggesting missing escapement
- contrasting Area 8D vs 8A net differences may be related to errors in dataset or mapping
- **Rank agreement**
- both FRAM and current RMIS associate the greatest impacts to 8D net (first) and 8A net (second)
- both have A5 and A9 sport as third or fourth largest, and 8-2 as fifth; other fisheries are relatively minor in both
```{r}
g <- gg_stk(34)
g$pseudo_er; ggsave(file.path("results","f_34_Tulalip.png"), width = 9, height = 11)
g$rel_rank; ggsave(file.path("results","f_34_Tulalip_rel_rank.png"), width = 9, height = 10)
```
```{r}
er_fram_rmis |>
drop_na(rmis_est_num_yr_tot, fram_lnd_yr_tot) |>
filter(StockID==34, between(run_year, 2017, 2019)) |>
distinct(run_year, sidnm, fram_lnd_yr_tot, fram_escp, rmis_est_num_yr_tot, rmis_escp)
```
### Quilcene
- **Total across fisheries**
- pseudo-ER differences less than 0.1, 0.05 and 0.01 in 0, 2 and 4 years respectively
- FRAM value consistently larger; RMIS larger in 2010 only
- Fishery recoveries may be missing in some years; for example
- in 2019 RMIS escp is ~3x fisheries while FRAM is ~1:1
- in 2012 FRAM fisheries ~3x escp while RMIS fisheries < escp
- **Fishery-specific**
- possibly mapping or other dataset errors affecting Hood Canal net fisheries 12A, 9A and 12/12B (see rank comment)
- possible mis-assignments:
- sport: FRAM impacts higher in A5, A10, and A6, while A9, A12, A4 and A2 lower than RMIS
- **Rank agreement**
- both FRAM and current RMIS associate the greatest impacts to 12A net
- 9/9A net second for RMIS but 5th for FRAM, while 12/12B is third for FRAM but minor for RMIS
```{r}
g <- gg_stk(48)
g$pseudo_er; ggsave(file.path("results","f_48_Quilcene.png"), width = 9, height = 11)
g$rel_rank; ggsave(file.path("results","f_48_Quilcene_rel_rank.png"), width = 9, height = 10)
```
```{r}
er_fram_rmis |>
drop_na(rmis_est_num_yr_tot, fram_lnd_yr_tot) |>
filter(StockID==48, between(run_year, 2010, 2019)) |>
distinct(run_year, sidnm, fram_lnd_yr_tot, fram_escp, rmis_est_num_yr_tot, rmis_escp)
```
### George Adams
- **Total across fisheries**
- no years close; RMIS likely missing fishery recoveries and/or mapping error
- **Fishery-specific**
- many positive differences may be related to missing fishery recoveries and/or possibly mapping errors (e.g., among Hood Canal net fisheries)
- **Rank agreement**
- both FRAM and current RMIS associate the greatest impacts to 12CD net and large portions to A5, A9 and A10 sport
- A12 sport missing from RMIS in most years hinders comparison
- Area 12/12B net (FRAM higher) and Area 9/9A Net (RMIS higher) countering differences suggests mapping or reporting error
```{r}
g <- gg_stk(58)
g$pseudo_er; ggsave(file.path("results","f_58_GeorgeAdams.png"), width = 9, height = 11)
g$rel_rank; ggsave(file.path("results","f_58_GeorgeAdams_rel_rank.png"), width = 9, height = 10)
```
```{r}
er_fram_rmis |>
drop_na(rmis_est_num_yr_tot, fram_lnd_yr_tot) |>
filter(StockID==58, between(run_year, 2017, 2019)) |>
distinct(run_year, sidnm, fram_lnd_yr_tot, fram_escp, rmis_est_num_yr_tot, rmis_escp)
```
### Nisqually
- **Total across fisheries**
- pseudo-ER differences less than 0.01, 0.05 and 0.1 in 0, 4 and 7 years respectively
- FRAM value larger in 2012-4 and 2017-8; RMIS larger otherwise; no dominant pattern
- **Fishery-specific**