knitr::opts_chunk$set(warning = FALSE, message = FALSE)
Mypackages <-
c("lme4","tidyverse","effects","ggplot2","psych",
"MASS","Rmisc","lmerTest","ggthemes", "knitr",
"lsmeans","pastecs","sjstats","car","ordinal",
"Rcpp","corrplot", "ggpubr", "EnvStats", "datawizard",
"easyStats", "cowplot")
#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)
# read in data files
setwd("~/Desktop")
gjg <-read.csv("/Users/mtrenfield17/Desktop/generosity_justice_pilot_RENAMED.csv")
plot_cooker <- function(dv, iv, Title, x_axis_labs, y_label, sample_size) {
part1 <- ggviolin(gjg_wide, x = dv, y = iv, color = dv,
alpha = 0.1, fill = dv, xlab = "Motive",
trim = TRUE, ylab = y_label) +
stat_summary(fun.data = "mean_cl_normal", geom = "crossbar", fatten = 1) +
scale_y_continuous(breaks = c(1:7)) +
labs(title = paste0(Title, " (n = ", sample_size, ")")) +
scale_x_discrete(labels = x_axis_labs) +
theme(panel.background = element_rect(fill = "transparent"),
legend.position = "right", ## Consider “gray97” for fill
plot.title = element_text(face = "bold", hjust = 0.5, size = 16),
plot.subtitle = element_text(hjust = 0.5),
panel.grid.major.y = element_line(color='grey75'),
axis.text.x = element_text(face = "plain", size = 13, color = "black"),
axis.text.y = element_text(face = "plain", size = 13, color = "black"),
axis.title.y = element_text(face = "plain", size = 13, color = "black",
margin = margin(t = 0, r = 10, b = 0, l = 0)), ## lower X axis title
panel.border = element_rect(color = "black", fill = NA, size = 1))
ggpar(part1, legend = "none")
}
lizy_cooker <- function(dv, iv, Title, x_axis_labs, y_label, sample_size, coln, rown) {
part1 <- ggviolin(gjg_wide, x = dv, y = iv, color = dv,
alpha = 0.1, fill = dv, xlab = "Motive",
trim = TRUE, ylab = y_label) +
stat_summary(fun.data = "mean_cl_normal", geom = "crossbar", fatten = 1) +
scale_y_continuous(breaks = c(1:7)) +
labs(title = paste0(Title, " (n = ", sample_size, ")")) +
theme(panel.background = element_rect(fill = "transparent"),
legend.position = "right", ## Consider “gray97” for fill
plot.title = element_text(face = "bold", hjust = 0.5, size = 16),
plot.subtitle = element_text(hjust = 0.5),
panel.grid.major.y = element_line(color='grey75'),
axis.text.x = element_text(face = "plain", size = 13, color = "black"),
axis.text.y = element_text(face = "plain", size = 13, color = "black"),
axis.title.y = element_text(face = "plain", size = 13, color = "black",
margin = margin(t = 0, r = 10, b = 0, l = 0)), ## lower X axis title
panel.border = element_rect(color = "black", fill = NA, size = 1)) +
scale_color_discrete(name = "Condition") +
facet_wrap(~ vignette, ncol = coln, nrow = rown, scales = "free", as.table = TRUE)
ggpar(part1, legend = "none")
}
#### filtering people who failed the attn check ####
filtered_gjg <- gjg %>% filter(attn_chk_DV == 1)
filtered_gjg$attn_PID <- seq_along(filtered_gjg$PID)
#### make dataset long ####
gjg_long<-filtered_gjg %>% gather(stim, resp, "just_BECMA_MC":"just_water_motive8")
gjg_long<-gjg_long %>%
separate(stim, into= c("condition", "vignette", "DV"), sep="_")
## shift dataset back to wide format ##
gjg_wide <- spread(gjg_long, DV, resp)
gjg_wide <- gjg_wide %>% mutate_at(c("percep1","percep2","percep3","percep4","percep5",
"selfMoral","selfPraiseworthy","selfFriend","agentMoral","agentPraiseworthy","agentFriend",
"motive1", "motive2","motive3","motive4","motive5","motive6","motive7","motive8"), as.numeric)
#### rename DVs ####
names(gjg_wide)[names(gjg_wide) == 'percep1'] <-'p_approve'
names(gjg_wide)[names(gjg_wide) == 'percep2'] <-'p_similar'
names(gjg_wide)[names(gjg_wide) == 'percep3'] <-'p_genuine'
names(gjg_wide)[names(gjg_wide) == 'percep4'] <-'p_obligation'
names(gjg_wide)[names(gjg_wide) == 'percep5'] <-'p_beyond'
names(gjg_wide)[names(gjg_wide) == 'selfMoral'] <-'self_moral'
names(gjg_wide)[names(gjg_wide) == 'selfPraiseworthy'] <-'self_praiseworthy'
names(gjg_wide)[names(gjg_wide) == 'selfFriend'] <-'self_friend'
names(gjg_wide)[names(gjg_wide) == 'agentMoral'] <-'agent_moral'
names(gjg_wide)[names(gjg_wide) == 'agentPraiseworthy'] <-'agent_praiseworthy'
names(gjg_wide)[names(gjg_wide) == 'agentFriend'] <-'agent_friend'
names(gjg_wide)[names(gjg_wide) == 'motive1'] <-'m_reputation'
names(gjg_wide)[names(gjg_wide) == 'motive2'] <-'m_peers'
names(gjg_wide)[names(gjg_wide) == 'motive3'] <-'m_signal_important'
names(gjg_wide)[names(gjg_wide) == 'motive4'] <-'m_signal_right'
names(gjg_wide)[names(gjg_wide) == 'motive5'] <-'m_issue'
names(gjg_wide)[names(gjg_wide) == 'motive6'] <-'m_resources'
names(gjg_wide)[names(gjg_wide) == 'motive7'] <-'m_obligation'
names(gjg_wide)[names(gjg_wide) == 'motive8'] <-'m_beyond'
## Rename Vignettes
gjg_wide <- gjg_wide %>%
mutate(vignette = case_when(
vignette == "water" ~ "Clean Water Action",
vignette == "bread" ~ "Project Bread",
vignette == "child" ~ "Friends of the Children",
vignette == "health" ~ "Healthcare Without Walls",
vignette == "bread" ~ "Project Bread",
vignette == "child" ~ "Friends of the Children",
vignette == "ace" ~ "Alternatives for Community and Environment",
vignette == "dcc" ~ "Dorchester Community care",
vignette == "crayon" ~ "Cradles to Crayons",
vignette == "raft" ~ "RAFT",
vignette == "lit" ~ "Adult Literacy Initiative",
vignette == "rosie" ~ "Rosie’s Place",
vignette == "dudley" ~ "Dudley Street Neighborhood Initiative",
vignette == "table" ~ "My Brother’s Table",
vignette == "food" ~ "The Food Project",
vignette == "home" ~ "Heading Home",
vignette == "ethos" ~ "Ethos",
vignette == "becma" ~ "BECMA",
TRUE ~ vignette # if none of the above conditions are met, keep the original value
))
## Rename Conditions
gjg_wide <- gjg_wide %>%
mutate(condition = case_when(
condition == "just" ~ "Justice",
condition == "gen" ~ "Generosity",
TRUE ~ condition # if none of the above conditions are met, keep the original value
))
gjg %>%
group_by(attn_chk_DV) %>%
dplyr::summarise(n = n()) %>%
mutate(freq = n / sum(n))
There was a 36% attention check failure rate.
# Subset your data frame to include only the demographic columns
demo_gjg <- gjg[, c("age", "gender", "race", "income", "education", "employment", "political_overall", "political_social", "political_economic", "sexual_orientation", "english", "married", "relationship", "religiosity", "god", "faith", "services", "region")]
# Age
mean(gjg$age, na.rm=TRUE)
## [1] 39.535
sd(gjg$age, na.rm=TRUE)
## [1] 14.00319
# Loop through each demographic column and calculate frequency counts
freq_tables <- list()
for (col in names(demo_gjg)) {
if (is.character(demo_gjg[[col]])) {
freq_tables[[col]] <- as.data.frame(table(demo_gjg[[col]]))
}
}
# Print the frequency tables
for (i in seq_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 gender :
## Var1 Freq
## 1 1
## 2 Man 100
## 3 Nonbinary person or Other 4
## 4 Woman 96
##
## Table of frequencies for race :
## Var1 Freq
## 1 1
## 2 Asian 19
## 3 Asian,White 2
## 4 Black or African American 20
## 5 Black or African American,White 2
## 6 Hispanic/Latino/a/x 10
## 7 Indigenous American or Alaskan Native 2
## 8 Indigenous American or Alaskan Native,White 3
## 9 Indigenous American or Alaskan Native,White,Hispanic/Latino/a/x 1
## 10 Native Hawaiian or Other Pacific Islander 1
## 11 White 133
## 12 White,Hispanic/Latino/a/x 7
##
## Table of frequencies for income :
## Var1 Freq
## 1 2
## 2 < $10,000 11
## 3 >$150,000 14
## 4 $10,000 to $19,999 20
## 5 $100,000 to $149,999 32
## 6 $20,000 to $29,999 15
## 7 $30,000 to $39,999 23
## 8 $40,000 to $49,999 17
## 9 $50,000 to $74,999 38
## 10 $75,000 to $99,999 29
##
## Table of frequencies for education :
## Var1
## 1
## 2 Associate Degree (e.g. AA, AS)
## 3 Bachelor's Degree (e.g. BA, BS)
## 4 High school degree or equivalent (e.g. GED)
## 5 Less than a high school diploma
## 6 Postgraduate Degree (e.g. Master's Degree, Professional Degree, Doctorate Degree)
## 7 Some college, no degree
## Freq
## 1 2
## 2 17
## 3 67
## 4 31
## 5 2
## 6 32
## 7 50
##
## Table of frequencies for employment :
## Var1 Freq
## 1 2
## 2 Employed full time (30 hours or more a week) 90
## 3 Employed part time (up to 29 hours a week) 27
## 4 Homemaker 11
## 5 Retired 12
## 6 Self-employed 19
## 7 Student 12
## 8 Unable to work 7
## 9 Unemployed and currently looking for work 16
## 10 Unemployed and not currently looking for work 5
##
## Table of frequencies for political_overall :
## Var1 Freq
## 1 1
## 2 Democrat 96
## 3 Independent 63
## 4 Republican 34
## 5 Something else 7
##
## Table of frequencies for political_social :
## Var1 Freq
## 1 2
## 2 Conservative 16
## 3 Liberal 51
## 4 Moderate 32
## 5 Somewhat conservative 18
## 6 Somewhat liberal 32
## 7 Very conservative 7
## 8 Very liberal 43
##
## Table of frequencies for political_economic :
## Var1 Freq
## 1 3
## 2 Conservative 19
## 3 Liberal 41
## 4 Moderate 37
## 5 Somewhat conservative 33
## 6 Somewhat liberal 23
## 7 Very conservative 9
## 8 Very liberal 36
##
## Table of frequencies for sexual_orientation :
## Var1 Freq
## 1 1
## 2 Asexual 2
## 3 Asexual,Questioning 1
## 4 Bisexual 17
## 5 Bisexual,Pansexual,Straight (heterosexual) 1
## 6 Bisexual,Straight (heterosexual) 1
## 7 Gay 6
## 8 Lesbian 5
## 9 Lesbian,Queer 1
## 10 Pansexual 1
## 11 Pansexual,Queer 1
## 12 Pansexual,Questioning 1
## 13 Prefer not to disclose 1
## 14 Straight (heterosexual) 162
##
## Table of frequencies for english :
## Var1 Freq
## 1 1
## 2 English 194
## 3 Other 6
##
## Table of frequencies for married :
## Var1 Freq
## 1 No, never been married 110
## 2 Yes, and am still married 67
## 3 Yes, have been widowed 3
## 4 Yes, have divorced 18
## 5 Yes, have separated 3
##
## Table of frequencies for relationship :
## Var1 Freq
## 1 In a long term partnership 41
## 2 In a marriage or legal domestic partnership 68
## 3 Single/not in a long term partnership 92
##
## Table of frequencies for religiosity :
## Var1 Freq
## 1 3
## 2 Moderately religious 36
## 3 Not at all religious 89
## 4 Slightly religious 43
## 5 Very religious 30
##
## Table of frequencies for god :
## Var1 Freq
## 1 No 66
## 2 Other 22
## 3 Yes 113
##
## Table of frequencies for faith :
## Var1 Freq
## 1 Atheist (do not believe in God) 53
## 2 Buddhist 1
## 3 Christian 99
## 4 Jewish 3
## 5 Muslim 2
## 6 Other 31
## 7 Prefer not to disclose 12
##
## Table of frequencies for services :
## Var1 Freq
## 1 1
## 2 A few times in a year 25
## 3 More than once a week 6
## 4 Never 93
## 5 Once a week 15
## 6 Once or twice a month 9
## 7 Seldom 52
##
## Table of frequencies for region :
## Var1 Freq
## 1 Rural 25
## 2 Suburban 117
## 3 Urban 59
Here are the question wordings for the various ratings:
Perceptions of the donor (1 = Strongly Disagree, 7 = Strongly Agree)
Contrast between first and third party beliefs about the donor (1 = Strongly Disagree, 7 = Strongly Agree)
Beliefs about the donor’s motive (1 = Strongly Disagree, 7 = Strongly Agree)
The donor was motivated to donate because…
DVs <- gjg_wide[c("p_approve","p_similar","p_genuine","p_obligation","p_beyond",
"self_moral","self_praiseworthy","self_friend","agent_moral","agent_praiseworthy",
"agent_friend","m_reputation","m_peers","m_signal_important","m_signal_right","m_issue",
"m_resources","m_obligation","m_beyond")]
results <- correlation::correlation(DVs)
results %>%
summary(redundant = T) %>%
plot() + #show_data = "points"
see::theme_modern() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
scale_fill_gradient2(low = "orange", high = hcl(240, 100, 50), mid = "white", midpoint = 0, limits = c(-1, 1))
The ratings are weakly to moderately positively correlated with the
exception of reputation signaling motive measures, which tend to be
negatively correlated perceptions of the donor and belief that the donor
was motived solely by the impact of the donation on the
cause/recipients.
corr_DVs = cor(DVs, use="complete.obs")
KMO(corr_DVs) #tests how suited data is for factor analysis
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = corr_DVs)
## Overall MSA = 0.88
## MSA for each item =
## p_approve p_similar p_genuine p_obligation
## 0.94 0.88 0.94 0.95
## p_beyond self_moral self_praiseworthy self_friend
## 0.89 0.93 0.92 0.92
## agent_moral agent_praiseworthy agent_friend m_reputation
## 0.73 0.73 0.86 0.68
## m_peers m_signal_important m_signal_right m_issue
## 0.68 0.81 0.82 0.90
## m_resources m_obligation m_beyond
## 0.90 0.93 0.87
cortest.bartlett(corr_DVs) #tests correlations between variables
## $chisq
## [1] 966.7685
##
## $p.value
## [1] 3.092928e-111
##
## $df
## [1] 171
ev<-eigen(cor(corr_DVs)) #gets eigenvalues (variance explained by each component)
ev$values
## [1] 1.037409e+01 2.430630e+00 1.632689e+00 1.270013e+00 9.861088e-01
## [6] 8.617383e-01 3.577198e-01 2.305413e-01 1.921516e-01 1.477668e-01
## [11] 1.171956e-01 1.077976e-01 8.820732e-02 5.915502e-02 5.061735e-02
## [16] 4.129114e-02 3.357023e-02 1.871365e-02 1.535846e-16
scree(corr_DVs) #number of factors until plot levels off
fa.parallel(corr_DVs, n.obs=50, fa="fa") #checks eigenvalues of factors against eigenvalues of identity (no correlation) matrix
## Parallel analysis suggests that the number of factors = 2 and the number of components = NA
dat_fa <- na.omit(DVs)
fit.4 <- factanal(na.omit(dat_fa),factors=4, n.obs=3215, rotation="promax", scores = "regression")
print(fit.4, digits = 2, cutoff = .4, sort = TRUE)
##
## Call:
## factanal(x = na.omit(dat_fa), factors = 4, n.obs = 3215, scores = "regression", rotation = "promax")
##
## Uniquenesses:
## p_approve p_similar p_genuine p_obligation
## 0.34 0.48 0.26 0.44
## p_beyond self_moral self_praiseworthy self_friend
## 0.55 0.31 0.36 0.28
## agent_moral agent_praiseworthy agent_friend m_reputation
## 0.81 0.74 0.22 0.21
## m_peers m_signal_important m_signal_right m_issue
## 0.21 0.31 0.28 0.56
## m_resources m_obligation m_beyond
## 0.62 0.74 0.76
##
## Loadings:
## Factor1 Factor2 Factor3 Factor4
## p_approve 0.86
## p_genuine 0.89
## p_obligation 0.62
## p_beyond 0.72
## self_moral 0.78
## self_praiseworthy 0.77
## m_issue 0.65
## m_resources 0.64
## m_reputation 0.89
## m_peers 0.89
## p_similar 0.60
## self_friend 0.59
## agent_friend 0.92
## m_signal_important 0.87
## m_signal_right 0.87
## agent_moral
## agent_praiseworthy 0.46
## m_obligation
## m_beyond 0.47
##
## Factor1 Factor2 Factor3 Factor4
## SS loadings 5.01 2.09 1.71 1.63
## Proportion Var 0.26 0.11 0.09 0.09
## Cumulative Var 0.26 0.37 0.46 0.55
##
## Factor Correlations:
## Factor1 Factor2 Factor3 Factor4
## Factor1 1.000 -0.067 -0.58 -0.54
## Factor2 -0.067 1.000 0.22 0.40
## Factor3 -0.578 0.224 1.00 0.31
## Factor4 -0.537 0.401 0.31 1.00
##
## Test of the hypothesis that 4 factors are sufficient.
## The chi square statistic is 2434.45 on 101 degrees of freedom.
## The p-value is 0
fit.5 <- factanal(na.omit(dat_fa),factors=5, n.obs=3215, rotation="promax", scores = "regression")
print(fit.5, digits = 2, cutoff = .4, sort = TRUE)
##
## Call:
## factanal(x = na.omit(dat_fa), factors = 5, n.obs = 3215, scores = "regression", rotation = "promax")
##
## Uniquenesses:
## p_approve p_similar p_genuine p_obligation
## 0.32 0.43 0.26 0.44
## p_beyond self_moral self_praiseworthy self_friend
## 0.56 0.29 0.36 0.28
## agent_moral agent_praiseworthy agent_friend m_reputation
## 0.41 0.44 0.23 0.22
## m_peers m_signal_important m_signal_right m_issue
## 0.18 0.32 0.27 0.53
## m_resources m_obligation m_beyond
## 0.60 0.74 0.76
##
## Loadings:
## Factor1 Factor2 Factor3 Factor4 Factor5
## p_approve 0.88
## p_genuine 0.88
## p_obligation 0.59
## p_beyond 0.70
## self_moral 0.74
## self_praiseworthy 0.75
## m_issue 0.69
## m_resources 0.67
## m_reputation 0.87
## m_peers 0.91
## m_signal_important 0.88
## m_signal_right 0.89
## p_similar 0.66
## self_friend 0.58
## agent_friend 0.89
## agent_moral 0.78
## agent_praiseworthy 0.69
## m_obligation
## m_beyond 0.46
##
## Factor1 Factor2 Factor3 Factor4 Factor5
## SS loadings 4.89 1.75 1.68 1.64 1.24
## Proportion Var 0.26 0.09 0.09 0.09 0.07
## Cumulative Var 0.26 0.35 0.44 0.52 0.59
##
## Factor Correlations:
## Factor1 Factor2 Factor3 Factor4 Factor5
## Factor1 1.00 -0.040 -0.570 0.52 -0.21
## Factor2 -0.04 1.000 -0.069 0.41 -0.42
## Factor3 -0.57 -0.069 1.000 -0.31 0.31
## Factor4 0.52 0.409 -0.315 1.00 -0.28
## Factor5 -0.21 -0.419 0.313 -0.28 1.00
##
## Test of the hypothesis that 5 factors are sufficient.
## The chi square statistic is 1579.1 on 86 degrees of freedom.
## The p-value is 4.67e-273
fit.6 <- factanal(na.omit(dat_fa),factors=6, n.obs=3215, rotation="promax", scores = "regression")
print(fit.6, digits = 2, cutoff = .4, sort = TRUE)
##
## Call:
## factanal(x = na.omit(dat_fa), factors = 6, n.obs = 3215, scores = "regression", rotation = "promax")
##
## Uniquenesses:
## p_approve p_similar p_genuine p_obligation
## 0.29 0.42 0.26 0.43
## p_beyond self_moral self_praiseworthy self_friend
## 0.00 0.28 0.36 0.28
## agent_moral agent_praiseworthy agent_friend m_reputation
## 0.40 0.45 0.23 0.22
## m_peers m_signal_important m_signal_right m_issue
## 0.17 0.31 0.28 0.53
## m_resources m_obligation m_beyond
## 0.60 0.74 0.65
##
## Loadings:
## Factor1 Factor2 Factor3 Factor4 Factor5 Factor6
## p_approve 0.97
## p_genuine 0.87
## self_moral 0.78
## self_praiseworthy 0.67
## m_issue 0.67
## m_resources 0.71
## m_signal_important 0.91
## m_signal_right 0.90
## p_similar 0.70
## self_friend 0.60
## agent_friend 0.92
## m_reputation 0.87
## m_peers 0.92
## p_beyond 1.04
## m_beyond 0.50
## agent_moral 0.79
## agent_praiseworthy 0.68
## p_obligation 0.44
## m_obligation
##
## Factor1 Factor2 Factor3 Factor4 Factor5 Factor6
## SS loadings 4.15 1.78 1.77 1.75 1.41 1.25
## Proportion Var 0.22 0.09 0.09 0.09 0.07 0.07
## Cumulative Var 0.22 0.31 0.41 0.50 0.57 0.64
##
## Factor Correlations:
## Factor1 Factor2 Factor3 Factor4 Factor5 Factor6
## Factor1 1.000 0.449 -0.099 -0.45 -0.65 0.27
## Factor2 0.449 1.000 -0.053 -0.36 -0.60 0.33
## Factor3 -0.099 -0.053 1.000 0.38 -0.12 -0.40
## Factor4 -0.445 -0.360 0.382 1.00 0.53 -0.29
## Factor5 -0.651 -0.597 -0.123 0.53 1.00 -0.20
## Factor6 0.274 0.335 -0.397 -0.29 -0.20 1.00
##
## Test of the hypothesis that 6 factors are sufficient.
## The chi square statistic is 994.1 on 72 degrees of freedom.
## The p-value is 3.36e-162
percep_plot_list <- list(plot_cooker("condition", "p_approve", "I approve of donors motivation for donating", c("Justice", "Generosity"), "Participant agreement", 129),
plot_cooker("condition", "p_similar", "I think I am similar to the donor", c("Justice", "Generosity"), "Participant agreement", 129),
plot_cooker("condition", "p_genuine", "I think the donor is genuine", c("Justice", "Generosity"), "Participant agreement", 129),
plot_cooker("condition", "p_obligation", "I think the donor fulfilled his obligation", c("Justice", "Generosity"), "Participant agreement", 129),
plot_cooker("condition", "p_beyond", "I think the donor went above and beyond", c("Justice", "Generosity"), "Participant agreement", 129))
percep_plot_arranged <- ggarrange(plotlist = percep_plot_list, ncol = 2, nrow = 3)
overall_percep_title <- ggdraw() +
draw_label("Perception DVs", fontface = "bold")
plot_grid(overall_percep_title, percep_plot_arranged, ncol = 1, rel_heights = c(0.1, 0.9))
contrast_plot_list <- list(plot_cooker("condition", "self_moral", "I think the donor is moral", c("Justice", "Generosity"), "Participant agreement", 129),
plot_cooker("condition", "self_praiseworthy", "I think the donor is praiseworthy", c("Justice", "Generosity"), "Participant agreement", 129),
plot_cooker("condition", "self_friend", "I would like the donor as a friend", c("Justice", "Generosity"), "Participant agreement", 129),
plot_cooker("condition", "agent_moral", "The donor thinks he is moral", c("Justice", "Generosity"), "Participant agreement", 129),
plot_cooker("condition", "agent_praiseworthy", "The donor thinks he is praiseworthy", c("Justice", "Generosity"), "Participant agreement", 129),
plot_cooker("condition", "agent_friend", "The donor would like me as a friend", c("Justice", "Generosity"), "Participant agreement", 129))
contrast_plot_arranged <- ggarrange(plotlist = contrast_plot_list, ncol = 2, nrow = 3)
overall_contrast_title <- ggdraw() +
draw_label("Contrast DVs", fontface = "bold")
plot_grid(overall_contrast_title, contrast_plot_arranged, ncol = 1, rel_heights = c(0.1, 0.9))
motive_plot_list <- list(plot_cooker("condition", "m_reputation", "Reputation Motive", c("Justice", "Generosity"), "Potential motive", 129),
plot_cooker("condition", "m_peers", "Peer Motive", c("Justice", "Generosity"), "Potential motive", 129),
plot_cooker("condition", "m_signal_important", "Signal Importance", c("Justice", "Generosity"), "Potential motive", 129),
plot_cooker("condition", "m_signal_right", "Signal Right Thing to Do", c("Justice", "Generosity"), "Potential motive", 129),
plot_cooker("condition", "m_issue", "Address the issue", c("Justice", "Generosity"), "Potential motive", 129),
plot_cooker("condition", "m_resources", "Provide resources", c("Justice", "Generosity"), "Potential motive", 129),
plot_cooker("condition", "m_obligation", "Fulfill an obligation", c("Justice", "Generosity"), "Potential motive", 129),
plot_cooker("condition", "m_beyond", "To go above and beyond?", c("Justice", "Generosity"), "Potential motive", 129))
motive_plot_arranged <- ggarrange(plotlist = motive_plot_list, ncol = 3, nrow = 3)
overall_motive_title <- ggdraw() +
draw_label("Motive DVs", fontface = "bold")
plot_grid(overall_motive_title, motive_plot_arranged, ncol = 1, rel_heights = c(0.1, 0.9))
lizy_cooker("condition", "p_approve", "I approve of donors motivation for donating", c("Justice", "Generosity"), "Participant agreement", 129, 4, 4)
lizy_cooker("condition", "p_similar", "I think I am similar to the donor", c("Justice", "Generosity"), "Participant agreement", 129, 4, 4)
lizy_cooker("condition", "p_genuine", "I think the donor is genuine", c("Justice", "Generosity"), "Participant agreement", 129, 4, 4)
lizy_cooker("condition", "p_obligation", "I think the donor fulfilled his obligation", c("Justice", "Generosity"), "Participant agreement", 129, 4, 4)
lizy_cooker("condition", "p_beyond", "I think the donor went above and beyond", c("Justice", "Generosity"), "Participant agreement", 129, 4, 4)
### Contrast
lizy_cooker("condition", "self_moral", "I think the donor is moral", c("Justice", "Generosity"), "Participant agreement", 129, 4, 4)
lizy_cooker("condition", "self_praiseworthy", "I think the donor is praiseworthy", c("Justice", "Generosity"), "Participant agreement", 129, 4, 4)
lizy_cooker("condition", "self_friend", "I would like the donor as a friend", c("Justice", "Generosity"), "Participant agreement", 129, 4, 4)
lizy_cooker("condition", "agent_moral", "The donor thinks he is moral", c("Justice", "Generosity"), "Participant agreement", 129, 4, 4)
lizy_cooker("condition", "agent_praiseworthy", "The donor thinks he is praiseworthy", c("Justice", "Generosity"), "Participant agreement", 129, 4, 4)
lizy_cooker("condition", "agent_friend", "The donor would like me as a friend", c("Justice", "Generosity"), "Participant agreement", 129, 4, 4)
### Motive
lizy_cooker("condition", "m_reputation", "Reputation Motive", c("Justice", "Generosity"), "Potential motive", 129, 4, 4)
lizy_cooker("condition", "m_peers", "Peer Motive", c("Justice", "Generosity"), "Potential motive", 129, 4, 4)
lizy_cooker("condition", "m_signal_important", "Signal Importance", c("Justice", "Generosity"), "Potential motive", 129, 4, 4)
lizy_cooker("condition", "m_signal_right", "Signal Right Thing to Do", c("Justice", "Generosity"), "Potential motive", 129, 4, 4)
lizy_cooker("condition", "m_issue", "Address the issue", c("Justice", "Generosity"), "Potential motive", 129, 4, 4)
lizy_cooker("condition", "m_resources", "Provide resources", c("Justice", "Generosity"), "Potential motive", 129, 4, 4)
lizy_cooker("condition", "m_obligation", "Fulfill an obligation", c("Justice", "Generosity"), "Potential motive", 129, 4, 4)
lizy_cooker("condition", "m_beyond", "To go above and beyond?", c("Justice", "Generosity"), "Potential motive", 129, 4, 4)
mod_p_approve <- lmer(p_approve ~ condition + (1 + condition | PID) + (1 + condition | vignette), data = gjg_wide)
summary(mod_p_approve)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: p_approve ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 5064.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.5844 -0.2815 0.0551 0.3961 5.0361
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 0.59602 0.7720
## conditionJustice 0.54512 0.7383 -0.28
## vignette (Intercept) 0.01991 0.1411
## conditionJustice 0.02194 0.1481 -1.00
## Residual 0.50558 0.7110
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.05898 0.07972 89.42484 76.005 <2e-16 ***
## conditionJustice -0.17628 0.08110 67.61513 -2.174 0.0332 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.470
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_p_similar <- lmer(p_similar ~ condition + (1 + condition | PID) + (1 + condition | vignette), data = gjg_wide)
summary(mod_p_similar)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: p_similar ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 5641.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.1149 -0.3580 0.0153 0.4117 4.4251
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 1.250367 1.11820
## conditionJustice 0.526793 0.72581 -0.41
## vignette (Intercept) 0.012433 0.11150
## conditionJustice 0.004985 0.07061 -0.33
## Residual 0.663830 0.81476
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 4.86014 0.10542 126.57854 46.103 <2e-16 ***
## conditionJustice -0.07592 0.07538 78.95985 -1.007 0.317
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.423
mod_p_genuine <- lmer(p_genuine ~ condition + (1 + condition | PID) + (1 + condition | vignette), data = gjg_wide)
summary(mod_p_genuine)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: p_genuine ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 4764.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.8118 -0.3741 0.0335 0.4629 4.7161
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 0.602826 0.77642
## conditionJustice 0.246195 0.49618 -0.29
## vignette (Intercept) 0.009726 0.09862
## conditionJustice 0.003063 0.05535 -1.00
## Residual 0.448983 0.67006
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 5.84607 0.07561 110.17081 77.32 <2e-16 ***
## conditionJustice -0.06761 0.05450 79.43139 -1.24 0.218
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.398
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_p_obligation <- lmer(p_obligation ~ condition + (1 + condition | PID) + (1 + condition | vignette), data = gjg_wide)
summary(mod_p_obligation)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: p_obligation ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 4649.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -7.9013 -0.3780 0.0190 0.4391 3.9266
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 8.014e-01 0.8952064
## conditionJustice 1.501e-01 0.3874725 -0.17
## vignette (Intercept) 4.642e-03 0.0681348
## conditionJustice 8.787e-07 0.0009374 -1.00
## Residual 4.219e-01 0.6495346
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 5.74364 0.08313 127.51931 69.088 <2e-16 ***
## conditionJustice -0.08225 0.04452 124.30576 -1.847 0.0671 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.234
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_p_beyond <- lmer(p_beyond ~ condition + (1 + condition | PID) + (1 + condition | vignette), data = gjg_wide)
summary(mod_p_beyond)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: p_beyond ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 5331.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.2951 -0.3841 0.0318 0.4347 5.5098
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 1.012825 1.00639
## conditionJustice 0.178728 0.42276 -0.09
## vignette (Intercept) 0.004861 0.06972
## conditionJustice 0.001802 0.04245 -1.00
## Residual 0.595563 0.77173
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 5.51695 0.09345 122.73051 59.038 <2e-16 ***
## conditionJustice -0.10687 0.05150 80.78332 -2.075 0.0412 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.223
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_self_moral<-lmer(self_moral~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_self_moral)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: self_moral ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 4354.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -7.3600 -0.2916 0.0407 0.4244 4.3736
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 0.671315 0.81934
## conditionJustice 0.087293 0.29545 -0.11
## vignette (Intercept) 0.010052 0.10026
## conditionJustice 0.003902 0.06246 -1.00
## Residual 0.370705 0.60886
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 5.75877 0.07869 117.91667 73.186 <2e-16 ***
## conditionJustice -0.03749 0.04049 41.17797 -0.926 0.36
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.298
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_self_praiseworthy<-lmer(self_praiseworthy~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_self_praiseworthy)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: self_praiseworthy ~ condition + (1 + condition | PID) + (1 +
## condition | vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 4780.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.3692 -0.2779 0.0327 0.3718 5.0766
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 0.906549 0.95213
## conditionJustice 0.159643 0.39955 -0.22
## vignette (Intercept) 0.002478 0.04978
## conditionJustice 0.001727 0.04156 -1.00
## Residual 0.450322 0.67106
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 5.68202 0.08729 126.35197 65.10 <2e-16 ***
## conditionJustice -0.08994 0.04710 68.88380 -1.91 0.0604 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.297
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_self_friend<-lmer(self_friend~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_self_friend)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: self_friend ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 4848.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.8941 -0.3107 0.0136 0.3837 3.8076
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 1.024492 1.01217
## conditionJustice 0.338579 0.58188 -0.32
## vignette (Intercept) 0.007886 0.08880
## conditionJustice 0.001992 0.04463 -1.00
## Residual 0.447369 0.66886
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 5.32822 0.09417 129.28948 56.580 <2e-16 ***
## conditionJustice -0.08294 0.06014 109.54869 -1.379 0.171
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.382
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_agent_moral<-lmer(agent_moral~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_agent_moral)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: agent_moral ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 4937.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.4844 -0.3864 0.0230 0.4482 5.9608
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 0.7895778 0.88858
## conditionJustice 0.0450159 0.21217 -0.04
## vignette (Intercept) 0.0010376 0.03221
## conditionJustice 0.0003437 0.01854 -1.00
## Residual 0.5108656 0.71475
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 5.47476 0.08174 123.63410 66.982 <2e-16 ***
## conditionJustice -0.02706 0.03689 86.54935 -0.734 0.465
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.198
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_agent_praiseworthy<-lmer(agent_praiseworthy~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_agent_praiseworthy)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: agent_praiseworthy ~ condition + (1 + condition | PID) + (1 +
## condition | vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 5799
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.5979 -0.4176 -0.0379 0.3614 4.9067
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 1.028983 1.01439
## conditionJustice 0.099619 0.31562 -0.10
## vignette (Intercept) 0.006097 0.07808
## conditionJustice 0.004765 0.06903 -1.00
## Residual 0.776622 0.88126
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 4.923e+00 9.545e-02 1.217e+02 51.583 <2e-16 ***
## conditionJustice -5.530e-05 5.075e-02 3.877e+01 -0.001 0.999
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.279
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_agent_friend<-lmer(agent_friend~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_agent_friend)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: agent_friend ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 4810
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.5898 -0.2929 0.0037 0.3867 4.8660
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 1.130472 1.06324
## conditionJustice 0.300757 0.54841 -0.31
## vignette (Intercept) 0.004765 0.06903
## conditionJustice 0.004806 0.06933 -1.00
## Residual 0.438739 0.66237
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 5.01063 0.09740 129.13853 51.445 <2e-16 ***
## conditionJustice -0.06780 0.05901 78.71171 -1.149 0.254
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.368
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_m_reputation<-lmer(m_reputation~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_m_reputation)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: m_reputation ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 5071.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.4370 -0.3933 -0.0259 0.4115 3.7794
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 0.748581 0.8652
## conditionJustice 0.217514 0.4664 -0.29
## vignette (Intercept) 0.011432 0.1069
## conditionJustice 0.007191 0.0848 -0.68
## Residual 0.523526 0.7236
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 2.84757 0.08382 118.12164 33.974 <2e-16 ***
## conditionJustice 0.06386 0.05613 45.92557 1.138 0.261
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.384
mod_m_peers<-lmer(m_peers~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_m_peers)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: m_peers ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 5117.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.0906 -0.4002 -0.0285 0.3632 3.9586
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 0.694496 0.83336
## conditionJustice 0.207525 0.45555 -0.23
## vignette (Intercept) 0.001753 0.04187
## conditionJustice 0.009503 0.09748 -0.81
## Residual 0.542255 0.73638
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 2.893e+00 7.758e-02 1.208e+02 37.284 <2e-16 ***
## conditionJustice 7.625e-03 5.704e-02 4.232e+01 0.134 0.894
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.320
mod_m_signal_important<-lmer(m_signal_important~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_m_signal_important)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: m_signal_important ~ condition + (1 + condition | PID) + (1 +
## condition | vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 4533.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.5574 -0.3648 0.0476 0.5462 2.6226
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 0.525350 0.72481
## conditionJustice 0.109686 0.33119 -0.24
## vignette (Intercept) 0.005267 0.07257
## conditionJustice 0.007827 0.08847 -1.00
## Residual 0.414198 0.64358
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 3.79754 0.06930 119.25642 54.80 <2e-16 ***
## conditionJustice 0.11527 0.04628 36.41697 2.49 0.0175 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.388
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_m_signal_right<-lmer(m_signal_right~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_m_signal_right)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: m_signal_right ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 4482.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.9592 -0.4310 0.0359 0.4726 3.2967
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 0.509467 0.71377
## conditionJustice 0.082227 0.28675 -0.21
## vignette (Intercept) 0.003961 0.06294
## conditionJustice 0.005279 0.07266 -0.94
## Residual 0.407343 0.63823
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 3.78393 0.06776 119.67366 55.84 < 2e-16 ***
## conditionJustice 0.14923 0.04192 29.21401 3.56 0.00129 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.351
mod_m_issue<-lmer(m_issue~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_m_issue)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: m_issue ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 3642.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.4651 -0.3272 0.0742 0.4313 3.4386
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 0.286830 0.53556
## conditionJustice 0.153345 0.39159 -0.49
## vignette (Intercept) 0.001334 0.03653
## conditionJustice 0.004663 0.06829 -1.00
## Residual 0.267165 0.51688
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 4.38563 0.05065 119.69132 86.580 <2e-16 ***
## conditionJustice 0.02035 0.04470 57.69638 0.455 0.651
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.534
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_m_resources<-lmer(m_resources~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_m_resources)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: m_resources ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 3949.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.8414 -0.3737 0.0695 0.5135 2.8731
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 0.2216543 0.470802
## conditionJustice 0.1597120 0.399640 -0.31
## vignette (Intercept) 0.0181819 0.134840
## conditionJustice 0.0000622 0.007887 -1.00
## Residual 0.3123059 0.558843
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 4.46302 0.05619 55.30740 79.426 <2e-16 ***
## conditionJustice -0.05886 0.04299 124.95666 -1.369 0.173
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.340
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_m_obligation<-lmer(m_obligation~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_m_obligation)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: m_obligation ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 4848.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.9507 -0.4299 0.0651 0.5125 3.9409
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 4.733e-01 0.6880008
## conditionJustice 1.294e-01 0.3596822 -0.15
## vignette (Intercept) 2.933e-08 0.0001712
## conditionJustice 8.244e-08 0.0002871 -1.00
## Residual 4.913e-01 0.7009626
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 3.79264 0.06439 128.00718 58.905 < 2e-16 ***
## conditionJustice 0.14050 0.04422 127.92768 3.178 0.00186 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.270
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
mod_m_beyond<-lmer(m_beyond~condition + (1 + condition | PID) + (1 + condition | vignette), data=gjg_wide)
summary(mod_m_beyond)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: m_beyond ~ condition + (1 + condition | PID) + (1 + condition |
## vignette)
## Data: gjg_wide
##
## REML criterion at convergence: 4502.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.2059 -0.4196 0.0522 0.5137 4.7178
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## PID (Intercept) 0.379123 0.61573
## conditionJustice 0.063612 0.25221 0.18
## vignette (Intercept) 0.005261 0.07253
## conditionJustice 0.008305 0.09113 -0.87
## Residual 0.419004 0.64731
## Number of obs: 2064, groups: PID, 129; vignette, 16
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 3.94562 0.06061 107.20788 65.096 < 2e-16 ***
## conditionJustice -0.13447 0.04271 23.89320 -3.148 0.00437 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnJstc -0.213
# ggplot(gjg_wide, aes(x = condition, y = p_approve, color = condition)) +
# geom_point(stat="summary", fun="mean", size = 2) +
# facet_wrap(~attn_PID, nrow = 10) +
# scale_x_discrete(labels = NULL)
#
# ggplot(TEST_gjg_long, aes(x = condition, y = resp, group = attn_PID)) +
# geom_line()
# TEST_gjg_long <- gjg_long %>% filter(DV == "percep1")
#
# view(gjg)
#
# ?geom_line
#
# justice_cols <- gjg[, startsWith(names(gjg), "just")]
# gjg <- gjg %>% mutate(avg_Generous = colMeans(as.numeric(justice_cols)))
#
# # select columns that start with "just"
# justice_cols <- gjg[, startsWith(names(gjg), "just")]
#
# # convert the columns to a numeric matrix
# justice_cols_numeric <- as.matrix(justice_cols)
#
# # calculate the column means and add them as a new column to the gjg data frame
# gjg <- gjg %>% mutate(avg_Generous = colMeans(justice_cols_numeric, na.rm = TRUE))
#
# # calculate the column means
# means <- colMeans(selected_cols)
#
#
# library(dplyr)
#
# # select columns that start with "just"
# justice_cols <- gjg[, startsWith(names(gjg), "just")]
#
# # convert all columns to numeric
# justice_cols <- justice_cols %>% mutate_all(as.numeric)
#
# # replace the original columns with the new numeric columns in the gjg data frame
# gjg[, startsWith(names(gjg), "just")] <- justice_cols