Skip to content

Commit 518e716

Browse files
Merge pull request #25 from QCBSRworkshops/challenge-2-corrections-fr
Minor adjustments to Challenge 2 in the FR presentation
2 parents 0a95ca1 + bd3cc61 commit 518e716

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

pres-fr/workshop08-pres-fr.Rmd

+34-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ knitr::opts_chunk$set(
2727
fig.retina = 3,
2828
fig.align = 'center'
2929
)
30+
31+
hook_source <- knitr::knit_hooks$get('source')
32+
knitr::knit_hooks$set(source = function(x, options) {
33+
x <- stringr::str_replace(x, "^[[:blank:]]?([^*].+?)[[:blank:]]*#<<[[:blank:]]*$", "*\\1")
34+
hook_source(x, options)
35+
})
36+
3037
options(repos=structure(c(CRAN="http://cran.r-project.org")))
3138
```
3239

@@ -1081,19 +1088,25 @@ exclude:true
10811088
---
10821089
# Défi 2 - Solution ![:cube]()
10831090

1091+
**1.** Créez deux nouveaux modèles: Ajoutez la variable `Latitude` à `two_smooth_model`, premièrement comme paramètre linéaire, et ensuite comme fonction non-linéaire.
1092+
10841093
```{r, eval=TRUE}
10851094
# Ajouter Latitude comme terme linéaire
10861095
three_term_model <- gam(Sources ~
10871096
Season + s(SampleDepth) + s(RelativeDepth) +
1088-
Latitude,
1097+
Latitude, #<<
10891098
data = isit, method = "REML")
1099+
10901100
three_term_summary <- summary(three_term_model)
1101+
```
10911102

1103+
```{r, eval=TRUE}
10921104
# Ajouter Latitude comme terme non-linéaire
10931105
three_smooth_model <- gam(Sources ~
10941106
Season + s(SampleDepth) + s(RelativeDepth) +
1095-
s(Latitude),
1107+
s(Latitude), #<<
10961108
data = isit, method = "REML")
1109+
10971110
three_smooth_summary <- summary(three_smooth_model)
10981111
```
10991112

@@ -1104,6 +1117,25 @@ __2.__ Est-ce que `Latitude` est un terme important à inclure dans le modèle?
11041117

11051118
Commençons par visualiser les 4 effets qui sont maintenant inclus dans chaque modèle.
11061119

1120+
.pull-left4[
1121+
1122+
```{r, eval = FALSE}
1123+
par(mfrow = c(2,2))
1124+
1125+
plot(three_smooth_model,
1126+
all.terms = TRUE)
1127+
```
1128+
]
1129+
1130+
1131+
.pull-right4[
1132+
1133+
```{r, fig.width = 7, fig.height = 6.5, echo = FALSE}
1134+
plot(three_smooth_model, page = 1, all.terms = TRUE)
1135+
```
1136+
1137+
]
1138+
11071139
---
11081140
exclude:true
11091141
# Défi 2 - Solution ![:cube]()

0 commit comments

Comments
 (0)