knitr::opts_chunk$set(warning =FALSE, message =FALSE, fig.width=10, fig.height=8) Mypackages <-c("lme4","tidyverse","effects","ggplot2","psych","MASS","Rmisc","lmerTest","ggthemes", "knitr","lsmeans","pastecs","sjstats","car","ordinal","Rcpp","corrplot", "ggpubr", "EnvStats","easyStats", "cowplot","see","datawizard", "ggcorrplot","corrplot", "effects", "patchwork" )# install.packages(Mypackages) #you must remove the # in this comment if you need to install the packages! lapply(Mypackages, require,character.only =TRUE)options(knitr.kable.NA ='—')set.seed(1)
Load Data
Code
# read in data filesgjg <-read.csv("/Users/mtrenfield17/Desktop/Research/Boston College Research/Joint Research/Institutional Signaling/Study 3/IVS Action.csv")
Functions
Code
plot_cooker <-function(data, iv, dv, title) { part1 <-ggplot(data, aes(x = {{iv}}, y = {{dv}}, fill = {{iv}})) +geom_violin(alpha =0.3, scale ="count") +stat_summary(fun ="mean", geom ="point", size =3, color ="black") +stat_summary(fun.data = mean_cl_normal, geom ="errorbar", width =0.2,#change to make a data set from allEffects with mean, low CI, high CIsize =1.5, color ="black") +theme_classic() +xlab("") +ylab("") +ggtitle(title)ggpar(part1, legend ="none")}wrapped_plot_cooker <-function(data, iv, dv, title, facet_var) { part1 <-ggplot(data, aes(x = {{iv}}, y = {{dv}}, fill = {{iv}})) +geom_violin(alpha =0.3, scale ="count") +stat_summary(fun ="mean", geom ="point", size =3, color ="black") +stat_summary(fun.data = mean_cl_normal, geom ="errorbar", width =0.2, size =1.5, color ="black") +theme_classic() +xlab("") +ylab("") +ggtitle(title) +facet_wrap(vars({{facet_var}}))ggpar(part1, legend ="none")}by_line <-function(data, iv, dv, x_label, y_label, color_label, plot_title) {ggplot(data, aes(x = {{iv}}, y = {{dv}}, color = condition)) +stat_summary(fun.data ="mean_cl_normal", geom ="line") +geom_point(position =position_jitter(width =0.1, height =0.1), alpha =0.2) +labs(x = x_label, y = y_label, color = color_label, title = plot_title)}
Reshaping data
Code
# making conservative, liberal, and moderate group gjg <- gjg %>%mutate(political_group =ifelse(pol <4, "Conservative",ifelse(pol >4, "Liberal", "Moderate")))# filtering people who failed the attn checkfiltered_gjg <- gjg %>%filter(attentionCheck ==3| attentionCheck ==7)# make dataset longgjg_long <- filtered_gjg %>%gather(stim, resp, "B_C_Chic_staticNorm_18":"C_C_Star_riskInact") gjg_long<-gjg_long %>%separate(stim, into=c("social_issue", "action", "company", "DV"), sep="_")# shift dataset back to wide formatgjg_long <-spread(gjg_long, DV, resp)names(gjg_long) # check if i got the right columns
# make numeric vars numericgjg_long <- gjg_long %>%mutate_at(c("dyNorm", "noisyMin", "OComp", "OLike", "OMotivate", "OTrust", "peerPress", "Profit", "pubPress", "Rep", "riskInact", "SComp", "SGen", "SImport", "SLike", "SRelImport", "staticNorm", "STrust", "surprise","post_Real_Check", "age", "pid", "area", "pol", "edu", "gen", "inc"), as.numeric)# make a column for company's perceived political leaning gjg_long <- gjg_long %>%mutate(companyLeaning =case_when( company =="Bud"~"R", company =="CAR"~"R", company =="Chic"~"R", company =="Dis"~"L", company =="Pop"~"L", company =="Star"~"L", company =="Tar"~"L", company =="Wal"~"R", company =="Fox"~"R", company =="NBC"~"L", company =="WNBA"~"L", company =="NBA"~"L", company =="NFL"~"R",TRUE~ company # if none of the above conditions are met, keep the original value ))# check that I didnt miss any companiesunique_companyLeaning <-unique(gjg_long$companyLeaning)print(unique_companyLeaning)
[1] "R" "L"
Code
# creating a condition (pol lean + consistency) columngjg_long$condition <-paste0(gjg_long$companyLeaning, gjg_long$action)gjg_long <- gjg_long %>%mutate(condition =case_when( condition =="LC"~"Liberal \n\ Consistent", condition =="LI"~"Liberal \n\ Inconsistent", condition =="RC"~"Conservative \n\ Consistent", condition =="RI"~"Conservative \n\ Inconsistent",TRUE~ condition # if none of the above conditions are met, keep the original value ))# Renaming variablesgjg_long <- gjg_long %>%mutate(companyLeaning =case_when( companyLeaning =="R"~"Right", companyLeaning =="L"~"Left",TRUE~ companyLeaning # if none of the above conditions are met, keep the original value ))gjg_long <- gjg_long %>%mutate(company =case_when( company =="Bud"~"Budweiser", company =="CAR"~"NASCAR", company =="Chic"~"Chick-fil-A", company =="Dis"~"Disney", company =="Pop"~"Popeyes", company =="Star"~"Starbucks", company =="Tar"~"Target", company =="Wal"~"Walmart",TRUE~ company # if none of the above conditions are met, keep the original value ))gjg_long$signal <-as.factor(gjg_long$action)gjg_long <- gjg_long %>%mutate(signal =case_when( action =="C"~"Consistent", action =="I"~"Inconsistent",TRUE~ signal # if none of the above conditions are met, keep the original value ))gjg_long$social_issue <-as.factor(gjg_long$social_issue)gjg_long <- gjg_long %>%mutate(social_issue =case_when( social_issue =="T"~"Transgendered Representation", social_issue =="C"~"Climate Change", social_issue =="L"~"LGBTQ Representation", social_issue =="B"~"BLM",TRUE~ social_issue # if none of the above conditions are met, keep the original value ))## filter out rows for condition-vignette pairs people DON'T seegjg_long <- gjg_long %>%filter(is.na(dyNorm) ==FALSE)
Attention Check
Code
gjg %>%group_by(consent) %>% dplyr::summarise(n =n()) %>%mutate(freq = n /sum(n))gjg %>%group_by(attentionCheck) %>% dplyr::summarise(n =n()) %>%mutate(freq = n /sum(n))
22 people did not accept the consent 2/801 people failed the attention check.
Demographics
Code
# Subset your data frame to include only the demographic columnsdemo_gjg <- gjg[, c("gen_TEXT", "race_TEXT", "inc_TEXT", "edu_TEXT", "pol_TEXT", "pid_TEXT", "area_TEXT", "political_group")]# Agemean(gjg$age, na.rm=TRUE)
[1] 42.80025
Code
sd(gjg$age, na.rm=TRUE)
[1] 14.16845
Code
# Loop through each demographic column and calculate frequency countsfreq_tables <-list()for (col innames(demo_gjg)) { { freq_table <-as.data.frame(table(demo_gjg[[col]])) freq_table$Percent <-round(freq_table$Freq /sum(freq_table$Freq) *100, 2) freq_tables[[col]] <- freq_table }}# Print the frequency tablesfor (i inseq_along(freq_tables)) {if (!is.null(freq_tables[[i]])) {cat("\nTable of frequencies for", names(freq_tables)[i], ":\n")print(freq_tables[[i]]) }}
Table of frequencies for gen_TEXT :
Var1 Freq Percent
1 22 2.67
2 I identify as: 13 1.58
3 Man 396 48.12
4 Woman 392 47.63
Table of frequencies for race_TEXT :
Var1
1
2 American Indian and Native Alaskan
3 American Indian and Native Alaskan,Black
4 American Indian and Native Alaskan,Black,East Asian,South Asian,Southeast Asian,Pacific Islander or Native Hawaiian,Hispanic or Latino/a/x,Middle Eastern and North African,White
5 American Indian and Native Alaskan,Black,Hispanic or Latino/a/x
6 American Indian and Native Alaskan,Black,White
7 American Indian and Native Alaskan,Hispanic or Latino/a/x
8 American Indian and Native Alaskan,White
9 Black
10 Black,East Asian,Hispanic or Latino/a/x,White
11 Black,Hispanic or Latino/a/x,White
12 Black,White
13 East Asian
14 East Asian,Middle Eastern and North African
15 East Asian,Southeast Asian
16 East Asian,White
17 Hispanic or Latino/a/x
18 Hispanic or Latino/a/x,White
19 Middle Eastern and North African
20 Middle Eastern and North African,White
21 South Asian
22 South Asian,Pacific Islander or Native Hawaiian,White
23 Southeast Asian
24 Southeast Asian,Pacific Islander or Native Hawaiian,White
25 Southeast Asian,White
26 White
Freq Percent
1 22 2.67
2 1 0.12
3 2 0.24
4 1 0.12
5 1 0.12
6 3 0.36
7 1 0.12
8 8 0.97
9 64 7.78
10 1 0.12
11 3 0.36
12 8 0.97
13 22 2.67
14 2 0.24
15 1 0.12
16 7 0.85
17 27 3.28
18 20 2.43
19 3 0.36
20 3 0.36
21 9 1.09
22 1 0.12
23 12 1.46
24 1 0.12
25 4 0.49
26 596 72.42
Table of frequencies for inc_TEXT :
Var1 Freq Percent
1 22 2.67
2 $100,000 - $149,999 107 13.00
3 $150,000 - $199,999 46 5.59
4 $25,000 - $49,999 205 24.91
5 $50,000 - $74,999 165 20.05
6 $75,000 - $99,999 131 15.92
7 less than $25,000 128 15.55
8 more than $200,000 19 2.31
Table of frequencies for edu_TEXT :
Var1 Freq Percent
1 22 2.67
2 Bachelor's degree 279 33.90
3 Graduate degree (Masters, PhD, etc) 111 13.49
4 High school diploma or GED 136 16.52
5 Some college, Technical degree, or Associates degree 271 32.93
6 Some schooling, but no high school diploma or degree 4 0.49
Table of frequencies for pol_TEXT :
Var1 Freq Percent
1 22 2.67
2 Conservative 142 17.25
3 Liberal 110 13.37
4 Moderate 187 22.72
5 Somewhat Conservative 92 11.18
6 Somewhat Liberal 94 11.42
7 Very Conservative 65 7.90
8 Very Liberal 111 13.49
Table of frequencies for pid_TEXT :
Var1 Freq Percent
1 22 2.67
2 Democrat 298 36.21
3 Independent / Other 255 30.98
4 Republican 248 30.13
Table of frequencies for area_TEXT :
Var1 Freq Percent
1 22 2.67
2 Rural 157 19.08
3 Suburban 439 53.34
4 Urban 205 24.91
Table of frequencies for political_group :
Var1 Freq Percent
1 Conservative 299 37.33
2 Liberal 315 39.33
3 Moderate 187 23.35
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: otherCompany ~ companyLeaning * action * pol + (1 | participantID) +
(1 | social_issue)
Data: gjg_long
REML criterion at convergence: 9773.6
Scaled residuals:
Min 1Q Median 3Q Max
-3.9706 -0.4321 0.1230 0.5549 3.4688
Random effects:
Groups Name Variance Std.Dev.
participantID (Intercept) 0.547082 0.73965
social_issue (Intercept) 0.008374 0.09151
Residual 0.905127 0.95138
Number of obs: 3196, groups: participantID, 799; social_issue, 4
Fixed effects:
Estimate Std. Error df t value
(Intercept) 4.865e+00 1.128e-01 8.336e+01 43.112
companyLeaningRight -2.730e-01 1.153e-01 2.389e+03 -2.369
actionI -1.165e-01 1.154e-01 2.390e+03 -1.009
pol 1.049e-01 2.293e-02 2.238e+03 4.574
companyLeaningRight:actionI 6.998e-02 1.632e-01 2.390e+03 0.429
companyLeaningRight:pol -8.657e-03 2.563e-02 2.389e+03 -0.338
actionI:pol -6.882e-03 2.560e-02 2.388e+03 -0.269
companyLeaningRight:actionI:pol -2.559e-02 3.624e-02 2.389e+03 -0.706
Pr(>|t|)
(Intercept) < 2e-16 ***
companyLeaningRight 0.0179 *
actionI 0.3130
pol 5.04e-06 ***
companyLeaningRight:actionI 0.6682
companyLeaningRight:pol 0.7356
actionI:pol 0.7881
companyLeaningRight:actionI:pol 0.4801
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) cmpnLR actinI pol cmLR:I cmpLR: actnI:
cmpnyLnngRg -0.511
actionI -0.510 0.501
pol -0.832 0.509 0.509
cmpnyLnnR:I 0.361 -0.707 -0.708 -0.360
cmpnyLnngR: 0.465 -0.911 -0.457 -0.559 0.644
actionI:pol 0.465 -0.456 -0.910 -0.558 0.644 0.500
cmpnyLnR:I: -0.329 0.644 0.644 0.395 -0.910 -0.707 -0.708
Combining self + other perception plot
Code
# # Code to combine self + other perception plot# library(patchwork)# selfCompanyP + otherCompanyP + plot_layout(guides = 'collect')# # # Adjust the titles to make sure they fit# selfCompanyP_patch <- selfCompanyP + # labs(title = "My Perception of the Company is Positive") + # theme(plot.margin = margin(1, 1, 1, 1, "lines")) # Increase the top margin# # otherCompanyP_patch <- otherCompanyP + # labs(title = "Others' Perception of the Company is Positive") +# theme(plot.margin = margin(1, 1, 1, 1, "lines"),# axis.title.y = element_blank(), # Remove y-axis title# axis.ticks.y = element_blank(), # Remove y-axis ticks# axis.text.y = element_blank()) # Remove y-axis text# # # Combine the plots with patchwork, adjusting the layout# combinedPlot <- selfCompanyP_patch + otherCompanyP_patch + plot_layout(guides = 'collect')# # # Print the combined plot# print(combinedPlot)
Genuine
Main Plot
Composite
7 point agreement scale
Code
genP <-ggplot(gjg_long, aes(x = companyLeaning, y = SGen, color = action)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +# Increased point sizestat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +# Increased error bar sizegeom_hline(yintercept =4, linetype ="dashed", color ="black", size = .7, alpha =0.4) +scale_x_discrete(labels =c("Liberal", "Conservative")) +scale_color_manual(values =c("I"="#B550B5", "C"="#00C957"),labels =c("Consistent", "Inconsistent"),name ="Company Political Leaning \n\ & Action Consistency") +labs(x ="Company Political Leaning", y ="How much does the company genuinely care", title ="Perception of the Authenticity of the Company's Support" ) +theme_minimal(base_size =15) +theme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =20, color ="black"),axis.text.y =element_text(face ="plain", size =20, color ="black"),axis.title.y =element_text(face ="plain", size =22, color ="black"), axis.title.x =element_text(face ="plain", size =22, color ="black"),legend.position ="bottom",legend.title =element_text(size =22), # Adjusted legend title sizelegend.text =element_text(size =20), # Adjusted legend text sizepanel.grid.major =element_line(color ="gray"),panel.grid.minor =element_blank(),panel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +geom_signif(annotation ="***", y_position =5.75, xmin =1, xmax =2,size =1.5,color ="black",textsize =10# Increased text size for asterisks ) +geom_signif(annotation ="***", y_position =5.1, # Adjust y position if neededxmin = .9, xmax =1.05,size =1.5, # Increased size for significance annotation linecolor ="black",textsize =10# Increased text size for asterisks ) +geom_signif(annotation ="***", y_position =4.5, # Adjust y position if neededxmin =1.9, xmax =2.05,size =1.5, # Increased size for significance annotation linecolor ="black",textsize =10# Increased text size for asterisks ) +coord_cartesian(ylim =c(1, 7)) +# Adjusted y limits to match scale_y_continuousscale_y_continuous(breaks =c(1, 2, 3, 4, 5, 6, 7), labels =c("-3","-2", "-1", "0", "1", "2", "3"))# Print the plotprint(genP)
Plot by Pol Group
Composite
7 point agreement scale
Code
genP_polGroup <-ggplot(gjg_long, aes(x = companyLeaning, y = SGen, color = action)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +# Increased point sizestat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +# Increased error bar sizegeom_hline(yintercept =4, linetype ="dashed", color ="black", size = .7, alpha =0.4) +scale_x_discrete(labels =c("Liberal", "Conservative")) +scale_color_manual(values =c("I"="#B550B5", "C"="#00C957"),labels =c("Consistent", "Inconsistent"),name ="Company Political Leaning \n\ & Action Consistency") +labs(x ="Company Political Leaning", y ="How much does the company genuinely care", title ="Perception of the Authenticity of the Company's Support" ) +theme_minimal(base_size =15) +theme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =20, color ="black"),axis.text.y =element_text(face ="plain", size =20, color ="black"),axis.title.y =element_text(face ="plain", size =22, color ="black"), axis.title.x =element_text(face ="plain", size =22, color ="black"),legend.position ="bottom",legend.title =element_text(size =22), # Adjusted legend title sizelegend.text =element_text(size =20), # Adjusted legend text sizepanel.grid.major =element_line(color ="gray"),panel.grid.minor =element_blank(),panel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("political_group") +coord_cartesian(ylim =c(1, 7)) +# Adjusted y limits to match scale_y_continuousscale_y_continuous(breaks =c(1, 2, 3, 4, 5, 6, 7), labels =c("-3","-2", "-1", "0", "1", "2", "3"))# Print the plotprint(genP_polGroup)
Line by Pol
Code
ggplot(gjg_long, aes(x = pol, y = SGen, color = condition)) +stat_summary(fun.data ="mean_cl_normal", geom ="line") +geom_hline(yintercept =4, linetype ="dashed", color ="black", size = .7, alpha =0.4) +# geom_point(position = position_jitter(width = 0.1, height = 0.1), alpha = 0.2) +labs(x ="Participant Political Leaning \n\ (Conservative to Liberal)", y ="How much does the company genuinely care", color ="Company Political Leaning \n\ & Action Consistency", title ="Perception of the Authenticity of the Company's Support") +labs(x ="Company Political Leaning", y ="Motive Selflessness", title ="Motive Authenticity" ) +coord_cartesian(ylim =c(1, 7)) +scale_y_continuous(breaks =c(1,2,3,4,5,6,7))
Stats
main effect of company leaning, action consistency, and participant political leaning
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: SGen ~ companyLeaning * action * pol + (1 | participantID) +
(1 | social_issue)
Data: gjg_long
REML criterion at convergence: 11924.6
Scaled residuals:
Min 1Q Median 3Q Max
-3.4258 -0.6212 -0.0327 0.6527 2.9417
Random effects:
Groups Name Variance Std.Dev.
participantID (Intercept) 1.07639 1.0375
social_issue (Intercept) 0.03217 0.1794
Residual 1.77516 1.3324
Number of obs: 3196, groups: participantID, 799; social_issue, 4
Fixed effects:
Estimate Std. Error df t value
(Intercept) 3.85230 0.17010 33.56429 22.647
companyLeaningRight -0.14739 0.16145 2388.95382 -0.913
actionI -0.15301 0.16166 2389.98890 -0.946
pol 0.18126 0.03213 2235.91926 5.641
companyLeaningRight:actionI 0.07983 0.22863 2389.91045 0.349
companyLeaningRight:pol -0.16118 0.03590 2389.17495 -4.490
actionI:pol -0.18173 0.03586 2388.37006 -5.068
companyLeaningRight:actionI:pol -0.02525 0.05076 2388.99154 -0.497
Pr(>|t|)
(Intercept) < 2e-16 ***
companyLeaningRight 0.361
actionI 0.344
pol 1.90e-08 ***
companyLeaningRight:actionI 0.727
companyLeaningRight:pol 7.46e-06 ***
actionI:pol 4.32e-07 ***
companyLeaningRight:actionI:pol 0.619
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) cmpnLR actinI pol cmLR:I cmpLR: actnI:
cmpnyLnngRg -0.475
actionI -0.474 0.501
pol -0.774 0.509 0.508
cmpnyLnnR:I 0.336 -0.707 -0.709 -0.360
cmpnyLnngR: 0.432 -0.911 -0.457 -0.559 0.645
actionI:pol 0.432 -0.456 -0.910 -0.558 0.644 0.500
cmpnyLnR:I: -0.306 0.644 0.644 0.395 -0.910 -0.707 -0.708
Motive Authenticity
Main Plot
Composite
7 point agreement scale
Code
gjg_long <- gjg_long %>%mutate(reverseExternalMotive =7-externalMotive) # reversing external motive scale so selfish is negativeexternalP <-ggplot(gjg_long, aes(x = companyLeaning, y = reverseExternalMotive, color = action)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +# Increased point sizestat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +# Increased error bar sizegeom_hline(yintercept =4, linetype ="dashed", color ="black", size = .7, alpha =0.4) +scale_x_discrete(labels =c("Liberal", "Conservative")) +scale_color_manual(values =c("I"="#B550B5", "C"="#00C957"),labels =c("Consistent", "Inconsistent"),name ="Company Political Leaning \n\ & Action Consistency") +labs(x ="Company Political Leaning", y ="Motive Selflessness", title ="Motive Authenticity" ) +theme_minimal(base_size =15) +theme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =20, color ="black"),axis.text.y =element_text(face ="plain", size =20, color ="black"),axis.title.y =element_text(face ="plain", size =22, color ="black"), axis.title.x =element_text(face ="plain", size =22, color ="black"),legend.position ="bottom",legend.title =element_text(size =22), # Adjusted legend title sizelegend.text =element_text(size =20), # Adjusted legend text sizepanel.grid.major =element_line(color ="gray"),panel.grid.minor =element_blank(),panel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +geom_signif(annotation ="***", y_position =3.75, xmin =1, xmax =2,size =1.5,color ="black",textsize =10# Increased text size for asterisks ) +geom_signif(annotation ="***", y_position =3.2, # Adjust y position if neededxmin = .9, xmax =1.05,size =1.5, # Increased size for significance annotation linecolor ="black",textsize =10# Increased text size for asterisks ) +geom_signif(annotation ="***", y_position =3, # Adjust y position if neededxmin =1.9, xmax =2.05,size =1.5, # Increased size for significance annotation linecolor ="black",textsize =10# Increased text size for asterisks ) +coord_cartesian(ylim =c(1, 7)) +# Adjusted y limits to match scale_y_continuousscale_y_continuous(breaks =c(1, 2, 3, 4, 5, 6, 7), labels =c("-3","-2", "-1", "0", "1", "2", "3"))# Print the plotprint(externalP)
Plot by Pol Group
Composite
7 point agreement scale
Code
externalP <-ggplot(gjg_long, aes(x = companyLeaning, y = reverseExternalMotive, color = action)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +# Increased point sizestat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +# Increased error bar sizegeom_hline(yintercept =4, linetype ="dashed", color ="black", size = .7, alpha =0.4) +scale_x_discrete(labels =c("Liberal", "Conservative")) +scale_color_manual(values =c("I"="#B550B5", "C"="#00C957"),labels =c("Consistent", "Inconsistent"),name ="Company Political Leaning \n\ & Action Consistency") +labs(x ="Company Political Leaning", y ="Motive Selflessness", title ="Motive Authenticity" ) +theme_minimal(base_size =15) +theme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =20, color ="black"),axis.text.y =element_text(face ="plain", size =20, color ="black"),axis.title.y =element_text(face ="plain", size =22, color ="black"), axis.title.x =element_text(face ="plain", size =22, color ="black"),legend.position ="bottom",legend.title =element_text(size =22), # Adjusted legend title sizelegend.text =element_text(size =20), # Adjusted legend text sizepanel.grid.major =element_line(color ="gray"),panel.grid.minor =element_blank(),panel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("political_group") +coord_cartesian(ylim =c(1, 7)) +# Adjusted y limits to match scale_y_continuousscale_y_continuous(breaks =c(1, 2, 3, 4, 5, 6, 7), labels =c("-3","-2", "-1", "0", "1", "2", "3"))# Print the plotprint(externalP)
Line by Pol
Code
ggplot(gjg_long, aes(x = pol, y = reverseExternalMotive, color = condition)) +stat_summary(fun.data ="mean_cl_normal", geom ="line") +geom_hline(yintercept =4, linetype ="dashed", color ="black", size = .7, alpha =0.4) +# geom_point(position = position_jitter(width = 0.1, height = 0.1), alpha = 0.2) +labs(x ="Participant Political Leaning \n\ (Conservative to Liberal)", y ="Perception of the Company", color ="Company Political Leaning \n\ & Action Consistency", title ="Participants' Perception of Others' Afinity for the Company") +labs(x ="Company Political Leaning", y ="Motive Selflessness", title ="Motive Authenticity" ) +coord_cartesian(ylim =c(1, 7)) +scale_y_continuous(breaks =c(1,2,3,4,5,6,7))
Stats
main effect of company leaning, action consistency, and participant political leaning
interaction between ’s perceived political leaning matters to libs and mods
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: surprise ~ companyLeaning * action * pol + (1 | participantID) +
(1 | social_issue)
Data: gjg_long
REML criterion at convergence: 12315.9
Scaled residuals:
Min 1Q Median 3Q Max
-2.57341 -0.70402 -0.05233 0.69644 2.84240
Random effects:
Groups Name Variance Std.Dev.
participantID (Intercept) 0.8388 0.9159
social_issue (Intercept) 0.1065 0.3263
Residual 2.4920 1.5786
Number of obs: 3096, groups: participantID, 799; social_issue, 4
Fixed effects:
Estimate Std. Error df t value
(Intercept) 3.329e+00 2.259e-01 1.027e+01 14.738
companyLeaningRight 6.414e-01 1.991e-01 2.334e+03 3.222
actionI 4.545e-03 1.916e-01 2.289e+03 0.024
pol -6.967e-02 3.473e-02 2.609e+03 -2.006
companyLeaningRight:actionI -1.266e-02 2.769e-01 2.315e+03 -0.046
companyLeaningRight:pol 1.832e-01 4.429e-02 2.333e+03 4.137
actionI:pol 2.844e-02 4.249e-02 2.288e+03 0.669
companyLeaningRight:actionI:pol 4.931e-04 6.139e-02 2.311e+03 0.008
Pr(>|t|)
(Intercept) 3.07e-08 ***
companyLeaningRight 0.00129 **
actionI 0.98108
pol 0.04496 *
companyLeaningRight:actionI 0.96354
companyLeaningRight:pol 3.64e-05 ***
actionI:pol 0.50337
companyLeaningRight:actionI:pol 0.99359
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) cmpnLR actinI pol cmLR:I cmpLR: actnI:
cmpnyLnngRg -0.408
actionI -0.423 0.485
pol -0.630 0.537 0.557
cmpnyLnnR:I 0.294 -0.722 -0.696 -0.387
cmpnyLnngR: 0.370 -0.910 -0.438 -0.588 0.655
actionI:pol 0.385 -0.439 -0.909 -0.612 0.631 0.480
cmpnyLnR:I: -0.267 0.657 0.631 0.424 -0.909 -0.721 -0.693
Motivates Others to Act
Main Plot
Code
motivateP <-ggplot(gjg_long, aes(x = companyLeaning, y = OMotivate, color = action)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +# Increased point sizestat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +# Increased error bar sizegeom_hline(yintercept =4, linetype ="dashed", color ="black", size = .7, alpha =0.4) +scale_x_discrete(labels =c("Liberal", "Conservative")) +scale_y_continuous(breaks =c(1, 2, 3, 4, 5, 6, 7), labels =c("-3","-2","-1", "0", "1", "2", "3"), ) +scale_color_manual(values =c("I"="#B550B5", "C"="#00C957"),labels =c("Consistent", "Inconsistent"),name ="Action") +labs(x ="Condition", y ="This post motivates support from others (Agreement)", title ="Surprise at Post" ) +theme_minimal(base_size =15) +theme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =20, color ="black"),axis.text.y =element_text(face ="plain", size =20, color ="black"),axis.title.y =element_text(face ="plain", size =22, color ="black"), axis.title.x =element_text(face ="plain", size =22, color ="black"),legend.position ="bottom",legend.title =element_text(size =22), # Adjusted legend title sizelegend.text =element_text(size =20), # Adjusted legend text sizepanel.grid.major =element_line(color ="gray"),panel.grid.minor =element_blank(),panel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +geom_signif(annotation ="***", y_position =6, xmin =1, xmax =2,size =1.5,color ="black",textsize =10# Increased text size for asterisks ) +geom_signif(annotation ="***", y_position =5.4, # Adjust y position if neededxmin = .9, xmax =1.05,size =1.5, # Increased size for significance annotation linecolor ="black",textsize =10# Increased text size for asterisks ) +geom_signif(annotation ="***", y_position =5.2, # Adjust y position if neededxmin =1.9, xmax =2.05,size =1.5, # Increased size for significance annotation linecolor ="black",textsize =10# Increased text size for asterisks ) +coord_cartesian(ylim =c(1, 7)) # Adjusted y limits to match scale_y_continuous# Print the plotprint(motivateP)
Plot by Pol Group
Composite
7 point agreement scale
Code
motivateP_polGroup <-ggplot(gjg_long, aes(x = companyLeaning, y = OMotivate, color = action)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +# Increased point sizestat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +# Increased error bar sizegeom_hline(yintercept =4, linetype ="dashed", color ="black", size = .7, alpha =0.4) +scale_x_discrete(labels =c("Liberal", "Conservative")) +scale_y_continuous(breaks =c(1, 2, 3, 4, 5, 6, 7), labels =c("-3","-2","-1", "0", "1", "2", "3"), ) +scale_color_manual(values =c("I"="#B550B5", "C"="#00C957"),labels =c("Consistent", "Inconsistent"),name ="Company Political Leaning \n\ & Action Consistency") +labs(x ="Condition", y ="Belief that the post motivates support from others", title ="" ) +theme_minimal(base_size =15) +theme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =20, color ="black"),axis.text.y =element_text(face ="plain", size =20, color ="black"),axis.title.y =element_text(face ="plain", size =22, color ="black"), axis.title.x =element_text(face ="plain", size =22, color ="black"),legend.position ="bottom",legend.title =element_text(size =22), # Adjusted legend title sizelegend.text =element_text(size =20), # Adjusted legend text sizepanel.grid.major =element_line(color ="gray"),panel.grid.minor =element_blank(),panel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("political_group") +coord_cartesian(ylim =c(1, 7)) # Adjusted y limits to match scale_y_continuous# Print the plotprint(motivateP_polGroup)
Line by Pol
Code
ggplot(gjg_long, aes(x = pol, y = OMotivate, color = condition)) +stat_summary(fun.data ="mean_cl_normal", geom ="line") +geom_hline(yintercept =4, linetype ="dashed", color ="black", size = .7, alpha =0.4) +# geom_point(position = position_jitter(width = 0.1, height = 0.1), alpha = 0.2) +labs(x ="Participant Political Leaning \n\ (Conservative to Liberal)", y ="Belief that the post motivates support from others", color ="Company Political Leaning \n\ & Action Consistency", title ="Belief that the post motivates support from others") +coord_cartesian(ylim =c(1, 7)) +scale_y_continuous(breaks =c(1,2,3,4,5,6,7))
Static Norm
Main Plot
Code
staticP <-ggplot(gjg_long, aes(x = companyLeaning, y = staticNorm, color = action)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +# Increased point sizestat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +# Increased error bar sizescale_x_discrete(labels =c("Liberal", "Conservative")) +scale_y_continuous(breaks =c(25, 50, 75, 100) ) +scale_color_manual(values =c("I"="#B550B5", "C"="#00C957"),labels =c("Consistent", "Inconsistent"),name ="Company Political Leaning \n\ & Action Consistency") +labs(x ="Condition", y ="Percent of Americans that support the cause", title ="Participant Perception of Social Cause Support" ) +theme_minimal(base_size =15) +theme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =20, color ="black"),axis.text.y =element_text(face ="plain", size =20, color ="black"),axis.title.y =element_text(face ="plain", size =22, color ="black"), axis.title.x =element_text(face ="plain", size =22, color ="black"),legend.position ="bottom",legend.title =element_text(size =22), # Adjusted legend title sizelegend.text =element_text(size =20), # Adjusted legend text sizepanel.grid.major =element_line(color ="gray"),panel.grid.minor =element_blank(),panel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(1, 100)) # Adjusted y limits to match scale_y_continuous# Print the plotprint(staticP)
Plot by Pol Group
Composite
7 point agreement scale
Code
staticP_polGroup <-ggplot(gjg_long, aes(x = companyLeaning, y = staticNorm, color = action)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +# Increased point sizestat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +# Increased error bar sizescale_x_discrete(labels =c("Liberal", "Conservative")) +scale_y_continuous(breaks =c(25, 50, 75, 100) ) +scale_color_manual(values =c("I"="#B550B5", "C"="#00C957"),labels =c("Consistent", "Inconsistent"),name ="Company Political Leaning \n\ & Action Consistency") +labs(x ="Condition", y ="Percent of Americans that support the cause", title ="Participant Perception of Social Cause Support" ) +theme_minimal(base_size =15) +theme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =20, color ="black"),axis.text.y =element_text(face ="plain", size =20, color ="black"),axis.title.y =element_text(face ="plain", size =22, color ="black"), axis.title.x =element_text(face ="plain", size =22, color ="black"),legend.position ="bottom",legend.title =element_text(size =22), # Adjusted legend title sizelegend.text =element_text(size =20), # Adjusted legend text sizepanel.grid.major =element_line(color ="gray"),panel.grid.minor =element_blank(),panel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("political_group") +coord_cartesian(ylim =c(1, 100)) # Adjusted y limits to match scale_y_continuous# Print the plotprint(staticP_polGroup)
Line by Pol
Code
ggplot(gjg_long, aes(x = pol, y = staticNorm, color = condition)) +stat_summary(fun.data ="mean_cl_normal", geom ="line") +# geom_point(position = position_jitter(width = 0.1, height = 0.1), alpha = 0.2) +labs(x ="Participant Political Leaning \n\ (Conservative to Liberal)", y ="Belief that the post motivates support from others", color ="Company Political Leaning \n\ & Action Consistency", title ="Belief that the post motivates support from others") +coord_cartesian(ylim =c(1, 100)) +scale_y_continuous(breaks =c(25, 50, 75, 100))
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: staticNorm ~ companyLeaning * action * pol + (1 | participantID) +
(1 | social_issue)
Data: gjg_long
REML criterion at convergence: 27198.2
Scaled residuals:
Min 1Q Median 3Q Max
-3.9494 -0.5602 0.0058 0.5442 3.5589
Random effects:
Groups Name Variance Std.Dev.
participantID (Intercept) 142.6 11.94
social_issue (Intercept) 106.0 10.30
Residual 208.5 14.44
Number of obs: 3196, groups: participantID, 799; social_issue, 4
Fixed effects:
Estimate Std. Error df t value
(Intercept) 44.61798 5.39253 3.59294 8.274
companyLeaningRight -0.75647 1.75011 2387.56081 -0.432
actionI 1.48128 1.75255 2387.85831 0.845
pol 2.79111 0.35655 2134.93112 7.828
companyLeaningRight:actionI -1.16276 2.47861 2387.76020 -0.469
companyLeaningRight:pol 0.15019 0.38914 2387.59822 0.386
actionI:pol -0.18941 0.38866 2387.43777 -0.487
companyLeaningRight:actionI:pol -0.02291 0.55021 2387.49127 -0.042
Pr(>|t|)
(Intercept) 0.00183 **
companyLeaningRight 0.66560
actionI 0.39808
pol 7.73e-15 ***
companyLeaningRight:actionI 0.63903
companyLeaningRight:pol 0.69957
actionI:pol 0.62605
companyLeaningRight:actionI:pol 0.96679
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) cmpnLR actinI pol cmLR:I cmpLR: actnI:
cmpnyLnngRg -0.162
actionI -0.162 0.501
pol -0.271 0.497 0.497
cmpnyLnnR:I 0.115 -0.707 -0.709 -0.352
cmpnyLnngR: 0.148 -0.911 -0.457 -0.546 0.645
actionI:pol 0.148 -0.456 -0.909 -0.545 0.644 0.500
cmpnyLnR:I: -0.104 0.644 0.644 0.386 -0.910 -0.707 -0.708
Dynamic Norm
Main Plot
Code
dyP <-ggplot(gjg_long, aes(x = companyLeaning, y = dyNorm, color = action)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +# Increased point sizestat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +# Increased error bar sizegeom_hline(yintercept =4, linetype ="dashed", color ="black", size = .7, alpha =0.4) +scale_x_discrete(labels =c("Liberal", "Conservative")) +scale_y_continuous(breaks =c(1, 2, 3, 4, 5, 6, 7), labels =c("-3","-2","-1", "0", "1", "2", "3"), ) +scale_color_manual(values =c("I"="#B550B5", "C"="#00C957"),labels =c("Consistent", "Inconsistent"),name ="Action") +labs(x ="Condition", y ="Rate at which support is changing", title ="Perception of Norm Change" ) +theme_minimal(base_size =15) +theme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =20, color ="black"),axis.text.y =element_text(face ="plain", size =20, color ="black"),axis.title.y =element_text(face ="plain", size =22, color ="black"), axis.title.x =element_text(face ="plain", size =22, color ="black"),legend.position ="bottom",legend.title =element_text(size =22), # Adjusted legend title sizelegend.text =element_text(size =20), # Adjusted legend text sizepanel.grid.major =element_line(color ="gray"),panel.grid.minor =element_blank(),panel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(1, 7)) # Adjusted y limits to match scale_y_continuous# Print the plotprint(dyP)
Plot by Pol Group
Composite
7 point agreement scale
Code
dyP_polGroup <-ggplot(gjg_long, aes(x = companyLeaning, y = dyNorm, color = action)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +# Increased point sizestat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +# Increased error bar sizegeom_hline(yintercept =4, linetype ="dashed", color ="black", size = .7, alpha =0.4) +scale_x_discrete(labels =c("Liberal", "Conservative")) +scale_y_continuous(breaks =c(1, 2, 3, 4, 5, 6, 7), labels =c("-3","-2","-1", "0", "1", "2", "3"), ) +scale_color_manual(values =c("I"="#B550B5", "C"="#00C957"),labels =c("Consistent", "Inconsistent"),name ="Company Political Leaning \n\ & Action Consistency") +labs(x ="Condition", y ="Rate at which support is changing", title ="Perception of Norm Change" ) +theme_minimal(base_size =15) +theme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =20, color ="black"),axis.text.y =element_text(face ="plain", size =20, color ="black"),axis.title.y =element_text(face ="plain", size =22, color ="black"), axis.title.x =element_text(face ="plain", size =22, color ="black"),legend.position ="bottom",legend.title =element_text(size =22), # Adjusted legend title sizelegend.text =element_text(size =20), # Adjusted legend text sizepanel.grid.major =element_line(color ="gray"),panel.grid.minor =element_blank(),panel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("political_group") +coord_cartesian(ylim =c(1, 7)) # Adjusted y limits to match scale_y_continuous# Print the plotprint(dyP_polGroup)
Line by Pol
Code
ggplot(gjg_long, aes(x = pol, y = dyNorm, color = condition)) +stat_summary(fun.data ="mean_cl_normal", geom ="line") +geom_hline(yintercept =4, linetype ="dashed", color ="black", size = .7, alpha =0.4) +# geom_point(position = position_jitter(width = 0.1, height = 0.1), alpha = 0.2) +labs(x ="Participant Political Leaning \n\ (Conservative to Liberal)", y ="Belief that the post motivates support from others", color ="Company Political Leaning \n\ & Action Consistency", title ="Belief that the post motivates support from others") +coord_cartesian(ylim =c(1, 7)) +scale_y_continuous(breaks =c(1,2,3,4,5,6,7))