US data
# data <- read.csv("data_anon0109_coded.csv")
# corpus <- read.csv("corpusE.csv")
# data_corpus <- left_join(data, corpus, by = "Cue_renamed")
#
# data_responses <- data_corpus %>%
# group_by(subject, Cue_renamed, responses_theme) %>%
# summarize(theme_resp_ratio_bysubj = mean(responses_theme))
#
# data_freq <- corpus %>%
# mutate(theme_ratio = theme.frequency / (theme.frequency + tax.frequency)) %>%
# filter(!is.na(theme_ratio)) %>%
# select(Cue_renamed, theme_ratio)
#
# data_sum <- inner_join(data_responses, data_freq, by = "Cue_renamed") #removed lilypad
data <- read.csv("data_anon0115_coded.csv")
corpusE<- read.csv("corpusE.csv")
corpusE <- corpusE %>%
mutate(theme_ratio_E = theme.frequency / (theme.frequency + tax.frequency)) %>%
filter(!is.na(theme_ratio_E)) %>%
select(Cue_renamed, theme_ratio_E)
corpusV<- read.csv("corpusV.csv")
corpusV <- corpusV %>%
mutate(theme_ratio_V = theme.frequency / (theme.frequency + tax.frequency)) %>%
filter(!is.na(theme_ratio_V)) %>%
select(Cue_renamed, theme_ratio_V)
data_corpus <- left_join(data, corpusE, by = "Cue_renamed")
data_corpus <- inner_join(data_corpus, corpusV, by = "Cue_renamed")
data_sum <- data_corpus %>%
group_by(subject, Cue_renamed, responses_theme, theme_ratio_V, theme_ratio_E) %>%
summarize(theme_resp_ratio_bysubj = mean(responses_theme))
## `summarise()` regrouping output by 'subject', 'Cue_renamed', 'responses_theme', 'theme_ratio_V' (override with `.groups` argument)
write.csv(data_sum, "dataSumUS_0115.csv")
Regressions
data_model <- data_sum
mV = glmer(responses_theme ~ theme_ratio_V + (1 | subject) + (1 | Cue_renamed), data = data_model, family="binomial")
plot(fitted(mV), residuals(mV))

summary(mV)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: responses_theme ~ theme_ratio_V + (1 | subject) + (1 | Cue_renamed)
## Data: data_model
##
## AIC BIC logLik deviance df.resid
## 13333.2 13362.7 -6662.6 13325.2 11851
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.4618 -0.7217 0.3259 0.6707 9.9898
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 0.8095 0.8997
## Cue_renamed (Intercept) 0.9452 0.9722
## Number of obs: 11855, groups: subject, 167; Cue_renamed, 71
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.3564 0.1946 -1.832 0.067 .
## theme_ratio_V 1.1450 0.2740 4.179 2.93e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## theme_rat_V -0.712
mE = glmer(responses_theme ~ theme_ratio_E + (1 | subject) + (1 | Cue_renamed), data = data_model, family="binomial")
plot(fitted(mE), residuals(mE))

