-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRscript-oldnoses-2013-reg analysis-active.R
More file actions
69 lines (61 loc) · 2.55 KB
/
Rscript-oldnoses-2013-reg analysis-active.R
File metadata and controls
69 lines (61 loc) · 2.55 KB
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
# This script creates plots used in Supplemental Information Figure 3
library(readxl); library(dplyr)
library(car)
library(ggplot2); library(ggpubr)
den2013 = read_excel("oldnoses-orfuncdata-2013-active.xlsx", sheet = "den-2013")
den2013$Odor = factor(den2013$Odor)
den2013$OR = factor(den2013$OR)
den2013$Human_log = log(den2013$Human)
den2013$Denisova_log = log(den2013$Denisova)
alt2013 = read_excel("oldnoses-orfuncdata-2013-active.xlsx", sheet = "alt-2013")
alt2013$Odor = factor(alt2013$Odor)
alt2013$OR = factor(alt2013$OR)
alt2013$Human_log = log(alt2013$Human)
alt2013$Altai_log = log(alt2013$Altai)
ust2013 = read_excel("oldnoses-orfuncdata-2013-active.xlsx", sheet = "ust-2013")
ust2013$Odor = factor(ust2013$Odor)
ust2013$OR = factor(ust2013$OR)
ust2013$Human_log = log(ust2013$Human)
ust2013$Ust_Ishim_log = log(ust2013$Ust_Ishim)
#plot regression
p1=ggplot(alt2013, aes(x=Human_log, y=Altai_log))+
geom_point(aes(colour = OR)) +
geom_smooth(method="lm", se= FALSE, col="black") +
stat_cor(aes(label = paste(..rr.label.., ..p.label.., sep = "~`,`~")),
method = "pearson",
p.accuracy = 0.001, r.accuracy = 0.01,
label.x = -3, label.y = 3.5, size = 6) +
stat_regline_equation(label.x = -3, label.y = 2.9, size = 6) +
labs(x = "Human Response",
y = "Altai 2013 Response") +
scale_color_viridis_d() +
theme_pubr(base_size = 20,legend= "right")
#plot regression
p2=ggplot(den2013, aes(x=Human_log, y=Denisova_log))+
geom_point(aes(colour = OR)) +
geom_smooth(method="lm", se= FALSE, col="black") +
stat_cor(aes(label = paste(..rr.label.., ..p.label.., sep = "~`,`~")),
method = "pearson",
p.accuracy = 0.001, r.accuracy = 0.01,
label.x = -3, label.y = 3.5, size = 6) +
stat_regline_equation(label.x = -3, label.y = 2.9, size = 6) +
labs(x = "Human Response",
y = "Denisova 2013 Response") +
scale_color_viridis_d() +
theme_pubr(base_size = 20,legend= "right")
#plot regression
p3=ggplot(ust2013, aes(x=Human_log, y=Ust_Ishim_log))+
geom_point(aes(color= OR)) +
geom_smooth(method="lm", se= FALSE, col="black") +
stat_cor(aes(label = paste(..rr.label.., ..p.label.., sep = "~`,`~")),
method = "pearson",
p.accuracy = 0.001, r.accuracy = 0.01,
label.x = -3, label.y = 3.5, size = 6) +
stat_regline_equation(label.x = -3, label.y = 2.8, size = 6) +
labs(x = "Human Response",
y = "Ust Ishim 2013 Response") +
scale_color_viridis_d() +
theme_pubr(base_size = 20,legend= "right")
#PLOT
library(cowplot)
plot_grid(p1,p2,p3, nrow = 1)