Skip to content

Commit

Permalink
put in some mods to vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
jimianelli committed Aug 6, 2024
1 parent 59b000c commit 0a2f219
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
8 changes: 4 additions & 4 deletions examples/goa_flathead/Input_Log.rep
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ nsims
styr
2022
bzero_in
3.00804e-314
3.01007e-314
phizero_in
-2.62559e-306
-6.42849e-39
alpha_in
2.16404e-314
2.16201e-314
sigmar_in
0
rho_in
3.00804e-314
3.01007e-314
nyrs_catch_in
5
nspp
Expand Down
39 changes: 32 additions & 7 deletions vignettes/00-spm-example.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ vignette: >
lightbox: true
output:
# rmarkdown::html_vignette
bookdown::html_document2:
rmarkdown::html_document:
code_folding: hide
fig_caption: yes
number_sections: yes
Expand Down Expand Up @@ -59,27 +59,52 @@ This vignette demonstrates how to use these functions to run the SPM model and a
The following case studies have been applied.

## Atka mackerel


```{r atka,eval=TRUE}
df <- runSPM(here::here("examples","atka"),run=FALSE)
#|
bdf <- runSPM(here::here("examples","atka"),run=FALSE)
inp <- spmR::dat2list(here::here("examples","atka","spm.dat"))
names(inp)
(inp$alt4_spr)
#Get the data file:
dat<-dat2list(here::here("examples","atka",inp$datafile))
names(dat)
dat$avgF5yr
df <- readr::read_csv(here::here("examples","atka","spm_summary.csv"))
names(df)
df$variable
#setwd("spmR")
plotSPM(df)
```

We'll start with a one-year fixed catch model for Atka mackerel, find the ABC for
The most recent assessment was in 2022, so in that year, the ABC for the Tier 3 model was `r df |> filter(Year==2022,variable=="C_mean",Alt==1) |> select(value) |> prettyNum(big.mark=",")` t.


## BSAI northern rock sole
```{r bsaiNRS,eval=TRUE}
df <- runSPM(here::here("examples","BSAI NRS"),run=FALSE)

```{r bsaiNRS}
#| echo: TRUE
#| fig.width: 8
#| fig.height: 6
bdf <- runSPM(here::here("examples","BSAI NRS"),run=FALSE)
df <- readr::read_csv(here::here("examples","BSAI NRS","spm_summary.csv"))
inp <- spmR::dat2list(here::here("examples","BSAI NRS","spm.dat"))
fc <- tibble(Year=inp$fixed_catch[,1],mean=inp$fixed_catch[,2],'C')
fc <- data.frame(Year=inp$fixed_catch[,1], mean=inp$fixed_catch[,2], type='C')# |>
names(fc) <- c("Year", "mean", "type")
fc <- fc |> mutate(ub=mean,lb=mean, Alt=as.factor(1))
p1<-plotSPM(df)
fc <- fc |> expand_grid(Alt=c(1,3,5,7)) |> mutate(Alt=as.factor(Alt), ub=mean,lb=mean)
fc
p1$data
p1 + geom_point(data=fc,aes(x=Year,y=mean))
#p1$data
```

```{r}
#| echo: TRUE
```

## EBS pollock
```{r ebswp,eval=TRUE}
bdf <- runSPM(here::here("examples","ebspollock"),run=FALSE)
Expand Down

0 comments on commit 0a2f219

Please sign in to comment.