summary(mE)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: responses_theme ~ theme_ratio_E + (1 | subject) + (1 | Cue_renamed)
## Data: data_model
##
## AIC BIC logLik deviance df.resid
## 13204.0 13233.5 -6598.0 13196.0 11684
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.4516 -0.7241 0.3276 0.6743 9.8101
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 0.8091 0.8995
## Cue_renamed (Intercept) 0.7772 0.8816
## Number of obs: 11688, groups: subject, 167; Cue_renamed, 70
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.9794 0.2435 -4.022 5.76e-05 ***
## theme_ratio_E 1.9878 0.3501 5.678 1.36e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## theme_rat_E -0.850
## English/Vietnamese comparison
mVE = glmer(responses_theme ~ theme_ratio_V + theme_ratio_E + (1 | subject) + (1 | Cue_renamed), data = data_model, family="binomial")
summary(mVE)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: responses_theme ~ theme_ratio_V + theme_ratio_E + (1 | subject) +
## (1 | Cue_renamed)
## Data: data_model
##
## AIC BIC logLik deviance df.resid
## 13205.2 13242.0 -6597.6 13195.2 11683
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.4560 -0.7240 0.3276 0.6755 9.8092
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 0.8092 0.8996
## Cue_renamed (Intercept) 0.7678 0.8763
## Number of obs: 11688, groups: subject, 167; Cue_renamed, 70
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.9709 0.2422 -4.008 6.12e-05 ***
## theme_ratio_V 0.2954 0.3263 0.905 0.365274
## theme_ratio_E 1.7242 0.4533 3.803 0.000143 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) thm__V
## theme_rat_V 0.038
## theme_rat_E -0.675 -0.641
Plot Model vs Data
require(ggrepel)
## Loading required package: ggrepel
data_avg <- data_sum %>% #compute emp_theme_prop
select( -theme_resp_ratio_bysubj) %>%
group_by(Cue_renamed) %>%
summarize(emp_theme_prop = mean(responses_theme))
## `summarise()` ungrouping output (override with `.groups` argument)
corrE <- data_model %>%
ungroup() %>%
select(-subject) %>%
distinct(Cue_renamed, theme_ratio_E) %>%
left_join(data_avg, by="Cue_renamed") %>%
rename(triad=Cue_renamed) %>%
rename(Ecorpus_theme_prop=theme_ratio_E)
corrE %>% ggplot(aes(x=emp_theme_prop, y=Ecorpus_theme_prop, label = triad)) +
geom_text() +
#geom_label_repel() +
theme_classic() +
xlab("Proportion Thematic Chosen (US)") +
ylab("Proportion Thematic Predicted (English)")
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(corrE$Ecorpus_theme_prop,corrE$emp_theme_prop, na.rm=T)
##
## Pearson's product-moment correlation
##
## data: corrE$Ecorpus_theme_prop and corrE$emp_theme_prop
## t = 5.5935, df = 68, p-value = 4.298e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.3759688 0.7035280
## sample estimates:
## cor
## 0.5613514
corrV <- data_model %>%
ungroup() %>%
select(-subject) %>%
distinct(Cue_renamed, theme_ratio_V) %>%
left_join(data_avg, by="Cue_renamed") %>%
rename(triad=Cue_renamed) %>%
rename(Vcorpus_theme_prop=theme_ratio_V)
corrV %>% ggplot(aes(x=emp_theme_prop, y=Vcorpus_theme_prop, label = triad)) +
geom_text() +
#geom_label_repel() +
theme_classic() +
xlab("Proportion Thematic Chosen (US)") +
ylab("Proportion Thematic Predicted (Vietnamese)")

cor.test(corrV$Vcorpus_theme_prop,corrV$emp_theme_prop, na.rm=T)
##
## Pearson's product-moment correlation
##
## data: corrV$Vcorpus_theme_prop and corrV$emp_theme_prop
## t = 4.0796, df = 69, p-value = 0.0001193
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.2313145 0.6112653
## sample estimates:
## cor
## 0.4408283
data_model %>% ggplot(aes(x=theme_ratio_E, y=theme_ratio_V, label = Cue_renamed)) +
geom_text() +
#geom_label_repel() +
theme_classic() +
xlab("Proportion Thematic Predicted (English)") +
ylab("Proportion Thematic Predicted (Vietnamese)")
## Warning: Removed 167 rows containing missing values (geom_text).

