-
Notifications
You must be signed in to change notification settings - Fork 0
/
05_model_plots.R
102 lines (76 loc) · 4.19 KB
/
05_model_plots.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
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
contrast_names <- c("cGrammatical" = "Grammaticality",
"cAttractorPlural" = "Plural Attactor",
"cGrammatical:cAttractorPlural" = "Grammaticality * Plural Attractor",
"cEndsInConsonant" = "Ambiguity",
"cEndsInConsonant:cGrammatical" = "Ambiguity * Grammaticality",
"cEndsInConsonant:cAttractorPlural" = "Ambiguity * Plural Attractor",
"cEndsInConsonant:cGrammatical:cAttractorPlural" = "Ambiguity * Grammaticality * Plural Attractor")
p_m_response <-
create_model_coefs_plot( m_responses,
plot_stats = T, map_names = contrast_names,
expand_right = 2.5, expand_top = 1.4, x_stat_adjust = 1.1,
x_breaks = -1:4 ) +
xlab("Estimate (probit)")
p_m_response <- p_m_response + theme(axis.title.x = element_text(hjust=0.15))
p_m_response <- print(p_m_response + annotate(x=-1, xend=4, y=0, yend=0, lwd=0.25, geom="segment"))
{
ungram_contrast_names <- c("cEndsInConsonant" = "Ambiguity",
"cAttractorPlural" = "Plural Attactor",
"cEndsInConsonant:cAttractorPlural" = "Ambiguity * Plural Attractor")
p_m_ungram_response <-
create_model_coefs_plot( m_ungram_responses,
plot_stats = T, map_names = ungram_contrast_names,
expand_right = 2, expand_top = 5, x_stat_adjust = 1.1,
x_breaks = c(-1,-0.5,0,0.5,1) ) +
xlab("Estimate (probit)")
p_m_ungram_response <- p_m_ungram_response + theme(axis.title.x = element_text(hjust=0.25))
p_m_ungram_response <- print(p_m_ungram_response + annotate(x=-1, xend=1, y=0, yend=0, lwd=0.25, geom="segment"))
}
{
if (exp1only ==T) {
contrast_names_exp1 <- c("cGrammatical" = "Grammaticality",
"cAttractorPlural" = "Plural Attactor",
"freqlog_n1n2"="log Frequency: N1-N2",
"cGrammatical:freqlog_n1n2" = "Grammaticality * log Frequency: N1-N2",
"cAttractorPlural:freqlog_n1n2" = "Plural Attactor * log Frequency: N1-N2",
"cGrammatical:cAttractorPlural" = "Grammaticality * Plural Attractor",
"cGrammatical:cAttractorPlural:freqlog_n1n2" = "Grammaticality * Plural Attractor * log Frequency: N1-N2"
)
p_m_response_exp1 <-
create_model_coefs_plot( m_responses_exp1only,
plot_stats = T, map_names = contrast_names_exp1,
expand_right = 2.5, expand_top = 2, x_stat_adjust = 1.1,
x_breaks = -1:4 ) +
xlab("Estimate (probit)")
}
}
{
if (lagoonly == T) {
contrast_names_exp1 <- c("cGrammatical" = "Grammaticality",
"cAttractorPlural" = "Plural Attactor",
"freqlog_n1n2"="log Frequency: N1-N2",
"cGrammatical:freqlog_n1n2" = "Grammaticality * log Frequency: N1-N2",
"cAttractorPlural:freqlog_n1n2" = "Plural Attactor * log Frequency: N1-N2",
"cGrammatical:cAttractorPlural" = "Grammaticality * Plural Attractor",
"cGrammatical:cAttractorPlural:freqlog_n1n2" = "Grammaticality * Plural Attractor * log Frequency: N1-N2"
)
p_m_response_lago <-
create_model_coefs_plot( m_responses_Lagoonly,
plot_stats = T, map_names = contrast_names_exp1,
expand_right = 2.5, expand_top = 2, x_stat_adjust = 1.1,
x_breaks = -2:4 ) +
xlab("Estimate (probit)")
}
}
{
if (exp1only == T & lagoonly ==T) {
p_m_response_exp1 <- p_m_response_exp1 + facet_wrap(~"Experiment 1") + annotate(x=-2, xend=4, y=0, yend=0, lwd=0.25, geom="segment")
p_m_response_lago <- p_m_response_lago + facet_wrap(~"Lago et al. (2018)") + annotate(x=-2, xend=4, y=0, yend=0, lwd=0.25, geom="segment")
p_m_response_exp1_and_lago <- ggarrange(p_m_response_exp1, p_m_response_lago, ncol = 1)
}
}
{
if (rt == T) {
# TODO: fill this up.
}
}