-
Notifications
You must be signed in to change notification settings - Fork 0
/
Chrotomyini_sandbox_analyses_06032022.Rmd
571 lines (478 loc) · 18.8 KB
/
Chrotomyini_sandbox_analyses_06032022.Rmd
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
---
title: 'Chrotomys analysis: Student priors, genus/sp/etc'
author: "S.M. Smith"
date: "5/2/2022"
output:
html_document:
keep_md: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
pacman::p_load(install = F, "ape", "bayesplot","BiocManager", "brms", "broom", "dagitty", "devtools", "flextable", "ggdark", "ggfortify", "ggmcmc", "ggrepel", "gtools", "lattice","loo", "patchwork", "rcartocolor", "Rcpp", "remotes", "rstan", "StanHeaders", "statebins", "tidybayes", "viridis", "viridisLite", "pacman")
```
Load up Chrotomyini trabecular bone architecture (TBA) data and standardize variables:
```{r}
d <- read.csv(file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\05062022 Philippine Murids segmentation parameters and morphological data - TBA data total BoneJ (full).csv", header = T)
d <- d[d$tribe=="chroto",c(1:2, 4:23)]
d <-
d %>%
mutate(bvtv = as.numeric(bvtv))
d <-
d %>%
mutate(mass_s = rethinking::standardize(log10(mass_g)),
elev_s = rethinking::standardize(elev),
bvtv_s = rethinking::standardize(bvtv),
tbth_s = rethinking::standardize(tbth),
tbsp_s = rethinking::standardize(tbsp),
conn_s = rethinking::standardize(conn),
cond_s = rethinking::standardize(m_connd),
cond_s2 = rethinking::standardize(connd),
da_s = rethinking::standardize(da))
# remove C. gonzalesi and R. isarogensis, singletons:
d <-
d %>%
filter(taxon!="Chrotomys_gonzalesi") %>%
filter(taxon!="Rhynchomys_isarogensis")
# Make categorical vars into factors
d <-
d %>%
mutate(loco = factor(loco),
hab_simp = factor(hab_simp),
genus = factor(genus))
# Specify colors for plots:
cols = c("#86acca","#ab685b", "#3370a3", "#1f314c","#5a9fa8")
```
Load in phylogeny:
REMEMBER: A <- ape::vcv.phylo(phylo), add corr = T if your tree is NOT SCALED TO 1.
```{r}
ch.tre <- read.nexus(file = "G:\\My Drive\\Philippine rodents\\Chrotomys\\analysis\\SMS_PRUNED_and_COLLAPSED_03292022_OTUsrenamed_Rowsey_PhBgMCC_LzChrotomyini.nex")
ch <- ape::vcv.phylo(ch.tre, corr = T)
d <-
d %>%
mutate(phylo = taxon)
```
From existing fits: call up some models for comparison. These are all BV.TV.
```{r}
# Just mass, wide gamma for nu
ch.70 <-
brm(file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.70")
ch.70 <- add_criterion(ch.70, c("loo", "waic"))
# Just genus, wide gamma for nu
ch.71 <-
brm(file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.71")
ch.71 <- add_criterion(ch.71, c("loo", "waic"))
# Just genus, nu fixed at 2
ch.71b <-
brm(file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.71b")
ch.71b <- add_criterion(ch.71b, c("loo", "waic"))
# By genus and mass
ch.72 <-
brm(file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.72")
ch.72 <- add_criterion(ch.72, c("loo", "waic"))
# By genus and mass with fixed nu
ch.72b <-
brm(file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.72b")
ch.72b <- add_criterion(ch.72b, c("loo", "waic"))
# By genus, mass, and BOTH phylogeny/intraspecific variance
ch.74 <-
brm(file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.74")
ch.74 <- add_criterion(ch.74, c("loo", "waic"))
# By genus, mass, and phylogeny only
ch.74.1 <-
brm(file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.74.1")
mcmc_plot(ch.74.1, pars = "^b_")
ch.74.1 <- add_criterion(ch.74.1, c("loo", "waic"))
# By genus, mass, and intraspecific variance only
ch.74.2 <-
brm(file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.74.2")
ch.74.2 <- add_criterion(ch.74.2, c("loo", "waic"))
# by SPECIES, mass, and phylo
ch.74.3 <-
brm(file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.74.3")
print(ch.74.3)
mcmc_plot(ch.74.3, pars = "^b_")
ch.74.3 <- add_criterion(ch.74.3, c("loo", "waic"))
# By genus, mass, phylogeny/intraspcific var, fixed nu = 2
ch.74b <-
brm(file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.74b")
ch.74b <- add_criterion(ch.74b, c("loo", "waic"))
# By genus, mass, phylogeny/intraspcific var, with estimated nu, more robust gamma(4,1) as demonstrated by Kurz - a slightly more restrictive prior but not as much as the fixed one:
ch.74c <-
brm(file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.74c")
ch.74c <- add_criterion(ch.74c, c("loo", "waic"))
b_estimates <-
tibble(model = c("ch.74", "ch.74b", "ch.74c")) %>%
mutate(fit = map(model, get)) %>%
mutate(posterior_summary = map(fit, ~posterior_summary(.) %>%
data.frame() %>%
rownames_to_column("term"))) %>%
unnest(posterior_summary) %>%
select(-fit) %>%
arrange(term)
```
Ok try some other things. Model just based on phylogeny:
```{r}
ch.75 <-
brm(data = d,
family = student,
bf(bvtv_s ~ 1+ (1|gr(phylo, cov = ch)), nu = 2),
prior = c(
prior(exponential(1), class = sigma)),
data2 = list(ch = ch),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.75")
ch.75 <- add_criterion(ch.75, c("loo", "waic"))
loo_compare(ch.75, ch.74, ch.74.1, ch.74.2, ch.74.3, ch.70, ch.71, ch.71b)%>%
print(simplify = F)
```
Try some more species things:
```{r}
# by species tbth
ch.76 <-
brm(data = d,
family = student,
tbth_s ~ 0 + taxon + mass_s + (1|gr(phylo, cov = ch)),
control = list(adapt_delta = 0.98), #inserted to decrease the number of divergent transitions here
prior = c(
prior(gamma(2, 0.1), class = nu),
prior(normal(0, 1), class = b),
prior(normal(0, 1), class = sd),
prior(exponential(1), class = sigma)
),
data2 = list(ch = ch),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.76")
ch.76 <- add_criterion(ch.76, c("loo", "waic"))
# by phylo only tbth
ch.76.1 <-
brm(data = d,
family = student,
bf(tbth_s ~ 1+ (1|gr(phylo, cov = ch)), nu = 2),
prior = c(
prior(exponential(1), class = sigma)),
data2 = list(ch = ch),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.76.1")
ch.76.1 <- add_criterion(ch.76.1, c("loo", "waic"))
hyp <- "sd_phylo__Intercept^2 / (sd_phylo__Intercept^2 + sigma^2) = 0"
h.bvtv <- hypothesis(ch.76, hyp, class = NULL)
h.bvtv
# By mass only
ch.76.2 <-
brm(data = d,
family = student,
tbth_s ~ 1+mass_s,
prior = c(prior(normal(0, 1), class = b),
prior(gamma(2, 0.1), class = nu),
prior(exponential(1), class = sigma)),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
seed = 5,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.76.2")
ch.76.2 <- add_criterion(ch.76.2, c("loo", "waic"))
loo_compare(ch.76, ch.76.1, ch.76.2) %>%
print(simplify = F)
print(ch.76)
mcmc_plot(ch.76, pars = "^b_")
```
```{r}
# by species tbsp
ch.77 <-
brm(data = d,
family = student,
tbsp_s ~ 0 + taxon + mass_s + (1|gr(phylo, cov = ch)),
control = list(adapt_delta = 0.98), #inserted to decrease the number of divergent transitions here
prior = c(
prior(gamma(2, 0.1), class = nu),
prior(normal(0, 1), class = b),
prior(normal(0, 1), class = sd),
prior(exponential(1), class = sigma)
),
data2 = list(ch = ch),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.77")
print(ch.77)
mcmc_plot(ch.77, pars = "^b_")
# by phylo only tbsp
ch.77.1 <-
brm(data = d,
family = student,
bf(tbsp_s ~ 1+ (1|gr(phylo, cov = ch)), nu = 2),
prior = c(
prior(exponential(1), class = sigma)),
data2 = list(ch = ch),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.77.1")
ch.77.1 <- add_criterion(ch.77.1, c("loo", "waic"))
# By mass only
ch.77.2 <-
brm(data = d,
family = student,
tbsp_s ~ 1+mass_s,
prior = c(prior(normal(0, 1), class = b),
prior(gamma(2, 0.1), class = nu),
prior(exponential(1), class = sigma)),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
seed = 5,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.77.2")
ch.77.2 <- add_criterion(ch.77.2, c("loo", "waic"))
# By genus tbsp
ch.77.3 <-
brm(data = d,
family = student,
tbsp_s ~ 0 + genus + mass_s + (1|gr(phylo, cov = ch)),
control = list(adapt_delta = 0.98), #inserted to decrease the number of divergent transitions here
prior = c(
prior(gamma(2, 0.1), class = nu),
prior(normal(0, 1), class = b),
prior(normal(0, 1), class = sd),
prior(exponential(1), class = sigma)
),
data2 = list(ch = ch),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.77.3")
print(ch.77.3)
hyp <- "sd_phylo__Intercept^2 / (sd_phylo__Intercept^2 + sigma^2) = 0"
h.bvtv <- hypothesis(ch.77.3, hyp, class = NULL)
h.bvtv
ch.77.3 <- add_criterion(ch.77.3, c("loo", "waic"))
plot(ch.77.3)
ph.bvtv.pl <- ggplot() +
geom_density(aes(x = h.bvtv$samples$H1), fill = "red", alpha = 0.5) +
theme_bw() +
xlim(0,1) +
labs(y = "density", x = "lambda: Trabecular spacing")
ph.bvtv.pl
loo_compare(ch.77, ch.77.1, ch.77.2, ch.77.3) %>%
print(simplify = F)
```
```{r}
# by species cond
ch.78 <-
brm(data = d,
family = student,
cond_s ~ 0 + taxon + mass_s + (1|gr(phylo, cov = ch)),
control = list(adapt_delta = 0.98), #inserted to decrease the number of divergent transitions here
prior = c(
prior(gamma(2, 0.1), class = nu),
prior(normal(0, 1), class = b),
prior(normal(0, 1), class = sd),
prior(exponential(1), class = sigma)
),
data2 = list(ch = ch),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.78")
print(ch.78)
mcmc_plot(ch.78, pars = "^b_")
ch.78 <- add_criterion(ch.78, c("loo", "waic"))
# by phylo only cond
ch.78.1 <-
brm(data = d,
family = student,
bf(cond_s ~ 1+ (1|gr(phylo, cov = ch)), nu = 2),
prior = c(
prior(exponential(1), class = sigma)),
data2 = list(ch = ch),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.78.1")
ch.78.1 <- add_criterion(ch.78.1, c("loo", "waic"))
print(ch.78.1)
# By mass only
ch.78.2 <-
brm(data = d,
family = student,
cond_s ~ 1+mass_s,
prior = c(prior(normal(0, 1), class = b),
prior(gamma(2, 0.1), class = nu),
prior(exponential(1), class = sigma)),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
seed = 5,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.78.2")
ch.78.2 <- add_criterion(ch.78.2, c("loo", "waic"))
# By genus tbsp
ch.78.3 <-
brm(data = d,
family = student,
cond_s ~ 0 + genus + mass_s + (1|gr(phylo, cov = ch)),
control = list(adapt_delta = 0.98), #inserted to decrease the number of divergent transitions here
prior = c(
prior(gamma(2, 0.1), class = nu),
prior(normal(0, 1), class = b),
prior(normal(0, 1), class = sd),
prior(exponential(1), class = sigma)
),
data2 = list(ch = ch),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.78.3")
print(ch.78.3)
ch.78.3 <- add_criterion(ch.78.3, c("loo", "waic"))
loo_compare(ch.78, ch.78.1, ch.78.2, ch.78.3) %>%
print(simplify = F)
```
Some models by species and mass only to plot on the phylogeny as a continuous trait. Is this allowed? I don't know for sure but I'm gonna try it.
```{r}
# by species tbth no phy
ch.75.4 <-
brm(data = d,
family = student,
bvtv_s ~ 0 + taxon + mass_s,
control = list(adapt_delta = 0.98), #inserted to decrease the number of divergent transitions here
prior = c(
prior(gamma(2, 0.1), class = nu),
prior(normal(0, 1), class = b),
prior(exponential(1), class = sigma)
),
data2 = list(ch = ch),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.75.4")
print(ch.75.4)
mcmc_plot(ch.75.4, pars = "^b_")
ch.75.4 <- add_criterion(ch.75.4, c("loo", "waic"))
# by species tbth no phy
ch.76.4 <-
brm(data = d,
family = student,
tbth_s ~ 0 + taxon + mass_s,
control = list(adapt_delta = 0.98), #inserted to decrease the number of divergent transitions here
prior = c(
prior(gamma(2, 0.1), class = nu),
prior(normal(0, 1), class = b),
prior(exponential(1), class = sigma)
),
data2 = list(ch = ch),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.76.4")
print(ch.76.4)
mcmc_plot(ch.76.4, pars = "^b_")
ch.76.4 <- add_criterion(ch.76.4, c("loo", "waic"))
# by species tbsp no phy
ch.77.4 <-
brm(data = d,
family = student,
tbsp_s ~ 0 + taxon + mass_s,
control = list(adapt_delta = 0.98), #inserted to decrease the number of divergent transitions here
prior = c(
prior(gamma(2, 0.1), class = nu),
prior(normal(0, 1), class = b),
prior(exponential(1), class = sigma)
),
data2 = list(ch = ch),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.77.4")
print(ch.77.4)
mcmc_plot(ch.77.4, pars = "^b_")
ch.77.4 <- add_criterion(ch.77.4, c("loo", "waic"))
# by species cond no phy
ch.78.4 <-
brm(data = d,
family = student,
cond_s ~ 0 + taxon + mass_s,
control = list(adapt_delta = 0.98), #inserted to decrease the number of divergent transitions here
prior = c(
prior(gamma(2, 0.1), class = nu),
prior(normal(0, 1), class = b),
prior(exponential(1), class = sigma)
),
iter = 2000, warmup = 1000, chains = 4, cores = 4,
file = "G:\\My Drive\\Philippine rodents\\chrotomyini\\fits\\ch.78.4")
print(ch.78)
mcmc_plot(ch.78.4, pars = "^b_")
ch.78 <- add_criterion(ch.78, c("loo", "waic"))
```
How about some PCAs? Just real quick.
```{r}
d_pc <- d %>%
select(c("taxon", "specno","genus", (ends_with("_s")))) %>%
select(!c("elev_s", "da_s", "conn_s")) %>%
column_to_rownames("specno")
pc_s <- prcomp(d_pc[,3:7])
pc12 <- autoplot(pc_s, x = 1, y = 2, data = d_pc, colour = "genus", size = 3, loadings.label = T, loadings = T, loadings.colour = "#000000", loadings.label.colour = "#000000",scale = 0)
pc12species <- autoplot(pc_s, x = 1, y = 2, data = d_pc, colour = "taxon", size = 3, loadings.label = T, loadings = T, shape = "genus", scale = 0)
pc32 <- autoplot(pc_s, x = 3, y = 2, data = d_pc, colour = "genus", size = 3, loadings.label = T, loadings = T, loadings.colour = "#000000", loadings.label.colour = "#000000", scale = 0)
pc12|pc32
pcall <- pc_s$x %>%
as.data.frame() %>%
mutate(genus = d_pc$genus,
taxon = d_pc$taxon)
pccolsplot <- autoplot(mapping = aes(lwd = 10), pc_s, x = 1, y = 2, data = d_pc, shape = F, label = F, loadings.label = T, loadings = T, loadings.colour = "#000000", loadings.label.colour = "#000000", scale = 0) +
geom_point(aes(PC1, y=PC2, color = taxon), data = pcall, size = 8)+
scale_color_manual(values = cols2)
pccolsplot
```
Can I plot JUST the Chrotomys guys?
```{r}
pcchrot <- pc_s$x %>%
as.data.frame() %>%
mutate(genus = d_pc$genus,
taxon = d_pc$taxon) %>%
filter(genus=="Chrotomys")
pcchplot <- autoplot(pc_s, x = 1, y = 2, data = d_pc, shape = F, label = F, loadings.label = T, loadings = T, loadings.colour = "#000000", loadings.label.colour = "#000000", scale = 0) +
geom_point(aes(PC1, y=PC2, color = taxon), data = pcchrot, size = 3)
pcchplot
```
May as well do ones for Apomys and Soricomys.
Apomys:
```{r}
pcap <- pc_s$x %>%
as.data.frame() %>%
mutate(genus = d_pc$genus,
taxon = d_pc$taxon) %>%
filter(genus=="Apomys")
pcapplot <- autoplot(pc_s, x = 1, y = 2, data = d_pc, shape = F, label = F, loadings.label = T, loadings = T, loadings.colour = "#000000", loadings.label.colour = "#000000", scale = 0) +
geom_point(aes(PC1, y=PC2, color = taxon), data = pcap, size = 3)
pcapplot
```
Soricomys:
```{r}
pcsor <- pc_s$x %>%
as.data.frame() %>%
mutate(genus = d_pc$genus,
taxon = d_pc$taxon) %>%
filter(genus=="Soricomys")
pcsorplot <- autoplot(pc_s, x = 1, y = 2, data = d_pc, shape = F, label = F, loadings.label = T, loadings = T, loadings.colour = "#000000", loadings.label.colour = "#000000", scale = 0) +
geom_point(aes(PC1, y=PC2, color = taxon), data = pcsor, size = 3)
pcsorplot
```
How about some allometry in case someone asks?
```{r}
ggplot(aes(x=bvtv, y = mass_g), data = d)+
geom_point() +
scale_x_log10()+
scale_y_log10()+
stat_smooth(method = lm)
library(smatr)
g <- sma(bvtv~mass_g, data = d, slope.test = 0, log = "xy", robust = T)
print(g) # slope = 0.315, p = 2.22e-16: positive allometry (slope is > 0). It's right around what the slope would be for isometry in a linear measurement, which is interesting, but there's no reason for it to be that because it is a dimensionless ratio. Bone Volume(mm^3)/Total volume (mm^3): the units cancel out. Right?
plot(g)
```
```{r}
ggplot(aes(x=tbth, y = mass_g), data = d)+
geom_point() +
scale_x_log10()+
scale_y_log10()+
stat_smooth(method = lm)
g2 <- sma(tbth~mass_g, data = d, slope.test = 1/3, log = "xy", robust = T)
print(g2) # slope = 0.328, p = 0.65: isometry (slope is not different from 1/3). This differs from what Mielke et al 2018 uses because her body mass proxy is linear (she uses isometry = 1).
plot(g2)
```
```{r}
ggplot(aes(x=mass_g, y = tbsp), data = d)+
geom_point() +
scale_x_log10()+
scale_y_log10()+
geom_abline(slope = 0.271, intercept = -2.02)
g3 <- sma(tbsp~mass_g, data = d, slope.test = 1/3, log = "xy", robust = T)
print(g3) # slope = 0.271, p = 0.051... Isometry? Right on the damn edge. If it's negative allometry (slope is less than 1/3 is the test), it's very slight. This differs from what Mielke et al 2018 uses because her body mass proxy is linear (she uses isometry = 1).
plot(g3)
```
```{r}
ggplot(aes(x=connd, y = mass_g), data = d)+
geom_point() +
scale_x_log10()+
scale_y_log10()+
#stat_smooth(method = lm)+
geom_abline(slope = -1, intercept = 5.931)
g4 <- sma(connd~mass_g, data = d, slope.test = -1, log = "xy", robust = T) # isometric slope -1 because it's connectivity per unit volume (1/mm^3). This differs from what Mielke et al 2018 uses because her body mass proxy is linear (she uses -3).
print(g4) #slope = -1, p = 0.99: Isometry (slope not diff from -1)
plot(g4)
```