cor.test(corrE$Ecorpus_theme_prop,corrV$Vcorpus_theme_prop, na.rm=T)
##
## Pearson's product-moment correlation
##
## data: corrE$Ecorpus_theme_prop and corrV$Vcorpus_theme_prop
## t = 6.9048, df = 68, p-value = 2.104e-09
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.4793221 0.7620135
## sample estimates:
## cor
## 0.6419899
VN data
# data <- read.csv("data_V_anon0114_coded.csv")
# corpus <- read.csv("corpusV.csv")
# data_corpus <- left_join(data, corpus, by = "Cue_renamed")
#
# data_responses <- data_corpus %>%
# group_by(subject, Cue_renamed, responses_theme) %>%
# summarize(theme_resp_ratio_bysubj = mean(responses_theme))
#
# data_freq <- corpus %>%
# mutate(theme_ratio = theme.frequency / (theme.frequency + tax.frequency)) %>%
# filter(!is.na(theme_ratio)) %>%
# select(Cue_renamed, theme_ratio)
#
# data_sum <- inner_join(data_responses, data_freq, by = "Cue_renamed") #removed lilypad
Load response and corpus data
data <- read.csv("data_V_anon0115_coded.csv")
corpusE<- read.csv("corpusE.csv")
corpusE <- corpusE %>%
mutate(theme_ratio_E = theme.frequency / (theme.frequency + tax.frequency)) %>%
filter(!is.na(theme_ratio_E)) %>%
select(Cue_renamed, theme_ratio_E)
corpusV<- read.csv("corpusV.csv")
corpusV <- corpusV %>%
mutate(theme_ratio_V = theme.frequency / (theme.frequency + tax.frequency)) %>%
filter(!is.na(theme_ratio_V)) %>%
select(Cue_renamed, theme_ratio_V)
data_corpus <- left_join(data, corpusE, by = "Cue_renamed")
data_corpus <- inner_join(data_corpus, corpusV, by = "Cue_renamed")
data_sum <- data_corpus %>%
group_by(subject, Cue_renamed, responses_theme, theme_ratio_V, theme_ratio_E) %>%
summarize(theme_resp_ratio_bysubj = mean(responses_theme))
## `summarise()` regrouping output by 'subject', 'Cue_renamed', 'responses_theme', 'theme_ratio_V' (override with `.groups` argument)
#write.csv(data_sum, "dataSumVN_0115.csv")
Regressions
data_model <- data_sum
mV = glmer(responses_theme ~ theme_ratio_V + (1 | subject) + (1 | Cue_renamed), data = data_model, family="binomial")
plot(fitted(mV), residuals(mV))

summary(mV)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: responses_theme ~ theme_ratio_V + (1 | subject) + (1 | Cue_renamed)
## Data: data_model
##
## AIC BIC logLik deviance df.resid
## 6964.7 6991.5 -3478.3 6956.7 6020
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5824 -0.7465 0.3584 0.6728 4.3696
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 0.373 0.6107
## Cue_renamed (Intercept) 1.089 1.0435
## Number of obs: 6024, groups: subject, 83; Cue_renamed, 73
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.2933 0.2047 -1.432 0.152
## theme_ratio_V 1.2182 0.2952 4.126 3.69e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## theme_rat_V -0.717
mE = glmer(responses_theme ~ theme_ratio_E + (1 | subject) + (1 | Cue_renamed), data = data_model, family="binomial")
plot(fitted(mE), residuals(mE))

