-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path06_ModelOutputs.qmd
More file actions
145 lines (103 loc) · 3.54 KB
/
06_ModelOutputs.qmd
File metadata and controls
145 lines (103 loc) · 3.54 KB
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
---
title: "Model Outputs"
output:
html_document:
theme: journal
---
```{css, echo=F}
pre {
overflow-x: scroll
}
pre code {
white-space: pre;
}
```
```{r setup, include=FALSE}
knitr::opts_knit$set(root.dir=here::here())
knitr::opts_chunk$set(warning=F, message=F, eval=F)
```
# Main Objectives
- Understand the components of a jjm output object
- Be able to make individual plots using the `jjmR` package
- Be able to make custom plots using jjm model outputs
# Output Files
Once you've successfully run the assessment model for `h1` and `h2`, these are the files you should have (assuming you selected the `pdf=TRUE` option in the `runit()` function).
```{r}
- h1_1.00_1_R.rep # Named report file that is read directly as a list into R
- h1_1.00.cor # Parameter correlation matrix
- h1_1.00.par # Best estimates of the parameters within the model
- h1_1.00.pdf # PDF of plots
- h1_1.00.rep # Predicted quantities
- h1_1.00.std # Estimated parameter values and standard deviations
- h1_1.00.yld # Profile of stock, yield, and recruitment over F
---
- h2_1.00_1_R.rep
- h2_1.00_2_R.rep # Note second R.rep file for the second stock
- h2_1.00.cor
- h2_1.00.par
- h2_1.00.pdf
- h2_1.00.rep
- h2_1.00.std
- h2_1.00.yld
```
The `readJJM()` function only requires a subset of these files to work:
```
- R.rep
- .par
- .rep
- .std
- .yld
```
# Reading the Output into R
- We have already most of this code for this in the Input Files doc.
```{r, eval=F}
library(jjmR)
h1.mod <- readJJM("h1_1.00", path = "config", input = "input")
h2.mod <- readJJM("h2_1.00",path = "config", input = "input")
names(h1.mod[[1]]$output[[1]])
```
- These names correspond to values in the TPL file, so you can search that if you get stuck.
- JC Quiroz wrote a script that pulls out quantities to make the tables in the technical annex (`jjm/assessment/R/constructor_input_tables.R`)
## Things to Note
- One of the most important tables (in my opinion) in the output object is `msy_mt`. It contains a matrix with the time series of derived quantities and estimated reference points.
- Note to self: Set colnames in jjmR output function for this table
```{r, eval=F}
# // Yr Fspr 1-Fspr F/Fmsy Fmsy F Fsprmsy MSY MSYL Bmsy Bzero SSB B/Bmsy
h1.mod[[1]]$output[[1]]$msy_mt
```
- `FW_*` denotes the Francis Weights for each fleet.
```{r}
$FW_N_Chile
0.915323
$FW_SC_Chile_PS
0.910934
$FW_Offshore_Trawl
0.681234
$FW_Chile_AcousCS
0.92536
$FW_Chile_AcousN
0.91344
$FW_DEPM
1.07482
```
- `SSB_fut_1` to `SSB_fut_5` denotes future spawning stock biomass projected under five different fishing scenarios (more on this later).
# Making Plots
- The PDF generated by `runit()` generally contains all the plots
- The `diagnostics` function generates plots from the jjm object.
```{r, eval=F}
# Setting plot=T will create the entire suite of plots
h1.diag <- diagnostics(h1.mod, plot=F)
h2.diag <- diagnostics(h2.mod, plot=F)
#You can then plot individual plots by changing the `var` variable
plot(h1.diag, var = "fishedUnfishedBiomass")
plot(h2.diag, var = "summarySheet")
```
- You can find the different `var` options deep within the jjmR [code](https://github.com/SPRFMO/jjmr/blob/master/R/jjm.diag-internal.R)
- Might be worth documenting separately?
- Examples can also be found in `jjm/assessment/R/AnnexPlots.R`
# Exercises
- Pick two plots from the technical annex and make them from scratch
- Find the variables using `names(h1.mod[[1]]$output[[1]])`
- Do this for `h1` and `h2`
- Bonus if you can graph them creatively
- Think of suggestions for other diagnostic plots we can use?