@@ -1084,19 +1084,24 @@ exclude:true
1084
1084
---
1085
1085
# Challenge 2 - Solution ![ : cube ] ( )
1086
1086
1087
- ``` {r,eval=TRUE}
1087
+ ** 1.** Create 2 new models, with ` x3 ` as a linear and smoothed term.
1088
+
1089
+ ``` {r, eval=TRUE}
1088
1090
# Add Latitude as a linear term
1089
1091
three_term_model <- gam(Sources ~
1090
1092
Season + s(SampleDepth) + s(RelativeDepth) +
1091
- Latitude,
1093
+ Latitude, #<<
1092
1094
data = isit, method = "REML")
1093
1095
three_term_summary <- summary(three_term_model)
1094
1096
1095
1097
# Add Latitude as a smooth term
1096
1098
three_smooth_model <- gam(Sources ~
1097
1099
Season + s(SampleDepth) + s(RelativeDepth) +
1098
- s(Latitude),
1100
+ s(Latitude), #<<
1099
1101
data = isit, method = "REML")
1102
+ ```
1103
+
1104
+ ``` {r, eval=TRUE}
1100
1105
three_smooth_summary <- summary(three_smooth_model)
1101
1106
```
1102
1107
@@ -1118,18 +1123,24 @@ __2.__ Is `Latitude` an important term to include? Does `Latitude` have a linear
1118
1123
1119
1124
Let us begin by plotting the the 4 effects that are now included in each model.
1120
1125
1121
- ---
1122
- # Challenge 2 - Solution ![ : cube ] ( )
1126
+ .pull-left4[
1123
1127
1124
1128
``` {r, eval = FALSE}
1125
1129
par(mfrow = c(2,2))
1126
- plot(three_smooth_model, all.terms = TRUE)
1130
+ plot(three_smooth_model,
1131
+ all.terms = TRUE)
1127
1132
```
1133
+ ]
1128
1134
1129
- ``` {r, fig.width = 8, fig.height = 7, echo = FALSE}
1135
+
1136
+ .pull-right4[
1137
+
1138
+ ``` {r, fig.width = 7, fig.height = 6.5, echo = FALSE}
1130
1139
plot(three_smooth_model, page = 1, all.terms = TRUE)
1131
1140
```
1132
1141
1142
+ ]
1143
+
1133
1144
---
1134
1145
# Challenge 2 - Solution ![ : cube ] ( )
1135
1146
0 commit comments