summary(mE)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: responses_theme ~ theme_ratio_E + (1 | subject) + (1 | Cue_renamed)
## Data: data_model
##
## AIC BIC logLik deviance df.resid
## 6895.9 6922.6 -3443.9 6887.9 5937
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5359 -0.7476 0.3539 0.6807 4.2838
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 0.3708 0.6089
## Cue_renamed (Intercept) 1.1382 1.0668
## Number of obs: 5941, groups: subject, 83; Cue_renamed, 72
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.5868 0.2848 -2.06 0.039370 *
## theme_ratio_E 1.4938 0.4161 3.59 0.000331 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## theme_rat_E -0.859
## English/Vietnamese comparison
mVE = glmer(responses_theme ~ theme_ratio_E + theme_ratio_V + (1 | subject) + (1 | Cue_renamed), data = data_model, family="binomial")
summary(mVE)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: responses_theme ~ theme_ratio_E + theme_ratio_V + (1 | subject) +
## (1 | Cue_renamed)
## Data: data_model
##
## AIC BIC logLik deviance df.resid
## 6893.5 6926.9 -3441.7 6883.5 5936
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5602 -0.7469 0.3535 0.6836 4.2713
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 0.3706 0.6088
## Cue_renamed (Intercept) 1.0586 1.0289
## Number of obs: 5941, groups: subject, 83; Cue_renamed, 72
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.5625 0.2760 -2.038 0.0416 *
## theme_ratio_E 0.7683 0.5259 1.461 0.1441
## theme_ratio_V 0.8210 0.3846 2.134 0.0328 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) thm__E
## theme_rat_E -0.680
## theme_rat_V 0.039 -0.644
Plot Model vs Data
require(ggrepel)
data_avg <- data_sum %>% #compute emp_theme_prop
select( -theme_resp_ratio_bysubj) %>%
group_by(Cue_renamed) %>%
summarize(emp_theme_prop = mean(responses_theme))
## `summarise()` ungrouping output (override with `.groups` argument)
corrE <- data_model %>%
ungroup() %>%
select(-subject) %>%
distinct(Cue_renamed, theme_ratio_E) %>%
left_join(data_avg, by="Cue_renamed") %>%
rename(triad=Cue_renamed) %>%
rename(Ecorpus_theme_prop=theme_ratio_E)
corrE %>% ggplot(aes(x=emp_theme_prop, y=Ecorpus_theme_prop, label = triad)) +
geom_text() +
#geom_label_repel() +
theme_classic() +
xlab("Proportion Thematic Chosen (VN)") +
ylab("Proportion Thematic Predicted (English)")
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(corrE$Ecorpus_theme_prop,corrE$emp_theme_prop, na.rm=T)
##
## Pearson's product-moment correlation
##
## data: corrE$Ecorpus_theme_prop and corrE$emp_theme_prop
## t = 3.7342, df = 70, p-value = 0.0003802
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.1942453 0.5840906
## sample estimates:
## cor
## 0.4075729
corrV <- data_model %>%
ungroup() %>%
select(-subject) %>%
distinct(Cue_renamed, theme_ratio_V) %>%
left_join(data_avg, by="Cue_renamed") %>%
rename(triad=Cue_renamed) %>%
rename(Vcorpus_theme_prop=theme_ratio_V)
corrV %>% ggplot(aes(x=emp_theme_prop, y=Vcorpus_theme_prop, label = triad)) +
geom_text() +
#geom_label_repel() +
theme_classic() +
xlab("Proportion Thematic Chosen (VN)") +
ylab("Proportion Thematic Predicted (Vietnamese)")

cor.test(corrV$Vcorpus_theme_prop,corrV$emp_theme_prop, na.rm=T)
##
## Pearson's product-moment correlation
##
## data: corrV$Vcorpus_theme_prop and corrV$emp_theme_prop
## t = 4.3077, df = 71, p-value = 5.205e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.2514652 0.6203029
## sample estimates:
## cor
## 0.4551975
data_model %>% ggplot(aes(x=theme_ratio_E, y=theme_ratio_V, label = Cue_renamed)) +
geom_text() +
#geom_label_repel() +
theme_classic() +
xlab("Proportion Thematic Predicted (English)") +
ylab("Proportion Thematic Predicted (Vietnamese)")
## Warning: Removed 83 rows containing missing values (geom_text).

cor.test(corrE$Ecorpus_theme_prop,corrV$Vcorpus_theme_prop, na.rm=T)
##
## Pearson's product-moment correlation
##
## data: corrE$Ecorpus_theme_prop and corrV$Vcorpus_theme_prop
## t = 7.0569, df = 70, p-value = 9.835e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.4856074 0.7625166
## sample estimates:
## cor
## 0.6447425