@@ -145,30 +145,30 @@ predicted <- predict(fit.clr, X_predict, jitter=1)
145
145
Now I am going to create a visual that shows the observed data in CLR coordinates
146
146
(to do that I will need to add a pseudo-count) along with the smoothed estimates.
147
147
``` {r fig.height=5, fig.width=7}
148
- # family_names <- as(mallard_family$tax_table$Family, "vector")
149
- # Y_clr_tidy <- clr_array(Y+0.65, parts = 1) %>%
150
- # gather_array(mean, coord, sample) %>%
151
- # mutate(time = X[1,sample],
152
- # coord = paste0("CLR(", family_names[coord],")"))
153
- #
154
- # predicted_tidy <- gather_array(predicted, val, coord, sample, iter) %>%
155
- # mutate(time = X_predict[1,sample]) %>%
156
- # filter(!is.na(val)) %>%
157
- # group_by(time, coord) %>%
158
- # summarise_posterior(val, na.rm=TRUE) %>%
159
- # ungroup() %>%
160
- # mutate(coord = paste0("CLR(", family_names[coord],")"))
161
- #
162
- # ggplot(predicted_tidy, aes(x = time, y=mean)) +
163
- # geom_ribbon(aes(ymin=p2.5, ymax=p97.5), fill="darkgrey", alpha=0.5) +
164
- # geom_ribbon(aes(ymin=p25, ymax=p75), fill="darkgrey", alpha=0.9)+
165
- # geom_line(color="blue") +
166
- # geom_point(data = Y_clr_tidy, alpha=0.5) +
167
- # facet_wrap(~coord, scales="free_y") +
168
- # theme_minimal()+
169
- # theme(axis.title.y = element_blank(),
170
- # axis.title.x = element_blank(),
171
- # axis.text.x = element_text(angle=45))
148
+ family_names <- as(mallard_family$tax_table$Family, "vector")
149
+ Y_clr_tidy <- clr_array(Y+0.65, parts = 1) %>%
150
+ gather_array(mean, coord, sample) %>%
151
+ mutate(time = X[1,sample],
152
+ coord = paste0("CLR(", family_names[coord],")"))
153
+
154
+ predicted_tidy <- gather_array(predicted, val, coord, sample, iter) %>%
155
+ mutate(time = X_predict[1,sample]) %>%
156
+ filter(!is.na(val)) %>%
157
+ group_by(time, coord) %>%
158
+ summarise_posterior(val, na.rm=TRUE) %>%
159
+ ungroup() %>%
160
+ mutate(coord = paste0("CLR(", family_names[coord],")"))
161
+
162
+ ggplot(predicted_tidy, aes(x = time, y=mean)) +
163
+ geom_ribbon(aes(ymin=p2.5, ymax=p97.5), fill="darkgrey", alpha=0.5) +
164
+ geom_ribbon(aes(ymin=p25, ymax=p75), fill="darkgrey", alpha=0.9)+
165
+ geom_line(color="blue") +
166
+ geom_point(data = Y_clr_tidy, alpha=0.5) +
167
+ facet_wrap(~coord, scales="free_y") +
168
+ theme_minimal()+
169
+ theme(axis.title.y = element_blank(),
170
+ axis.title.x = element_blank(),
171
+ axis.text.x = element_text(angle=45))
172
172
173
173
```
174
174
0 commit comments