@@ -1084,19 +1084,24 @@ exclude:true
10841084---
10851085# Challenge 2 - Solution ![ : cube ] ( )
10861086
1087- ``` {r,eval=TRUE}
1087+ ** 1.** Create 2 new models, with ` x3 ` as a linear and smoothed term.
1088+
1089+ ``` {r, eval=TRUE}
10881090# Add Latitude as a linear term
10891091three_term_model <- gam(Sources ~
10901092 Season + s(SampleDepth) + s(RelativeDepth) +
1091- Latitude,
1093+ Latitude, #<<
10921094 data = isit, method = "REML")
10931095three_term_summary <- summary(three_term_model)
10941096
10951097# Add Latitude as a smooth term
10961098three_smooth_model <- gam(Sources ~
10971099 Season + s(SampleDepth) + s(RelativeDepth) +
1098- s(Latitude),
1100+ s(Latitude), #<<
10991101 data = isit, method = "REML")
1102+ ```
1103+
1104+ ``` {r, eval=TRUE}
11001105three_smooth_summary <- summary(three_smooth_model)
11011106```
11021107
@@ -1118,18 +1123,24 @@ __2.__ Is `Latitude` an important term to include? Does `Latitude` have a linear
11181123
11191124Let us begin by plotting the the 4 effects that are now included in each model.
11201125
1121- ---
1122- # Challenge 2 - Solution ![ : cube ] ( )
1126+ .pull-left4[
11231127
11241128``` {r, eval = FALSE}
11251129par(mfrow = c(2,2))
1126- plot(three_smooth_model, all.terms = TRUE)
1130+ plot(three_smooth_model,
1131+ all.terms = TRUE)
11271132```
1133+ ]
11281134
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}
11301139plot(three_smooth_model, page = 1, all.terms = TRUE)
11311140```
11321141
1142+ ]
1143+
11331144---
11341145# Challenge 2 - Solution ![ : cube ] ( )
11351146
0 commit comments