-
Notifications
You must be signed in to change notification settings - Fork 0
/
01_compare.qmd
79 lines (64 loc) · 2.79 KB
/
01_compare.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
title: "Comparing different methods"
date: last-modified
format:
html:
embed-resources: true
title-block-banner: true
bibliography: references.bib
---
- We can use the networks that we built from the previous section and showcase how they (maybe) are giving way different metrics (telling different stories)
- I think if we have multiple networks for different time points as well we can compare within and between network differences? (need to have a think on that)
```{r}
#| echo: false
#| warning: false
library(dplyr)
library(ggradar)
library(patchwork)
library(readr)
library(scales)
library(tidyverse)
df = list.files(path="data/processed/", full.names = TRUE) %>%
lapply(read_csv) %>%
bind_rows %>%
# to get the ratio
mutate(ratio = top/basal,
top = NULL,
basal = NULL) %>%
pivot_longer(
cols = -c(id, model),
names_to = "stat",
values_to = "stat_val") %>%
# standardise names
mutate(id = case_when(
str_detect(id, "^.*pre.*$") ~ "pre",
str_detect(id, "^.*during.*$") ~ "post",
str_detect(id, "^.*post.*$") ~ "during",
TRUE ~ as.character(id)))
df$id <- ordered(df$id, levels=c("pre", "during", "post"))
```
```{r}
#| echo: false
#| label: fig-line
#| fig-cap: "Comparing the different structures that are recovered by the different models (colours) over a time series. We can ignore richness - that's more a sanity check for me. S1, S2, S4, S5 are motifs; S1 = Number of linear chains, S2 = Number of omnivory motifs, S4 = Number of apparent competition motifs, S5 = Number of direct competition motifs"
ggplot(df,
aes(x = factor(`id`),
y = stat_val,
colour = model,
group = model)) +
geom_line() +
geom_point() +
facet_wrap(vars(stat),
scales = 'free') +
scale_size(guide = 'none') +
theme_classic() +
xlab("time") +
ylab("value") +
theme(panel.border = element_rect(colour = 'black',
fill = "#ffffff00"),
axis.ticks.x = element_blank())
```
We can obviously look at different 'summary statistics' (see [Form v Function](03_structure.qmd)) but just throwing these out for now...
Similar signal but different values...
Also the challenge that we don't really know what is 'true' so don't actually know how much we can infer but it is interesting to see what the different models are spitting out even if they are potentially wrong...
Also also does this influence the way we are thinking about the idea of 'feasibility' vs 'energy' networks? One would think they might have clustered a bit differently... although arguably the PFIM is the only feasibility network here and it is often the (visual) outlier...