Skip to content

Instantly share code, notes, and snippets.

@JonGretar
Last active February 27, 2022 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonGretar/b619ab083002b0119f70e23ecd8bd90a to your computer and use it in GitHub Desktop.
Save JonGretar/b619ab083002b0119f70e23ecd8bd90a to your computer and use it in GitHub Desktop.
## 4. Visualize $\theta$ (probability to observe white fish larvae) as a function of ICELAST09 when DISSAND is set to its mean value and in both cases when BOTTOMCOV=0 and BOTTOMCOV=1 (range from minimum to maximum value of ICELAST09 in the data).
```{r}
range(fishdata$ICELAST09)
```
```{r}
predict_with_bottomcoverage <- tibble(
ICELAST09 = seq(7, 21, 0.1),
DIS_SAND = mean(fishdata$DIS_SAND),
BOTTOMCOV = as.factor(1)
)
predict_with_bottomcoverage$expected <-
predict(model1, newdata=predict_with_bottomcoverage, type="response")
predict_without_bottomcoverage <- tibble(
ICELAST09 = seq(7, 21, 0.1),
DIS_SAND = mean(fishdata$DIS_SAND),
BOTTOMCOV = as.factor(0)
)
predict_without_bottomcoverage$expected <-
predict(model1, newdata=predict_without_bottomcoverage, type="response")
propability = bind_rows(
predict_with_bottomcoverage,
predict_without_bottomcoverage
)
propability |>
ggplot(aes(x=ICELAST09, y=expected, color=BOTTOMCOV)) +
geom_line() +
labs(
x = "Ice Last",
y = "Propability",
color = "Bottom Coverage"
) +
theme_minimal() +
theme(legend.position = "top")
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment