-
Notifications
You must be signed in to change notification settings - Fork 0
/
fig7.R
73 lines (51 loc) · 2.55 KB
/
fig7.R
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
rm(list=ls())
################################
# Load workspace and libraries #
################################
load('data/0_finalData.RData')
library(ggplot2)
library(ppcor)
library(mgcv)
library(visreg)
library(scatterplot3d)
####################################
# load rich club assignments
richclub <- read.csv('/data/richclub.txt')
df1<- cbind(richclub)
# For right stochastic matrices:
# load compression efficiency send as row mean of resource efficiency over i
# load compression efficiency receive as column mean of resource efficiency over j
unbiasedSlopes_send <- as.data.frame(read.csv('/data/compressionEfficiency_send.txt', sep=' ',header=F))
unbiasedSlopes_receive <- as.data.frame(read.csv('/data/compressionEfficiency_receive.txt', sep=' ',header=F))
df1$slope_send <- unbiasedSlopes_send[,2]
df1$slope_receive <- unbiasedSlopes_receive[,2]
scaling <- as.vector(read.csv('/data/allometricScaling_regional.txt', sep=' ',header=F))
df1$scaling <- scaling$V1
myelin <- as.vector(read.csv('/data/regionalData/myelin_regional.txt', sep=' ',header=F))
df1$myelin <- myelin$V1
colnames(df1) <- c('richclub','slope_send', 'slope_receive', 'scaling', 'myelin')
####################################
# Uncorrected spatial correlations #
####################################
myelinP <- cor.test(df1$myelin,df1$slope_receive, method='spearman')$p.value
myelinP2 <- cor.test(df1$myelin,df1$slope_send, method='spearman')$p.value
scalingP <- cor.test(df1$scaling,df1$slope_receive, method='spearman')$p.value
scalingP2 <- cor.test(df1$scaling,df1$slope_send, method='spearman')$p.value
# uncorrected p-values
evo_pvals <- c(scalingP2,myelinP2, scalingP, myelinP)
p.adjust(evo_pvals, method='holm')
###################################
# Spatially permuted correlations #
###################################
# see Matlab code fig7_atlasCorrelations.m
evo_spin_pvals <- c(0.0512, 0.0097, 0.0069, 0.0226)
p.adjust(evo_spin_pvals, method='holm')
#####################
# Plot correlations #
#####################
ggplot(df1,aes(slope_send, myelin))+geom_point()+geom_smooth(method='lm')+theme_classic(base_size=20)
ggsave("figures/fig7/myelin-distortion_send.eps",device='eps',width=7.18,height=6.31)
ggplot(df1, aes(slope_receive, scaling))+geom_point()+geom_smooth(method='lm')+theme_classic(base_size=20)
ggsave("figures/fig7/scaling-distortion_receive.eps",device='eps',width=7.18,height=6.31)
ggplot(df1, aes(slope_send, scaling))+geom_point()+geom_smooth(method='lm')+theme_classic(base_size=20)
ggsave("figures/fig7/scaling-distortion_send.eps",device='eps',width=7.18,height=6.31)