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",
"easyStats", "cowplot","see","datawizard",
"ggcorrplot", "lavaan", "tidytext", "wordcloud",
"textdata", "reshape2")
# 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_raw <-read.csv("/Users/mtrenfield17/Desktop/Research/Boston College Research/Intergenerational Reciprocity/IG_Pilot 3/Intergenerational Reciprocity Study 3.csv")
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 CI
size = 1.5, color = "black") +
theme_classic() +
xlab("") +
ylab("") +
ggtitle(title)
ggpar(part1, legend = "none")
}
pol_line <- function(data, iv, dv) {
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.5) +
labs(x = "Political Leaning", color = "Condition")
}
lizy_cooker <- function(dv, iv, Title, x_axis_labs, y_label, sample_size, coln, rown) {
part1 <- ggviolin(gjg, 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")
}
#POL_gjg_long <- filter(gjg_long, political_overall %in% c("Democrat", "Republican"))
#gjg_long$political_overall
#ggplot(gjg_long, aes(x = condition, y = p_approve, color = condition)) +
#geom_point(stat="summary", fun="mean", size = 2) +
#facet_wrap(~political_overall) +
#scale_x_discrete(labels = NULL)
#### filtering people who failed the attn check ####
gjg <- gjg_raw %>% filter(attentionCheck == 3)
# Recoding opportunity choice Nos to 0
gjg$opportunityChoice[gjg$opportunityChoice == 2] <- 0
gjg$opportunityChoiceNum <- as.numeric(gjg$opportunityChoice)
gjg$opportunityChoiceNum
## [1] 0 0 0 0 1 1 1 0 1 0 1 0 1 0 1 0 0 0 0 0 1 0 0 1 0 1 0 0 1 1 1 1 0 0 1 1 0
## [38] 0 1 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 1 0
## [75] 0 0 0 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 1 1 1 1 0 0 1 1 0 0 0
## [112] 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 1 1 1 1 0 0
## [149] 1 0 0 1 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0
## [186] 1 0 1 0 0 0 1 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 0 1 1
## [223] 0 1 1 1 0 0 1 0 0 1 0 0 0 1 0 1 0 0 1 0 1 0 1 1 1 0 0 1 0 0 0 0 0 1 1 0 0
## [260] 0 0 0 0 1 0 1 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 1 0 1 0 0 1 0 1 0 0 0 0 1 0 0
## [297] 1 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 1 1 0 1 0 0 1 0 0 0 1 0 0 0 1
## [334] 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 1 1 1 0 0 0 1 0 0 1 1 0 0 0
## [371] 0 1 1 0 0 0 1 0 0 1 0 0 1 1 0 1 0 1 0 1 1 0 0 0 1 0 0 0 0 0 1 1 0 1 1 0 1
## [408] 0 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 0
## [445] 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [482] 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1
## [519] 0 1 1 0 1 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 1 1 0 0
## [556] 0 0 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0
## [593] 1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 1 1 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 1
## [630] 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 0
## [667] 0 0 0 1 0 0 1 0 0 1 1 0 0 0 1 0 0 1 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 0 0 1
## [704] 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0
## [741] 0 0 0 1 0 1 1 1 1 0 0 1 1 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0
## [778] 0 0 0 0 1 0 1 0 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0
## [815] 1 1 0 0 1 0 0 1 1 0 1 0 0 0 0 0 1 0 0 0 1 1 0 1 1 1 0 0 1 1 0 0 1 1 1 0 1
## [852] 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 1
## changing condition to factor and reordering ##
gjg$condition <- as.factor(gjg$condition)
gjg$condition <- factor(gjg$condition, levels = c("control", "assuredSuccess", "uncertainSuccess"))
## Changing clicked to factor
gjg$clicked <- as.factor(gjg$clicked)
gjg$opportunityChoice <- as.factor(gjg$opportunityChoice)
# changing numeric DVs to numeric
gjg <- gjg %>% mutate_at(vars(donation, lifestylePG, thankfulPG, sacrificesPG, gratitudePG, futureImpact, futureSacrifice, futureResponsibility, moralMitigate, moralProtectR, moralCollective, effortEfficacy, dayToDayEfficacyR, americansEfficacy1, americansEfficacy2, optimism, hope, intergenerational1, intergenerational2, american1, american2, pol, pid, edu, inc), as.numeric)
# Adjusting any donations entered as decimals
gjg$donation <- ifelse(grepl("\\.", gjg$donation), gjg$donation * 100, gjg$donation)
# Reversing the reverse coded variables
fixed_constant <- max(gjg$dayToDayEfficacyR) + min(gjg$dayToDayEfficacyR) # Calculate a fixed constant
gjg$dayToDayEfficacy <- fixed_constant - gjg$dayToDayEfficacyR # Reverse code the variable
fixed_constant <- max(gjg$moralProtectR) + min(gjg$moralProtectR) # Calculate a fixed constant
gjg$moralProtect <- fixed_constant - gjg$moralProtectR # Reverse code the variable
# Creating Composites
gjg$gratitude_z <- rowMeans(scale(gjg[, c("thankfulPG", "sacrificesPG", "gratitudePG", "lifestylePG")]))
gjg$obligation_z <- rowMeans(scale(gjg[, c("futureSacrifice", "futureImpact", "futureResponsibility")]))
gjg$moralToAct_z <- rowMeans(scale(gjg[, c("moralMitigate", "moralCollective", "moralProtect")]))
gjg$efficacy_z <- rowMeans(scale(gjg[, c("effortEfficacy", "dayToDayEfficacy", "americansEfficacy1", "americansEfficacy2")]))
gjg$HP_z <- rowMeans(scale(gjg[, c("hope", "optimism")]))
gjg$IG_z <- rowMeans(scale(gjg[, c("intergenerational1", "intergenerational2", "american1", "american2")]))
gjg_raw <- gjg_raw %>% filter(consent == 5)
gjg_raw %>%
group_by(attentionCheck) %>%
dplyr::summarise(n = n()) %>%
mutate(freq = n / sum(n))
6 participants failed the attention check.
# Subset your data frame to include only the demographic columns
demo_gjg <- gjg[, c("gen", "race", "inc_text", "edu_text", "pol_text", "pid_text", "area")]
# Age
mean(gjg$age, na.rm=TRUE)
## [1] 40.82187
sd(gjg$age, na.rm=TRUE)
## [1] 14.31261
# Loop through each demographic column and calculate frequency counts
freq_tables <- list()
for (col in names(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 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 gen :
## Var1 Freq Percent
## 1 1 430 48.48
## 2 2 437 49.27
## 3 3 20 2.25
##
## Table of frequencies for race :
## Var1 Freq Percent
## 1 2 0.23
## 2 1 4 0.45
## 3 1,2 3 0.34
## 4 1,2,5,8 1 0.11
## 5 1,2,8 2 0.23
## 6 1,3 1 0.11
## 7 1,3,8 1 0.11
## 8 1,5,8 4 0.45
## 9 1,7,8 1 0.11
## 10 1,8 4 0.45
## 11 2 73 8.23
## 12 2,3,8 1 0.11
## 13 2,5 5 0.56
## 14 2,5,6 1 0.11
## 15 2,5,8 3 0.34
## 16 2,8 12 1.35
## 17 2,9,5,8 1 0.11
## 18 3 30 3.38
## 19 3,5,8 1 0.11
## 20 3,8 8 0.90
## 21 3,9 2 0.23
## 22 4 9 1.01
## 23 5 47 5.30
## 24 5,8 22 2.48
## 25 6 1 0.11
## 26 6,8 3 0.34
## 27 7,8 1 0.11
## 28 8 629 70.91
## 29 9 12 1.35
## 30 9,7,8 1 0.11
## 31 9,8 2 0.23
##
## Table of frequencies for inc_text :
## Var1 Freq Percent
## 1 $100,000 - $149,999 105 11.84
## 2 $150,000 - $199,999 25 2.82
## 3 $25,000 - $49,999 234 26.38
## 4 $50,000 - $74,999 189 21.31
## 5 $75,000 - $99,999 131 14.77
## 6 less than $25,000 171 19.28
## 7 more than $200,000 32 3.61
##
## Table of frequencies for edu_text :
## Var1 Freq Percent
## 1 Bachelor's degree 312 35.17
## 2 Graduate degree (Masters, PhD, etc) 128 14.43
## 3 High school diploma or GED 159 17.93
## 4 Some college, Technical degree, or Associates degree 276 31.12
## 5 Some schooling, but no high school diploma or degree 12 1.35
##
## Table of frequencies for pol_text :
## Var1 Freq Percent
## 1 Conservative 95 10.71
## 2 Liberal 217 24.46
## 3 Moderate 187 21.08
## 4 Somewhat Conservative 69 7.78
## 5 Somewhat Liberal 117 13.19
## 6 Very Conservative 42 4.74
## 7 Very Liberal 160 18.04
##
## Table of frequencies for pid_text :
## Var1 Freq Percent
## 1 Democrat 413 46.56
## 2 Independent / Other 300 33.82
## 3 Republican 174 19.62
##
## Table of frequencies for area :
## Var1 Freq Percent
## 1 1 255 28.75
## 2 2 465 52.42
## 3 3 167 18.83
gjg$clickedNum <- as.numeric(gjg$clicked)
DVs <- gjg[c("clickedNum", "opportunityChoiceNum", "donation", "lifestylePG", "thankfulPG", "sacrificesPG","gratitudePG","futureImpact","futureSacrifice","futureResponsibility","moralMitigate", "moralProtect","moralCollective","effortEfficacy","dayToDayEfficacy", "americansEfficacy1","americansEfficacy2","optimism","hope","intergenerational1", "intergenerational2", "american1", "american2", "pol", "edu", "inc")]
# Compute pairwise correlations
corr_DVs <- cor(DVs, use = "complete.obs")
# Plot the correlation matrix
corrplot(corr_DVs, is.corr = TRUE, type = "lower", lower = "circle", tl.cex = 0.7, insig = "label_sig", diag = TRUE)
gjg_con <- filter(gjg, condition == "control")
cor(gjg_con[c("opportunityChoiceNum", "donation", "hope", "efficacy_z")], use = "complete.obs")
## opportunityChoiceNum donation hope efficacy_z
## opportunityChoiceNum 1.0000000 0.4339581 0.2629244 0.3287377
## donation 0.4339581 1.0000000 0.3974836 0.4424830
## hope 0.2629244 0.3974836 1.0000000 0.6594637
## efficacy_z 0.3287377 0.4424830 0.6594637 1.0000000
gjg_con <- filter(gjg, condition == "assuredSuccess")
cor(gjg[c("opportunityChoiceNum", "donation", "hope", "efficacy_z")])
## opportunityChoiceNum donation hope efficacy_z
## opportunityChoiceNum 1.0000000 NA 0.2544710 0.3146096
## donation NA 1 NA NA
## hope 0.2544710 NA 1.0000000 0.6458211
## efficacy_z 0.3146096 NA 0.6458211 1.0000000
gjg_UN <- filter(gjg, condition == "uncertainSuccess")
cor(gjg_UN[c("opportunityChoiceNum", "donation", "hope", "efficacy_z")], use = "complete.obs")
## opportunityChoiceNum donation hope efficacy_z
## opportunityChoiceNum 1.0000000 0.2927949 0.2745827 0.3255522
## donation 0.2927949 1.0000000 0.3566855 0.3508152
## hope 0.2745827 0.3566855 1.0000000 0.6755137
## efficacy_z 0.3255522 0.3508152 0.6755137 1.0000000
corr_DVs
## clickedNum opportunityChoiceNum donation lifestylePG
## clickedNum 1.00000000 0.223565244 0.17584527 0.06904189
## opportunityChoiceNum 0.22356524 1.000000000 0.34386116 0.23957930
## donation 0.17584527 0.343861160 1.00000000 0.27777367
## lifestylePG 0.06904189 0.239579300 0.27777367 1.00000000
## thankfulPG 0.03635922 0.205892477 0.25251283 0.77142359
## sacrificesPG 0.06234723 0.224358539 0.23734857 0.81326555
## gratitudePG 0.05730561 0.119605409 0.22578211 0.62284336
## futureImpact 0.08598344 0.333453696 0.33863672 0.40055029
## futureSacrifice 0.09053980 0.367007863 0.33509956 0.41452459
## futureResponsibility 0.10031445 0.355187564 0.38523046 0.45891138
## moralMitigate 0.05162410 0.323567798 0.27298451 0.36977254
## moralProtect 0.06901868 0.220152420 0.20668754 0.17438172
## moralCollective 0.09778192 0.356179235 0.34240769 0.37959231
## effortEfficacy 0.07298732 0.316229801 0.34591601 0.47443926
## dayToDayEfficacy 0.04154100 0.167879411 0.22843775 0.22273469
## americansEfficacy1 0.05438499 0.258345199 0.32085217 0.43821037
## americansEfficacy2 0.05265482 0.270637885 0.35880770 0.41095092
## optimism 0.06190042 0.246213116 0.30991026 0.44728929
## hope 0.06769856 0.253514295 0.33484792 0.39894290
## intergenerational1 0.07633551 0.276109983 0.27287847 0.36009654
## intergenerational2 0.04850869 0.196752313 0.23224810 0.39842478
## american1 0.06645417 -0.011777916 0.06087064 0.14819486
## american2 0.05484758 0.007765614 0.04546007 0.27817881
## pol 0.03552843 0.133503122 0.15143856 0.03035328
## edu 0.04176275 0.115753426 0.03288200 -0.01215997
## inc 0.09247762 0.039345381 0.02440624 -0.06111515
## thankfulPG sacrificesPG gratitudePG futureImpact
## clickedNum 0.03635922 0.06234723 0.057305608 0.08598344
## opportunityChoiceNum 0.20589248 0.22435854 0.119605409 0.33345370
## donation 0.25251283 0.23734857 0.225782114 0.33863672
## lifestylePG 0.77142359 0.81326555 0.622843365 0.40055029
## thankfulPG 1.00000000 0.83258867 0.645325285 0.39475630
## sacrificesPG 0.83258867 1.00000000 0.647961538 0.36548784
## gratitudePG 0.64532528 0.64796154 1.000000000 0.28223374
## futureImpact 0.39475630 0.36548784 0.282233737 1.00000000
## futureSacrifice 0.38805584 0.35780350 0.331037075 0.76154554
## futureResponsibility 0.44027532 0.42090082 0.401260692 0.73447121
## moralMitigate 0.30385726 0.31023488 0.195576848 0.59009825
## moralProtect 0.17962248 0.16419488 0.178382694 0.35388650
## moralCollective 0.36244018 0.36823788 0.224711803 0.68183068
## effortEfficacy 0.45159805 0.45583489 0.432536968 0.56320358
## dayToDayEfficacy 0.20923535 0.20482374 0.147341525 0.39543712
## americansEfficacy1 0.41287590 0.42289916 0.417725693 0.50881226
## americansEfficacy2 0.40788310 0.38598723 0.379168179 0.54768897
## optimism 0.42804051 0.44777406 0.395458655 0.44311959
## hope 0.38511921 0.37054613 0.377698790 0.51585769
## intergenerational1 0.34475437 0.33164408 0.400046046 0.50769229
## intergenerational2 0.41619483 0.40577367 0.584327152 0.34537121
## american1 0.18729208 0.18952361 0.302824333 0.06378975
## american2 0.28388629 0.30709833 0.443613728 0.08500825
## pol 0.02635570 0.02233087 -0.138354794 0.28717089
## edu -0.04092786 -0.03866068 -0.021600422 0.10432835
## inc -0.03812066 -0.07701029 -0.009086097 0.01268188
## futureSacrifice futureResponsibility moralMitigate
## clickedNum 0.09053980 0.10031445 0.05162410
## opportunityChoiceNum 0.36700786 0.35518756 0.32356780
## donation 0.33509956 0.38523046 0.27298451
## lifestylePG 0.41452459 0.45891138 0.36977254
## thankfulPG 0.38805584 0.44027532 0.30385726
## sacrificesPG 0.35780350 0.42090082 0.31023488
## gratitudePG 0.33103708 0.40126069 0.19557685
## futureImpact 0.76154554 0.73447121 0.59009825
## futureSacrifice 1.00000000 0.74727412 0.54069053
## futureResponsibility 0.74727412 1.00000000 0.56969826
## moralMitigate 0.54069053 0.56969826 1.00000000
## moralProtect 0.35562160 0.35571289 0.29796978
## moralCollective 0.62242427 0.60499115 0.64190303
## effortEfficacy 0.52100348 0.59381081 0.45005194
## dayToDayEfficacy 0.33735860 0.30718787 0.28291892
## americansEfficacy1 0.43086216 0.52333781 0.37802399
## americansEfficacy2 0.47856726 0.54594908 0.40932174
## optimism 0.40400333 0.43250645 0.31637892
## hope 0.46773672 0.49115619 0.33406439
## intergenerational1 0.53348798 0.53776217 0.31419735
## intergenerational2 0.40108434 0.44357905 0.20140832
## american1 0.03801299 0.07066614 -0.07639443
## american2 0.08701251 0.16556608 -0.02517712
## pol 0.19595066 0.20077326 0.30756644
## edu 0.06049997 0.08048238 0.06996191
## inc 0.01853793 0.02991982 0.01298359
## moralProtect moralCollective effortEfficacy
## clickedNum 0.06901868 0.09778192 0.072987321
## opportunityChoiceNum 0.22015242 0.35617923 0.316229801
## donation 0.20668754 0.34240769 0.345916008
## lifestylePG 0.17438172 0.37959231 0.474439258
## thankfulPG 0.17962248 0.36244018 0.451598047
## sacrificesPG 0.16419488 0.36823788 0.455834889
## gratitudePG 0.17838269 0.22471180 0.432536968
## futureImpact 0.35388650 0.68183068 0.563203578
## futureSacrifice 0.35562160 0.62242427 0.521003485
## futureResponsibility 0.35571289 0.60499115 0.593810813
## moralMitigate 0.29796978 0.64190303 0.450051938
## moralProtect 1.00000000 0.37453733 0.295266967
## moralCollective 0.37453733 1.00000000 0.526194832
## effortEfficacy 0.29526697 0.52619483 1.000000000
## dayToDayEfficacy 0.30043425 0.40395697 0.355468596
## americansEfficacy1 0.25471693 0.48274029 0.752571465
## americansEfficacy2 0.26901478 0.53215510 0.698004266
## optimism 0.19344935 0.41889637 0.587270898
## hope 0.24190540 0.48727193 0.588227248
## intergenerational1 0.26441090 0.34768852 0.464652313
## intergenerational2 0.17628160 0.22021384 0.440510899
## american1 -0.01873967 -0.05201063 0.144483063
## american2 -0.01491764 -0.03771586 0.231787205
## pol 0.16773737 0.40126503 0.125985252
## edu 0.02716211 0.11302159 0.037441346
## inc -0.02157074 -0.05076442 -0.008493033
## dayToDayEfficacy americansEfficacy1 americansEfficacy2
## clickedNum 0.04154100 0.054384986 0.052654822
## opportunityChoiceNum 0.16787941 0.258345199 0.270637885
## donation 0.22843775 0.320852167 0.358807704
## lifestylePG 0.22273469 0.438210365 0.410950921
## thankfulPG 0.20923535 0.412875903 0.407883096
## sacrificesPG 0.20482374 0.422899164 0.385987228
## gratitudePG 0.14734152 0.417725693 0.379168179
## futureImpact 0.39543712 0.508812261 0.547688969
## futureSacrifice 0.33735860 0.430862155 0.478567258
## futureResponsibility 0.30718787 0.523337809 0.545949085
## moralMitigate 0.28291892 0.378023990 0.409321745
## moralProtect 0.30043425 0.254716932 0.269014777
## moralCollective 0.40395697 0.482740292 0.532155096
## effortEfficacy 0.35546860 0.752571465 0.698004266
## dayToDayEfficacy 1.00000000 0.310081001 0.333083582
## americansEfficacy1 0.31008100 1.000000000 0.793704798
## americansEfficacy2 0.33308358 0.793704798 1.000000000
## optimism 0.24568296 0.630419683 0.585393712
## hope 0.29341056 0.595326786 0.614102869
## intergenerational1 0.26813937 0.404540019 0.395507653
## intergenerational2 0.17133745 0.376197653 0.370394494
## american1 0.02484657 0.154251196 0.105522856
## american2 0.01628032 0.193667076 0.143638706
## pol 0.19776572 0.107726384 0.168589574
## edu 0.04781688 0.006376006 0.005159339
## inc 0.03536867 -0.035867530 -0.044623870
## optimism hope intergenerational1
## clickedNum 0.06190042 0.067698562 0.07633551
## opportunityChoiceNum 0.24621312 0.253514295 0.27610998
## donation 0.30991026 0.334847922 0.27287847
## lifestylePG 0.44728929 0.398942904 0.36009654
## thankfulPG 0.42804051 0.385119214 0.34475437
## sacrificesPG 0.44777406 0.370546125 0.33164408
## gratitudePG 0.39545866 0.377698790 0.40004605
## futureImpact 0.44311959 0.515857693 0.50769229
## futureSacrifice 0.40400333 0.467736718 0.53348798
## futureResponsibility 0.43250645 0.491156192 0.53776217
## moralMitigate 0.31637892 0.334064391 0.31419735
## moralProtect 0.19344935 0.241905398 0.26441090
## moralCollective 0.41889637 0.487271935 0.34768852
## effortEfficacy 0.58727090 0.588227248 0.46465231
## dayToDayEfficacy 0.24568296 0.293410562 0.26813937
## americansEfficacy1 0.63041968 0.595326786 0.40454002
## americansEfficacy2 0.58539371 0.614102869 0.39550765
## optimism 1.00000000 0.727276644 0.36438842
## hope 0.72727664 1.000000000 0.40136179
## intergenerational1 0.36438842 0.401361792 1.00000000
## intergenerational2 0.35341351 0.350795236 0.63078436
## american1 0.17630009 0.126066406 0.27515503
## american2 0.21041142 0.160796503 0.35454245
## pol 0.05917459 0.129110095 0.01321860
## edu 0.01246157 -0.009163106 0.08744896
## inc 0.01481467 -0.029909899 0.04622561
## intergenerational2 american1 american2 pol
## clickedNum 0.04850869 0.066454172 0.054847577 0.03552843
## opportunityChoiceNum 0.19675231 -0.011777916 0.007765614 0.13350312
## donation 0.23224810 0.060870642 0.045460072 0.15143856
## lifestylePG 0.39842478 0.148194864 0.278178805 0.03035328
## thankfulPG 0.41619483 0.187292084 0.283886287 0.02635570
## sacrificesPG 0.40577367 0.189523613 0.307098327 0.02233087
## gratitudePG 0.58432715 0.302824333 0.443613728 -0.13835479
## futureImpact 0.34537121 0.063789751 0.085008251 0.28717089
## futureSacrifice 0.40108434 0.038012988 0.087012509 0.19595066
## futureResponsibility 0.44357905 0.070666139 0.165566076 0.20077326
## moralMitigate 0.20140832 -0.076394434 -0.025177118 0.30756644
## moralProtect 0.17628160 -0.018739666 -0.014917642 0.16773737
## moralCollective 0.22021384 -0.052010626 -0.037715862 0.40126503
## effortEfficacy 0.44051090 0.144483063 0.231787205 0.12598525
## dayToDayEfficacy 0.17133745 0.024846566 0.016280319 0.19776572
## americansEfficacy1 0.37619765 0.154251196 0.193667076 0.10772638
## americansEfficacy2 0.37039449 0.105522856 0.143638706 0.16858957
## optimism 0.35341351 0.176300091 0.210411422 0.05917459
## hope 0.35079524 0.126066406 0.160796503 0.12911010
## intergenerational1 0.63078436 0.275155033 0.354542454 0.01321860
## intergenerational2 1.00000000 0.366040120 0.487194504 -0.10968949
## american1 0.36604012 1.000000000 0.701785363 -0.29572259
## american2 0.48719450 0.701785363 1.000000000 -0.37687836
## pol -0.10968949 -0.295722588 -0.376878363 1.00000000
## edu 0.04972113 0.008562118 0.065689841 0.09732617
## inc 0.04101062 0.075913916 0.135522755 -0.10291485
## edu inc
## clickedNum 0.041762755 0.092477619
## opportunityChoiceNum 0.115753426 0.039345381
## donation 0.032881996 0.024406235
## lifestylePG -0.012159965 -0.061115154
## thankfulPG -0.040927858 -0.038120659
## sacrificesPG -0.038660679 -0.077010285
## gratitudePG -0.021600422 -0.009086097
## futureImpact 0.104328350 0.012681880
## futureSacrifice 0.060499975 0.018537932
## futureResponsibility 0.080482384 0.029919820
## moralMitigate 0.069961915 0.012983590
## moralProtect 0.027162105 -0.021570745
## moralCollective 0.113021586 -0.050764416
## effortEfficacy 0.037441346 -0.008493033
## dayToDayEfficacy 0.047816881 0.035368674
## americansEfficacy1 0.006376006 -0.035867530
## americansEfficacy2 0.005159339 -0.044623870
## optimism 0.012461568 0.014814671
## hope -0.009163106 -0.029909899
## intergenerational1 0.087448957 0.046225612
## intergenerational2 0.049721130 0.041010621
## american1 0.008562118 0.075913916
## american2 0.065689841 0.135522755
## pol 0.097326169 -0.102914851
## edu 1.000000000 0.359207456
## inc 0.359207456 1.000000000
gjg$condition
## [1] uncertainSuccess assuredSuccess control uncertainSuccess
## [5] assuredSuccess control assuredSuccess assuredSuccess
## [9] control assuredSuccess uncertainSuccess control
## [13] assuredSuccess uncertainSuccess control uncertainSuccess
## [17] assuredSuccess control control control
## [21] assuredSuccess uncertainSuccess assuredSuccess control
## [25] control control uncertainSuccess uncertainSuccess
## [29] uncertainSuccess assuredSuccess assuredSuccess uncertainSuccess
## [33] control assuredSuccess uncertainSuccess assuredSuccess
## [37] uncertainSuccess control uncertainSuccess assuredSuccess
## [41] uncertainSuccess uncertainSuccess control assuredSuccess
## [45] control assuredSuccess assuredSuccess assuredSuccess
## [49] uncertainSuccess control control assuredSuccess
## [53] control uncertainSuccess uncertainSuccess assuredSuccess
## [57] assuredSuccess assuredSuccess assuredSuccess assuredSuccess
## [61] assuredSuccess control uncertainSuccess uncertainSuccess
## [65] uncertainSuccess control control uncertainSuccess
## [69] assuredSuccess uncertainSuccess control control
## [73] uncertainSuccess assuredSuccess uncertainSuccess uncertainSuccess
## [77] assuredSuccess uncertainSuccess uncertainSuccess control
## [81] assuredSuccess assuredSuccess control control
## [85] control control uncertainSuccess uncertainSuccess
## [89] uncertainSuccess assuredSuccess uncertainSuccess uncertainSuccess
## [93] assuredSuccess control assuredSuccess uncertainSuccess
## [97] uncertainSuccess uncertainSuccess control uncertainSuccess
## [101] control uncertainSuccess assuredSuccess assuredSuccess
## [105] control control uncertainSuccess uncertainSuccess
## [109] uncertainSuccess assuredSuccess assuredSuccess assuredSuccess
## [113] control uncertainSuccess assuredSuccess control
## [117] control control control assuredSuccess
## [121] control assuredSuccess uncertainSuccess control
## [125] assuredSuccess uncertainSuccess assuredSuccess control
## [129] uncertainSuccess assuredSuccess assuredSuccess control
## [133] assuredSuccess control control assuredSuccess
## [137] uncertainSuccess assuredSuccess assuredSuccess assuredSuccess
## [141] assuredSuccess control assuredSuccess control
## [145] control assuredSuccess control assuredSuccess
## [149] control control control control
## [153] uncertainSuccess assuredSuccess uncertainSuccess control
## [157] assuredSuccess uncertainSuccess control uncertainSuccess
## [161] assuredSuccess assuredSuccess uncertainSuccess control
## [165] control assuredSuccess uncertainSuccess assuredSuccess
## [169] uncertainSuccess assuredSuccess uncertainSuccess control
## [173] uncertainSuccess control control control
## [177] assuredSuccess uncertainSuccess control assuredSuccess
## [181] uncertainSuccess control control assuredSuccess
## [185] assuredSuccess assuredSuccess assuredSuccess assuredSuccess
## [189] assuredSuccess uncertainSuccess uncertainSuccess assuredSuccess
## [193] control control control assuredSuccess
## [197] uncertainSuccess uncertainSuccess uncertainSuccess uncertainSuccess
## [201] control assuredSuccess uncertainSuccess control
## [205] uncertainSuccess control control control
## [209] control assuredSuccess control uncertainSuccess
## [213] control control assuredSuccess assuredSuccess
## [217] control uncertainSuccess uncertainSuccess assuredSuccess
## [221] uncertainSuccess control uncertainSuccess uncertainSuccess
## [225] assuredSuccess assuredSuccess uncertainSuccess uncertainSuccess
## [229] control uncertainSuccess assuredSuccess control
## [233] uncertainSuccess uncertainSuccess uncertainSuccess assuredSuccess
## [237] assuredSuccess assuredSuccess assuredSuccess uncertainSuccess
## [241] control control uncertainSuccess control
## [245] control uncertainSuccess uncertainSuccess uncertainSuccess
## [249] uncertainSuccess assuredSuccess assuredSuccess uncertainSuccess
## [253] uncertainSuccess control assuredSuccess control
## [257] control uncertainSuccess control control
## [261] control uncertainSuccess control assuredSuccess
## [265] assuredSuccess uncertainSuccess control control
## [269] assuredSuccess assuredSuccess assuredSuccess assuredSuccess
## [273] assuredSuccess uncertainSuccess uncertainSuccess control
## [277] uncertainSuccess uncertainSuccess uncertainSuccess assuredSuccess
## [281] assuredSuccess control control uncertainSuccess
## [285] uncertainSuccess assuredSuccess uncertainSuccess assuredSuccess
## [289] control assuredSuccess assuredSuccess uncertainSuccess
## [293] control uncertainSuccess control uncertainSuccess
## [297] assuredSuccess uncertainSuccess assuredSuccess uncertainSuccess
## [301] assuredSuccess assuredSuccess control uncertainSuccess
## [305] control control uncertainSuccess assuredSuccess
## [309] assuredSuccess assuredSuccess control control
## [313] uncertainSuccess assuredSuccess uncertainSuccess control
## [317] control control control control
## [321] assuredSuccess uncertainSuccess control assuredSuccess
## [325] assuredSuccess control uncertainSuccess control
## [329] assuredSuccess assuredSuccess control control
## [333] assuredSuccess assuredSuccess control control
## [337] assuredSuccess uncertainSuccess uncertainSuccess assuredSuccess
## [341] assuredSuccess uncertainSuccess uncertainSuccess control
## [345] control uncertainSuccess control uncertainSuccess
## [349] uncertainSuccess uncertainSuccess control control
## [353] uncertainSuccess assuredSuccess assuredSuccess control
## [357] assuredSuccess assuredSuccess assuredSuccess uncertainSuccess
## [361] control uncertainSuccess control control
## [365] assuredSuccess assuredSuccess uncertainSuccess control
## [369] assuredSuccess assuredSuccess assuredSuccess control
## [373] uncertainSuccess assuredSuccess assuredSuccess control
## [377] uncertainSuccess assuredSuccess control uncertainSuccess
## [381] assuredSuccess uncertainSuccess assuredSuccess uncertainSuccess
## [385] control uncertainSuccess assuredSuccess uncertainSuccess
## [389] assuredSuccess assuredSuccess control uncertainSuccess
## [393] control uncertainSuccess uncertainSuccess assuredSuccess
## [397] assuredSuccess control uncertainSuccess control
## [401] assuredSuccess uncertainSuccess control uncertainSuccess
## [405] assuredSuccess control control assuredSuccess
## [409] uncertainSuccess uncertainSuccess control control
## [413] uncertainSuccess assuredSuccess control control
## [417] control control assuredSuccess control
## [421] uncertainSuccess assuredSuccess uncertainSuccess uncertainSuccess
## [425] uncertainSuccess control control control
## [429] uncertainSuccess control uncertainSuccess control
## [433] uncertainSuccess uncertainSuccess control control
## [437] uncertainSuccess uncertainSuccess control assuredSuccess
## [441] assuredSuccess assuredSuccess control assuredSuccess
## [445] assuredSuccess uncertainSuccess assuredSuccess assuredSuccess
## [449] assuredSuccess control assuredSuccess assuredSuccess
## [453] uncertainSuccess assuredSuccess control uncertainSuccess
## [457] assuredSuccess assuredSuccess control uncertainSuccess
## [461] uncertainSuccess uncertainSuccess assuredSuccess control
## [465] uncertainSuccess assuredSuccess assuredSuccess uncertainSuccess
## [469] uncertainSuccess assuredSuccess control assuredSuccess
## [473] uncertainSuccess control control uncertainSuccess
## [477] assuredSuccess uncertainSuccess uncertainSuccess control
## [481] uncertainSuccess uncertainSuccess assuredSuccess assuredSuccess
## [485] control control uncertainSuccess uncertainSuccess
## [489] assuredSuccess assuredSuccess uncertainSuccess uncertainSuccess
## [493] uncertainSuccess control control assuredSuccess
## [497] uncertainSuccess control uncertainSuccess uncertainSuccess
## [501] control control uncertainSuccess uncertainSuccess
## [505] assuredSuccess control assuredSuccess control
## [509] control control uncertainSuccess assuredSuccess
## [513] uncertainSuccess uncertainSuccess uncertainSuccess assuredSuccess
## [517] uncertainSuccess assuredSuccess control assuredSuccess
## [521] uncertainSuccess uncertainSuccess assuredSuccess assuredSuccess
## [525] control assuredSuccess uncertainSuccess uncertainSuccess
## [529] uncertainSuccess uncertainSuccess control uncertainSuccess
## [533] assuredSuccess uncertainSuccess assuredSuccess uncertainSuccess
## [537] assuredSuccess assuredSuccess assuredSuccess uncertainSuccess
## [541] uncertainSuccess assuredSuccess control assuredSuccess
## [545] uncertainSuccess control control uncertainSuccess
## [549] assuredSuccess assuredSuccess uncertainSuccess control
## [553] uncertainSuccess assuredSuccess uncertainSuccess control
## [557] control uncertainSuccess uncertainSuccess control
## [561] assuredSuccess uncertainSuccess uncertainSuccess uncertainSuccess
## [565] assuredSuccess control control assuredSuccess
## [569] assuredSuccess assuredSuccess control assuredSuccess
## [573] assuredSuccess assuredSuccess control assuredSuccess
## [577] assuredSuccess uncertainSuccess uncertainSuccess assuredSuccess
## [581] uncertainSuccess control control uncertainSuccess
## [585] assuredSuccess control control assuredSuccess
## [589] control assuredSuccess control assuredSuccess
## [593] uncertainSuccess uncertainSuccess uncertainSuccess uncertainSuccess
## [597] control control assuredSuccess control
## [601] assuredSuccess control uncertainSuccess assuredSuccess
## [605] assuredSuccess uncertainSuccess uncertainSuccess control
## [609] assuredSuccess uncertainSuccess assuredSuccess uncertainSuccess
## [613] uncertainSuccess control control control
## [617] assuredSuccess assuredSuccess control uncertainSuccess
## [621] assuredSuccess control control uncertainSuccess
## [625] control uncertainSuccess assuredSuccess assuredSuccess
## [629] uncertainSuccess control control uncertainSuccess
## [633] assuredSuccess assuredSuccess control assuredSuccess
## [637] assuredSuccess control control uncertainSuccess
## [641] assuredSuccess control assuredSuccess uncertainSuccess
## [645] uncertainSuccess uncertainSuccess assuredSuccess control
## [649] control control control uncertainSuccess
## [653] uncertainSuccess uncertainSuccess control assuredSuccess
## [657] assuredSuccess assuredSuccess assuredSuccess assuredSuccess
## [661] control control assuredSuccess control
## [665] assuredSuccess control control assuredSuccess
## [669] assuredSuccess assuredSuccess control assuredSuccess
## [673] assuredSuccess control uncertainSuccess assuredSuccess
## [677] uncertainSuccess control assuredSuccess assuredSuccess
## [681] control uncertainSuccess control assuredSuccess
## [685] control control assuredSuccess uncertainSuccess
## [689] assuredSuccess control control assuredSuccess
## [693] control uncertainSuccess assuredSuccess uncertainSuccess
## [697] assuredSuccess uncertainSuccess assuredSuccess uncertainSuccess
## [701] control assuredSuccess uncertainSuccess assuredSuccess
## [705] control assuredSuccess assuredSuccess control
## [709] control uncertainSuccess control uncertainSuccess
## [713] uncertainSuccess control uncertainSuccess control
## [717] control control uncertainSuccess control
## [721] uncertainSuccess control uncertainSuccess uncertainSuccess
## [725] control assuredSuccess assuredSuccess assuredSuccess
## [729] assuredSuccess control control control
## [733] control uncertainSuccess uncertainSuccess assuredSuccess
## [737] uncertainSuccess control assuredSuccess control
## [741] assuredSuccess control assuredSuccess uncertainSuccess
## [745] uncertainSuccess assuredSuccess assuredSuccess assuredSuccess
## [749] uncertainSuccess control uncertainSuccess uncertainSuccess
## [753] control control uncertainSuccess assuredSuccess
## [757] control uncertainSuccess control uncertainSuccess
## [761] control assuredSuccess uncertainSuccess control
## [765] control assuredSuccess control uncertainSuccess
## [769] assuredSuccess control control assuredSuccess
## [773] assuredSuccess control assuredSuccess control
## [777] assuredSuccess uncertainSuccess uncertainSuccess uncertainSuccess
## [781] assuredSuccess assuredSuccess control uncertainSuccess
## [785] control uncertainSuccess control assuredSuccess
## [789] uncertainSuccess assuredSuccess assuredSuccess uncertainSuccess
## [793] assuredSuccess control uncertainSuccess assuredSuccess
## [797] uncertainSuccess uncertainSuccess uncertainSuccess uncertainSuccess
## [801] assuredSuccess control uncertainSuccess assuredSuccess
## [805] assuredSuccess uncertainSuccess control assuredSuccess
## [809] assuredSuccess control control uncertainSuccess
## [813] control assuredSuccess uncertainSuccess uncertainSuccess
## [817] assuredSuccess control uncertainSuccess assuredSuccess
## [821] uncertainSuccess uncertainSuccess assuredSuccess assuredSuccess
## [825] uncertainSuccess control uncertainSuccess control
## [829] uncertainSuccess assuredSuccess control uncertainSuccess
## [833] control assuredSuccess assuredSuccess uncertainSuccess
## [837] assuredSuccess control assuredSuccess uncertainSuccess
## [841] control uncertainSuccess uncertainSuccess uncertainSuccess
## [845] control control control assuredSuccess
## [849] assuredSuccess assuredSuccess control uncertainSuccess
## [853] uncertainSuccess uncertainSuccess assuredSuccess control
## [857] assuredSuccess uncertainSuccess uncertainSuccess control
## [861] assuredSuccess uncertainSuccess control assuredSuccess
## [865] control assuredSuccess assuredSuccess control
## [869] control control control control
## [873] uncertainSuccess control uncertainSuccess assuredSuccess
## [877] control uncertainSuccess uncertainSuccess uncertainSuccess
## [881] control assuredSuccess control control
## [885] uncertainSuccess assuredSuccess control
## Levels: control assuredSuccess uncertainSuccess
factorCor <- cor(factorDVs, use = "complete.obs")
# Assuming you have a correlation matrix named "correlation_matrix"
correlation_threshold <- 0.8
high_correlations <- which(factorCor > correlation_threshold & upper.tri(factorCor, diag = FALSE), arr.ind = TRUE)
# Extract the row and column indices of high correlations
row_indices <- high_correlations[, 1]
column_indices <- high_correlations[, 2]
# Extract the correlations greater than 0.8
high_correlation_values <- factorCor[high_correlations]
# Print the results
high_correlation_results <- data.frame(row_indices, column_indices, high_correlation_values)
print(high_correlation_results)
## row_indices column_indices high_correlation_values
## lifestylePG 4 6 0.8132656
## thankfulPG 5 6 0.8325887
# removing one from all pairs of overcorrelated variables
# overcorrelated <- c("")
# efaDVs <- factorDVs[ ,!(names(factorDVs) %in% overcorrelated)]
efaDVs <- factorDVs
Scree plot suggests 2 or 5 factors
Parallel Analysis and the eigenvalue method suggests 5
## evaluating data
corr_DVs = cor(efaDVs, use="complete.obs")
KMO(efaDVs)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = efaDVs)
## Overall MSA = 0.92
## MSA for each item =
## clickedNum opportunityChoiceNum donation
## 0.76 0.93 0.95
## lifestylePG thankfulPG sacrificesPG
## 0.93 0.92 0.89
## gratitudePG futureImpact futureSacrifice
## 0.94 0.94 0.94
## futureResponsibility moralMitigate moralProtect
## 0.95 0.94 0.96
## moralCollective effortEfficacy dayToDayEfficacy
## 0.95 0.96 0.95
## americansEfficacy1 americansEfficacy2 optimism
## 0.91 0.93 0.92
## hope intergenerational1 intergenerational2
## 0.92 0.94 0.91
## american1 american2
## 0.71 0.77
cortest.bartlett(efaDVs) #tests correlations between variables
## $chisq
## [1] 12492.22
##
## $p.value
## [1] 0
##
## $df
## [1] 253
##
ev<-eigen(corr_DVs) #gets eigenvalues (variance explained by each component)
ev$values
## [1] 8.9514477 2.5425500 1.4634594 1.3137353 1.1392481 0.8798734 0.7781634
## [8] 0.7271941 0.6746163 0.6411359 0.5998590 0.4643593 0.3936945 0.3452234
## [15] 0.2929541 0.2847747 0.2663680 0.2533914 0.2353183 0.2235503 0.2077649
## [22] 0.1721090 0.1492095
scree(factorDVs, pc = FALSE) #number of factors until plot levels off
fa.parallel(factorDVs, fa="fa") #checks eigenvalues of factors against eigenvalues of identity (no correlation) matrix
## Parallel analysis suggests that the number of factors = 5 and the number of components = NA
dat_fa <- na.omit(DVs)
fit <- factanal(na.omit(efaDVs), factors=5, rotation="promax", scores = "regression")
print(fit, digits = 2, cutoff = .3, sort = TRUE)
##
## Call:
## factanal(x = na.omit(efaDVs), factors = 5, scores = "regression", rotation = "promax")
##
## Uniquenesses:
## clickedNum opportunityChoiceNum donation
## 0.98 0.81 0.80
## lifestylePG thankfulPG sacrificesPG
## 0.24 0.21 0.13
## gratitudePG futureImpact futureSacrifice
## 0.40 0.25 0.25
## futureResponsibility moralMitigate moralProtect
## 0.27 0.51 0.81
## moralCollective effortEfficacy dayToDayEfficacy
## 0.38 0.30 0.80
## americansEfficacy1 americansEfficacy2 optimism
## 0.11 0.27 0.38
## hope intergenerational1 intergenerational2
## 0.00 0.48 0.48
## american1 american2
## 0.43 0.26
##
## Loadings:
## Factor1 Factor2 Factor3 Factor4 Factor5
## futureImpact 0.90
## futureSacrifice 0.99
## futureResponsibility 0.84
## moralMitigate 0.71
## moralCollective 0.70
## intergenerational1 0.57 0.42
## lifestylePG 0.88
## thankfulPG 0.92
## sacrificesPG 1.01
## gratitudePG 0.56 0.30
## effortEfficacy 0.66
## americansEfficacy1 1.11
## americansEfficacy2 0.82
## intergenerational2 0.54
## american1 0.80
## american2 0.88
## hope 1.04
## clickedNum
## opportunityChoiceNum 0.42
## donation 0.30
## moralProtect 0.45
## dayToDayEfficacy 0.35
## optimism 0.31 0.48
##
## Factor1 Factor2 Factor3 Factor4 Factor5
## SS loadings 4.6 3.00 2.51 2.10 1.35
## Proportion Var 0.2 0.13 0.11 0.09 0.06
## Cumulative Var 0.2 0.33 0.44 0.53 0.59
##
## Factor Correlations:
## Factor1 Factor2 Factor3 Factor4 Factor5
## Factor1 1.00 0.50 -0.58 0.73 -0.32
## Factor2 0.50 1.00 -0.56 0.58 -0.45
## Factor3 -0.58 -0.56 1.00 -0.71 0.25
## Factor4 0.73 0.58 -0.71 1.00 -0.33
## Factor5 -0.32 -0.45 0.25 -0.33 1.00
##
## Test of the hypothesis that 5 factors are sufficient.
## The chi square statistic is 614.9 on 148 degrees of freedom.
## The p-value is 3.55e-58
loads <- fit$loadings
fa.diagram(loads)
## Cronbach's Alpha
f1 <- efaDVs[ , c("futureSacrifice", "futureImpact", "futureResponsibility", "moralMitigate",
"moralCollective", "intergenerational1", "opportunityChoiceNum", "donation", "moralProtect", "dayToDayEfficacy")]
f2 <- efaDVs[ , c("effortEfficacy", "americansEfficacy1", "americansEfficacy2", "optimism")]
f3 <- efaDVs[ , c("thankfulPG", "sacrificesPG", "gratitudePG")]
f4 <- efaDVs[ , c("intergenerational1", "intergenerational2", "american1", "american2")]
f5 <- efaDVs[ , c("hope", "optimism")]
alpha(f1)
##
## Reliability analysis
## Call: alpha(x = f1)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.56 0.87 0.88 0.4 6.8 0.016 4.5 1.7 0.35
##
## 95% confidence boundaries
## lower alpha upper
## Feldt 0.51 0.56 0.60
## Duhachek 0.53 0.56 0.59
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r
## futureSacrifice 0.51 0.84 0.85 0.38 5.4 0.0163 0.020
## futureImpact 0.50 0.84 0.85 0.37 5.4 0.0163 0.019
## futureResponsibility 0.51 0.84 0.85 0.38 5.4 0.0165 0.020
## moralMitigate 0.51 0.86 0.86 0.40 5.9 0.0162 0.024
## moralCollective 0.50 0.85 0.85 0.38 5.6 0.0164 0.023
## intergenerational1 0.52 0.86 0.87 0.41 6.3 0.0163 0.026
## opportunityChoiceNum 0.55 0.87 0.88 0.43 6.7 0.0162 0.026
## donation 0.86 0.87 0.88 0.43 6.7 0.0064 0.026
## moralProtect 0.53 0.87 0.88 0.43 6.8 0.0160 0.026
## dayToDayEfficacy 0.53 0.87 0.88 0.43 6.8 0.0162 0.025
## med.r
## futureSacrifice 0.34
## futureImpact 0.34
## futureResponsibility 0.34
## moralMitigate 0.35
## moralCollective 0.34
## intergenerational1 0.35
## opportunityChoiceNum 0.35
## donation 0.36
## moralProtect 0.36
## dayToDayEfficacy 0.35
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## futureSacrifice 887 0.66 0.82 0.83 0.61 5.14 1.46
## futureImpact 887 0.67 0.84 0.85 0.62 5.39 1.45
## futureResponsibility 887 0.69 0.82 0.83 0.65 3.40 1.18
## moralMitigate 885 0.57 0.71 0.68 0.49 4.26 1.75
## moralCollective 887 0.65 0.79 0.78 0.59 5.29 1.53
## intergenerational1 887 0.52 0.64 0.58 0.45 4.89 1.57
## opportunityChoiceNum 887 0.47 0.55 0.46 0.45 0.32 0.47
## donation 886 0.88 0.55 0.46 0.41 8.77 11.09
## moralProtect 887 0.44 0.55 0.46 0.35 4.18 1.73
## dayToDayEfficacy 887 0.44 0.54 0.46 0.37 3.56 1.27
##
## Non missing response frequency for each item
## 0 1 2 3 4 5 6 7 miss
## futureSacrifice 0.00 0.03 0.04 0.05 0.13 0.31 0.27 0.17 0
## futureImpact 0.00 0.03 0.03 0.02 0.10 0.26 0.33 0.22 0
## futureResponsibility 0.00 0.08 0.14 0.27 0.32 0.19 0.00 0.00 0
## moralMitigate 0.00 0.09 0.11 0.11 0.22 0.20 0.18 0.10 0
## moralCollective 0.00 0.03 0.04 0.04 0.13 0.24 0.28 0.24 0
## intergenerational1 0.00 0.05 0.06 0.07 0.13 0.31 0.25 0.14 0
## opportunityChoiceNum 0.68 0.32 0.00 0.00 0.00 0.00 0.00 0.00 0
## moralProtect 0.00 0.06 0.14 0.17 0.19 0.15 0.19 0.09 0
## dayToDayEfficacy 0.00 0.08 0.14 0.22 0.26 0.30 0.00 0.00 0
alpha(f2)
##
## Reliability analysis
## Call: alpha(x = f2)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.88 0.89 0.87 0.67 8.3 0.0068 3.6 1.1 0.66
##
## 95% confidence boundaries
## lower alpha upper
## Feldt 0.86 0.88 0.89
## Duhachek 0.86 0.88 0.89
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r
## effortEfficacy 0.83 0.86 0.82 0.67 6.1 0.0096 0.0121
## americansEfficacy1 0.81 0.83 0.77 0.62 5.0 0.0107 0.0042
## americansEfficacy2 0.83 0.85 0.80 0.66 5.7 0.0097 0.0073
## optimism 0.90 0.90 0.86 0.75 8.9 0.0059 0.0023
## med.r
## effortEfficacy 0.63
## americansEfficacy1 0.59
## americansEfficacy2 0.63
## optimism 0.75
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## effortEfficacy 887 0.86 0.87 0.82 0.76 2.9 1.2
## americansEfficacy1 887 0.90 0.91 0.89 0.83 3.2 1.2
## americansEfficacy2 887 0.87 0.88 0.84 0.77 3.4 1.2
## optimism 887 0.84 0.81 0.69 0.66 4.8 1.7
##
## Non missing response frequency for each item
## 1 2 3 4 5 6 7 miss
## effortEfficacy 0.14 0.25 0.28 0.22 0.12 0.00 0.00 0
## americansEfficacy1 0.09 0.19 0.28 0.28 0.16 0.00 0.00 0
## americansEfficacy2 0.08 0.15 0.28 0.31 0.18 0.00 0.00 0
## optimism 0.06 0.07 0.08 0.14 0.27 0.23 0.15 0
alpha(f3)
##
## Reliability analysis
## Call: alpha(x = f3)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.88 0.88 0.85 0.71 7.3 0.0066 4.5 1.4 0.65
##
## 95% confidence boundaries
## lower alpha upper
## Feldt 0.86 0.88 0.89
## Duhachek 0.86 0.88 0.89
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## thankfulPG 0.76 0.79 0.65 0.65 3.7 0.0147 NA 0.65
## sacrificesPG 0.76 0.78 0.64 0.64 3.6 0.0148 NA 0.64
## gratitudePG 0.91 0.91 0.83 0.83 9.9 0.0062 NA 0.83
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## thankfulPG 887 0.93 0.92 0.88 0.83 5.2 1.6
## sacrificesPG 887 0.94 0.92 0.89 0.83 4.9 1.7
## gratitudePG 886 0.82 0.85 0.71 0.68 3.6 1.2
##
## Non missing response frequency for each item
## 1 2 3 4 5 6 7 miss
## thankfulPG 0.04 0.05 0.06 0.14 0.21 0.28 0.22 0
## sacrificesPG 0.05 0.08 0.09 0.12 0.24 0.25 0.18 0
## gratitudePG 0.06 0.14 0.24 0.29 0.27 0.00 0.00 0
alpha(f4)
##
## Reliability analysis
## Call: alpha(x = f4)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.77 0.78 0.78 0.47 3.5 0.013 4.7 1.1 0.43
##
## 95% confidence boundaries
## lower alpha upper
## Feldt 0.74 0.77 0.79
## Duhachek 0.74 0.77 0.79
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r
## intergenerational1 0.76 0.76 0.72 0.52 3.2 0.013 0.029
## intergenerational2 0.69 0.71 0.67 0.44 2.4 0.018 0.051
## american1 0.71 0.74 0.68 0.49 2.9 0.017 0.019
## american2 0.68 0.69 0.63 0.42 2.2 0.018 0.034
## med.r
## intergenerational1 0.49
## intergenerational2 0.36
## american1 0.49
## american2 0.37
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## intergenerational1 887 0.73 0.73 0.60 0.49 4.9 1.6
## intergenerational2 887 0.78 0.80 0.71 0.63 3.2 1.2
## american1 887 0.75 0.76 0.67 0.58 5.9 1.3
## american2 887 0.84 0.82 0.76 0.64 4.9 1.8
##
## Non missing response frequency for each item
## 1 2 3 4 5 6 7 miss
## intergenerational1 0.05 0.06 0.07 0.13 0.31 0.25 0.14 0
## intergenerational2 0.09 0.17 0.30 0.28 0.16 0.00 0.00 0
## american1 0.01 0.02 0.02 0.06 0.16 0.39 0.34 0
## american2 0.06 0.08 0.07 0.13 0.20 0.26 0.20 0
alpha(f5)
##
## Reliability analysis
## Call: alpha(x = f5)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.82 0.84 0.73 0.73 5.3 0.011 4.2 1.4 0.73
##
## 95% confidence boundaries
## lower alpha upper
## Feldt 0.8 0.82 0.84
## Duhachek 0.8 0.82 0.84
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## hope 0.54 0.73 0.53 0.73 2.7 NA 0 0.73
## optimism 0.98 0.73 0.53 0.73 2.7 NA 0 0.73
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## hope 887 0.91 0.93 0.79 0.73 3.6 1.2
## optimism 887 0.95 0.93 0.79 0.73 4.8 1.7
##
## Non missing response frequency for each item
## 1 2 3 4 5 6 7 miss
## hope 0.08 0.12 0.23 0.28 0.29 0.00 0.00 0
## optimism 0.06 0.07 0.08 0.14 0.27 0.23 0.15 0
model <- '
gratitude =~ thankfulPG + sacrificesPG + gratitudePG + lifestylePG
obligation =~ futureSacrifice + futureImpact + futureResponsibility
moralToAct =~ moralMitigate + moralCollective + moralProtect
efficacy =~ effortEfficacy + dayToDayEfficacy + americansEfficacy1 + americansEfficacy2
HP =~ hope + optimism
generationalIdentity =~ intergenerational1 + intergenerational2 + american1 + american2
'
fit <- cfa(model, data = factorDVs)
summary(fit, fit.measures=TRUE)
## lavaan 0.6.15 ended normally after 57 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 55
##
## Used Total
## Number of observations 884 887
##
## Model Test User Model:
##
## Test statistic 1289.864
## Degrees of freedom 155
## P-value (Chi-square) 0.000
##
## Model Test Baseline Model:
##
## Test statistic 12083.782
## Degrees of freedom 190
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.905
## Tucker-Lewis Index (TLI) 0.883
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -25944.175
## Loglikelihood unrestricted model (H1) -25299.243
##
## Akaike (AIC) 51998.349
## Bayesian (BIC) 52261.495
## Sample-size adjusted Bayesian (SABIC) 52086.826
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.091
## 90 Percent confidence interval - lower 0.086
## 90 Percent confidence interval - upper 0.096
## P-value H_0: RMSEA <= 0.050 0.000
## P-value H_0: RMSEA >= 0.080 1.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.077
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|)
## gratitude =~
## thankfulPG 1.000
## sacrificesPG 1.085 0.026 41.554 0.000
## gratitudePG 0.603 0.023 26.259 0.000
## lifestylePG 1.031 0.028 37.328 0.000
## obligation =~
## futureSacrific 1.000
## futureImpact 1.019 0.030 33.771 0.000
## futurRspnsblty 0.805 0.025 32.545 0.000
## moralToAct =~
## moralMitigate 1.000
## moralCollectiv 1.018 0.042 23.992 0.000
## moralProtect 0.582 0.047 12.251 0.000
## efficacy =~
## effortEfficacy 1.000
## dayToDayEffccy 0.491 0.041 11.863 0.000
## amercnsEffccy1 1.033 0.031 33.392 0.000
## amercnsEffccy2 0.990 0.031 32.028 0.000
## HP =~
## hope 1.000
## optimism 1.350 0.049 27.309 0.000
## generationalIdentity =~
## intergenertnl1 1.000
## intergenertnl2 0.848 0.041 20.712 0.000
## american1 0.543 0.040 13.486 0.000
## american2 0.934 0.057 16.358 0.000
##
## Covariances:
## Estimate Std.Err z-value P(>|z|)
## gratitude ~~
## obligation 0.926 0.076 12.144 0.000
## moralToAct 0.871 0.083 10.526 0.000
## efficacy 0.815 0.064 12.762 0.000
## HP 0.826 0.067 12.329 0.000
## genertnlIdntty 0.919 0.078 11.734 0.000
## obligation ~~
## moralToAct 1.413 0.093 15.144 0.000
## efficacy 0.900 0.062 14.596 0.000
## HP 0.828 0.062 13.321 0.000
## genertnlIdntty 0.790 0.069 11.400 0.000
## moralToAct ~~
## efficacy 0.905 0.068 13.237 0.000
## HP 0.804 0.068 11.835 0.000
## genertnlIdntty 0.450 0.067 6.751 0.000
## efficacy ~~
## HP 0.883 0.057 15.595 0.000
## genertnlIdntty 0.630 0.056 11.164 0.000
## HP ~~
## genertnlIdntty 0.610 0.058 10.446 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .thankfulPG 0.518 0.035 14.854 0.000
## .sacrificesPG 0.426 0.035 12.331 0.000
## .gratitudePG 0.690 0.036 19.437 0.000
## .lifestylePG 0.675 0.042 16.065 0.000
## .futureSacrific 0.561 0.036 15.755 0.000
## .futureImpact 0.489 0.033 14.726 0.000
## .futurRspnsblty 0.366 0.023 15.798 0.000
## .moralMitigate 1.371 0.080 17.233 0.000
## .moralCollectiv 0.613 0.054 11.409 0.000
## .moralProtect 2.417 0.119 20.333 0.000
## .effortEfficacy 0.423 0.026 16.270 0.000
## .dayToDayEffccy 1.355 0.066 20.681 0.000
## .amercnsEffccy1 0.301 0.022 13.849 0.000
## .amercnsEffccy2 0.351 0.023 15.370 0.000
## .hope 0.422 0.035 12.060 0.000
## .optimism 0.766 0.064 12.022 0.000
## .intergenertnl1 1.146 0.072 15.809 0.000
## .intergenertnl2 0.445 0.038 11.663 0.000
## .american1 1.176 0.060 19.614 0.000
## .american2 1.961 0.106 18.480 0.000
## gratitude 2.060 0.123 16.799 0.000
## obligation 1.572 0.101 15.610 0.000
## moralToAct 1.675 0.137 12.212 0.000
## efficacy 1.054 0.069 15.213 0.000
## HP 1.122 0.076 14.721 0.000
## genertnlIdntty 1.329 0.115 11.580 0.000
#
# factorDVs <- gjg[c("clickedNum", "opportunityChoiceNum", "donation", "lifestylePG", "thankfulPG", "sacrificesPG","gratitudePG","futureImpact","futureSacrifice","futureResponsibility","moralMitigate", "moralProtect","moralCollective","effortEfficacy","dayToDayEfficacy", "americansEfficacy1","americansEfficacy2","optimism","hope","intergenerational1", "intergenerational2", "american1", "american2")]
#
# corr_DVs = cor(factorDVs, use="complete.obs")
# KMO(corr_DVs) #tests how suited data is for factor analysis
# cortest.bartlett(corr_DVs) #tests correlations between variables
# ev<-eigen(cor(corr_DVs)) #gets eigenvalues (variance explained by each component)
# ev$values
# 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
#
# dat_fa <- na.omit(DVs)
ggplot(gjg, aes(x = clicked, fill = condition)) +
geom_bar(position = "dodge") +
labs(title = "Frequency link is clicked by condition", x = "Clicked", y = "Frequency") +
scale_fill_manual(values = c("control" = "blue", "assuredSuccess" = "red", "uncertainSuccess" = "green"))
## Filtering participants who put invalid values for donation
gjgDonate <- gjg %>% filter(donation >= 0 & donation <= 25)
length(gjgDonate$donation)
## [1] 883
# 4 participants who put invalid values
# Calculate the percentage of participants with opportunityChoice = 1 by condition
percentage_data <- aggregate(opportunityChoice ~ condition, data = gjg, FUN = function(x) sum(x == 1) / length(x) * 100)
# Create the plot
plot <- ggplot(percentage_data, aes(x = condition, y = opportunityChoice, fill = condition)) +
geom_bar(stat = "identity", position = "dodge") +
labs(x = "Condition", y = "Percentage of participants") +
scale_fill_manual(values = c("blue", "red", "green")) + # Customize fill colors
theme_minimal()
plot
percep_plot_list <- list(plot_cooker(gjg, condition, opportunityChoiceNum, "Asking to learn about orgs"),
plot_cooker(gjgDonate, condition, donation, "Donation"))
percep_plot_arranged <- ggarrange(plotlist = percep_plot_list, ncol = 2, nrow = 1)
overall_percep_title <- ggdraw() +
draw_label("Behavioral DVs", fontface = "bold")
plot_grid(overall_percep_title, percep_plot_arranged, ncol = 1, rel_heights = c(0.1, 0.9))
summary(lm(donation ~ condition*hope, gjg))
##
## Call:
## lm(formula = donation ~ condition * hope, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -14.236 -8.048 -3.273 10.764 43.078
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -3.2432 1.6789 -1.932 0.0537 .
## conditionassuredSuccess 2.8398 2.6721 1.063 0.2882
## conditionuncertainSuccess 1.4282 2.5178 0.567 0.5707
## hope 3.2583 0.4551 7.159 1.71e-12 ***
## conditionassuredSuccess:hope -0.8165 0.7001 -1.166 0.2438
## conditionuncertainSuccess:hope -0.0482 0.6740 -0.072 0.9430
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 10.45 on 880 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.1181, Adjusted R-squared: 0.1131
## F-statistic: 23.56 on 5 and 880 DF, p-value: < 2.2e-16
pol_line(gjg, pol, opportunityChoiceNum)
pol_line(gjgDonate, pol, donation)
gjg_aRef <- gjg
gjg_aRef$condition <- relevel(gjg_aRef$condition, ref = "assuredSuccess")
mod_opportunityChoiceNum <- lm(opportunityChoiceNum ~ condition, data = gjg)
summary(mod_opportunityChoiceNum)
##
## Call:
## lm(formula = opportunityChoiceNum ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.3686 -0.3322 -0.2635 0.6314 0.7365
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.26351 0.02707 9.734 < 2e-16 ***
## conditionassuredSuccess 0.06870 0.03822 1.798 0.07259 .
## conditionuncertainSuccess 0.10509 0.03838 2.738 0.00631 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4657 on 884 degrees of freedom
## Multiple R-squared: 0.008683, Adjusted R-squared: 0.00644
## F-statistic: 3.871 on 2 and 884 DF, p-value: 0.02118
mod_donation <- lm(donation ~ condition, data = gjg_aRef)
summary(mod_donation)
##
## Call:
## lm(formula = donation ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -9.640 -8.725 -7.963 15.360 42.037
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 8.7248 0.6421 13.588 <2e-16 ***
## conditioncontrol -0.7620 0.9096 -0.838 0.402
## conditionuncertainSuccess 0.9156 0.9127 1.003 0.316
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 11.08 on 883 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.003808, Adjusted R-squared: 0.001552
## F-statistic: 1.688 on 2 and 883 DF, p-value: 0.1856
mod_opportunityChoiceNum <- lm(opportunityChoiceNum ~ condition, data = gjg_aRef)
summary(mod_opportunityChoiceNum)
##
## Call:
## lm(formula = opportunityChoiceNum ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.3686 -0.3322 -0.2635 0.6314 0.7365
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.33221 0.02698 12.314 <2e-16 ***
## conditioncontrol -0.06870 0.03822 -1.798 0.0726 .
## conditionuncertainSuccess 0.03639 0.03832 0.950 0.3426
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4657 on 884 degrees of freedom
## Multiple R-squared: 0.008683, Adjusted R-squared: 0.00644
## F-statistic: 3.871 on 2 and 884 DF, p-value: 0.02118
mod_opportunityChoiceCov <- lm(opportunityChoiceNum ~ condition + pol + age + gen + inc + edu + race, data = gjg)
summary(mod_opportunityChoiceCov)
##
## Call:
## lm(formula = opportunityChoiceNum ~ condition + pol + age + gen +
## inc + edu + race, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.8957 -0.3295 -0.2312 0.5756 0.9238
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.1173562 0.3337709 0.352 0.725220
## conditionassuredSuccess 0.0601537 0.0384030 1.566 0.117633
## conditionuncertainSuccess 0.1136548 0.0381991 2.975 0.003010 **
## pol 0.0299424 0.0090315 3.315 0.000954 ***
## age -0.0003802 0.0011347 -0.335 0.737672
## gen 0.0096472 0.0295230 0.327 0.743923
## inc 0.0090140 0.0108045 0.834 0.404353
## edu 0.0399390 0.0173331 2.304 0.021451 *
## race1 -0.2665264 0.3977673 -0.670 0.503004
## race1,2 -0.1788122 0.4183927 -0.427 0.669212
## race1,2,5,8 0.4769509 0.5615736 0.849 0.395947
## race1,2,8 -0.4727502 0.4585265 -1.031 0.302825
## race1,3 0.3204114 0.5662015 0.566 0.571614
## race1,3,8 0.5211187 0.5609343 0.929 0.353143
## race1,5,8 -0.2545693 0.3979219 -0.640 0.522510
## race1,7,8 -0.5153336 0.5626495 -0.916 0.359977
## race1,8 0.2471806 0.3974269 0.622 0.534140
## race2 -0.1793349 0.3283939 -0.546 0.585143
## race2,3,8 0.4078299 0.5619125 0.726 0.468168
## race2,5 0.2741936 0.3840290 0.714 0.475429
## race2,5,6 0.5465768 0.5616597 0.973 0.330758
## race2,5,8 -0.4730565 0.4181423 -1.131 0.258236
## race2,8 -0.0699522 0.3500451 -0.200 0.841655
## race2,9,5,8 -0.5156671 0.5609518 -0.919 0.358215
## race3 -0.2292998 0.3348743 -0.685 0.493699
## race3,5,8 -0.4700719 0.5623384 -0.836 0.403433
## race3,8 -0.0735309 0.3621726 -0.203 0.839162
## race3,9 0.0416905 0.4589111 0.091 0.927636
## race4 0.3752174 0.3579317 1.048 0.294802
## race5 -0.0959090 0.3306832 -0.290 0.771862
## race5,8 -0.0597595 0.3379585 -0.177 0.859688
## race6 -0.3227384 0.5608141 -0.575 0.565118
## race6,8 0.1488281 0.4178597 0.356 0.721804
## race7,8 -0.3643561 0.5605837 -0.650 0.515895
## race8 -0.1808001 0.3247341 -0.557 0.577836
## race9 -0.0547041 0.3493693 -0.157 0.875613
## race9,7,8 -0.3960882 0.5613529 -0.706 0.480633
## race9,8 -0.0069147 0.4572920 -0.015 0.987939
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.457 on 849 degrees of freedom
## Multiple R-squared: 0.08332, Adjusted R-squared: 0.04337
## F-statistic: 2.086 on 37 and 849 DF, p-value: 0.0001982
mod_donationCov <- lm(donation ~ condition + pol + age + gen + inc + edu + race, data = gjg)
summary(mod_donationCov)
##
## Call:
## lm(formula = donation ~ condition + pol + age + gen + inc + edu +
## race, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -18.920 -7.996 -4.416 10.408 43.540
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.7099 7.8149 -0.091 0.927640
## conditionassuredSuccess 0.9737 0.8990 1.083 0.279084
## conditionuncertainSuccess 2.1808 0.8951 2.437 0.015035 *
## pol 1.0272 0.2116 4.855 1.43e-06 ***
## age 0.1442 0.0266 5.420 7.76e-08 ***
## gen 2.5036 0.6916 3.620 0.000312 ***
## inc 0.4971 0.2530 1.965 0.049784 *
## edu -0.3957 0.4060 -0.975 0.330042
## race1 -16.2048 9.3120 -1.740 0.082185 .
## race1,2 -9.7585 9.7948 -0.996 0.319389
## race1,2,5,8 10.7921 13.1468 0.821 0.411936
## race1,2,8 -4.8872 10.7343 -0.455 0.649023
## race1,3 -25.2959 13.2552 -1.908 0.056680 .
## race1,3,8 9.3618 13.1318 0.713 0.476096
## race1,5,8 1.8709 9.3156 0.201 0.840877
## race1,7,8 -14.2514 13.1719 -1.082 0.279580
## race1,8 -0.9467 9.3040 -0.102 0.918980
## race2 -4.5474 7.6879 -0.592 0.554340
## race2,3,8 -15.1276 13.1547 -1.150 0.250474
## race2,5 -4.3614 8.9903 -0.485 0.627718
## race2,5,6 9.2167 13.1487 0.701 0.483523
## race2,5,8 -10.4627 9.7889 -1.069 0.285450
## race2,8 -5.7798 8.1948 -0.705 0.480817
## race2,9,5,8 10.9295 13.1322 0.832 0.405493
## race3 -5.9601 7.8396 -0.760 0.447312
## race3,5,8 -17.1796 13.1647 -1.305 0.192255
## race3,8 -4.0844 8.4787 -0.482 0.630123
## race3,9 0.2582 10.7434 0.024 0.980832
## race4 -3.6996 8.3794 -0.442 0.658950
## race5 -6.6141 7.7415 -0.854 0.393137
## race5,8 -5.6986 7.9118 -0.720 0.471559
## race6 -5.5095 13.1290 -0.420 0.674853
## race6,8 -13.2676 9.7823 -1.356 0.175370
## race7,8 -11.0247 13.1236 -0.840 0.401108
## race8 -6.6564 7.6022 -0.876 0.381501
## race9 -1.0462 8.1789 -0.128 0.898242
## race9,7,8 -10.3946 13.1417 -0.791 0.429184
## race9,8 -12.9589 10.7054 -1.211 0.226424
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 10.7 on 848 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.1087, Adjusted R-squared: 0.06981
## F-statistic: 2.795 on 37 and 848 DF, p-value: 1.214e-07
gjg$gen
## [1] 2 1 2 3 2 1 2 1 2 2 1 2 1 2 2 1 2 1 1 2 1 2 2 1 1 2 2 2 2 1 2 1 1 1 1 2 2
## [38] 1 2 1 2 1 2 2 1 2 2 2 2 2 1 1 2 2 1 1 1 1 1 2 1 2 1 2 1 1 1 1 2 2 2 2 2 1
## [75] 2 2 1 1 1 2 1 1 2 2 2 1 2 1 2 2 2 2 2 2 2 2 1 2 2 2 2 1 1 1 2 2 1 2 2 2 1
## [112] 2 1 1 2 2 1 1 2 1 1 1 2 1 1 1 1 2 1 1 2 1 2 2 2 1 1 2 2 2 1 1 2 2 1 2 1 2
## [149] 3 1 2 2 2 1 2 3 1 1 2 2 2 1 2 2 2 1 1 1 1 1 1 2 2 1 2 1 2 2 2 1 1 1 1 2 2
## [186] 1 2 1 2 1 2 1 3 2 2 1 1 1 2 1 1 2 2 2 1 1 2 2 2 2 1 2 1 2 2 3 2 1 1 1 1 2
## [223] 2 1 2 2 1 1 1 2 1 2 2 2 2 1 1 1 1 2 1 2 2 1 2 2 2 2 1 2 1 1 1 2 1 1 2 2 2
## [260] 1 1 2 1 1 2 1 2 2 2 1 2 3 1 1 1 2 1 2 2 1 1 1 1 1 2 2 1 1 2 2 1 1 1 1 1 1
## [297] 2 1 2 2 2 1 1 1 2 2 2 2 1 1 1 2 1 1 1 1 1 1 1 2 2 1 2 2 1 2 2 2 1 1 2 2 2
## [334] 1 2 2 2 1 1 1 1 2 1 2 1 1 1 2 2 1 1 2 2 2 2 2 1 2 2 1 1 1 3 1 1 1 1 1 1 1
## [371] 1 1 1 2 2 1 1 2 1 2 1 1 2 1 1 2 2 1 2 2 2 2 1 1 2 2 2 2 1 3 2 2 1 1 2 1 1
## [408] 1 1 2 3 2 2 2 1 1 2 2 1 1 2 1 2 2 2 1 1 1 2 2 2 1 1 3 1 2 1 2 2 2 1 1 2 2
## [445] 1 1 1 3 1 2 1 3 2 2 2 1 1 1 1 1 1 2 2 1 2 2 1 1 1 2 1 1 2 2 2 2 1 2 2 2 1
## [482] 1 1 2 2 1 1 2 2 2 2 1 3 2 1 1 2 1 2 1 1 2 2 1 2 2 2 1 1 1 2 1 2 2 2 2 2 1
## [519] 1 1 1 2 2 1 1 1 1 1 2 1 2 2 1 1 1 2 1 1 2 2 2 1 2 2 1 2 2 1 2 2 1 1 2 2 1
## [556] 2 1 2 1 2 2 1 1 1 1 2 1 2 2 2 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 2 2
## [593] 1 1 2 1 2 2 1 2 2 1 2 3 1 2 1 1 2 1 1 2 1 1 2 1 2 2 2 1 2 1 2 1 1 2 2 2 1
## [630] 1 2 1 2 1 1 1 1 2 1 1 1 2 2 2 1 1 1 2 1 2 1 2 2 1 3 1 2 1 2 2 1 1 1 1 1 1
## [667] 1 2 1 1 2 2 1 2 1 2 2 1 2 1 1 2 2 2 2 1 1 2 1 1 1 3 2 2 2 1 2 1 2 1 2 1 2
## [704] 1 1 2 2 2 1 2 2 2 2 1 1 3 1 1 1 2 2 1 1 1 2 2 1 1 2 2 2 2 1 2 1 1 2 1 2 2
## [741] 1 1 2 1 2 1 2 2 1 1 1 2 1 2 2 2 1 2 2 1 2 1 2 1 1 1 2 1 2 2 1 1 2 2 2 2 3
## [778] 2 2 2 1 1 2 2 2 2 1 2 2 2 2 1 2 1 1 1 2 1 2 1 2 2 1 2 1 1 1 3 2 1 1 1 2 2
## [815] 2 2 2 1 1 2 1 2 2 2 2 2 2 2 2 1 2 2 2 1 2 1 2 2 2 1 2 1 2 3 2 2 1 2 1 1 1
## [852] 1 1 2 2 2 2 1 2 1 2 2 2 2 1 1 1 2 2 2 1 2 2 1 1 2 2 1 1 1 2 1 2 2 1 1 1
mod_opportunityChoiceMec <- lm(opportunityChoiceNum ~ condition + effortEfficacy + dayToDayEfficacy + americansEfficacy1 + americansEfficacy2, data = gjg)
summary(mod_opportunityChoiceMec)
##
## Call:
## lm(formula = opportunityChoiceNum ~ condition + effortEfficacy +
## dayToDayEfficacy + americansEfficacy1 + americansEfficacy2,
## data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.6277 -0.3406 -0.1888 0.4967 1.0164
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.159929 0.056558 -2.828 0.00479 **
## conditionassuredSuccess 0.030671 0.036579 0.839 0.40198
## conditionuncertainSuccess 0.069749 0.036584 1.907 0.05691 .
## effortEfficacy 0.091644 0.019449 4.712 2.85e-06 ***
## dayToDayEfficacy 0.020989 0.012629 1.662 0.09688 .
## americansEfficacy1 -0.006358 0.023006 -0.276 0.78234
## americansEfficacy2 0.037302 0.021581 1.729 0.08425 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4418 on 880 degrees of freedom
## Multiple R-squared: 0.112, Adjusted R-squared: 0.1059
## F-statistic: 18.49 on 6 and 880 DF, p-value: < 2.2e-16
mod_opportunityChoiceMec <- lm(opportunityChoiceNum ~ condition + moralMitigate + moralProtect + moralCollective, data = gjg)
summary(mod_opportunityChoiceMec)
##
## Call:
## lm(formula = opportunityChoiceNum ~ condition + moralMitigate +
## moralProtect + moralCollective, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.6499 -0.3447 -0.1875 0.4634 1.0468
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.335743 0.057141 -5.876 5.97e-09 ***
## conditionassuredSuccess 0.025099 0.035703 0.703 0.482256
## conditionuncertainSuccess 0.062072 0.035804 1.734 0.083324 .
## moralMitigate 0.041389 0.010904 3.796 0.000157 ***
## moralProtect 0.023989 0.009082 2.641 0.008404 **
## moralCollective 0.066566 0.012796 5.202 2.45e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4318 on 879 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.152, Adjusted R-squared: 0.1472
## F-statistic: 31.51 on 5 and 879 DF, p-value: < 2.2e-16
mod_opportunityChoiceMec <- lm(opportunityChoiceNum ~ condition + futureImpact + futureSacrifice + futureResponsibility, data = gjg)
summary(mod_opportunityChoiceMec)
##
## Call:
## lm(formula = opportunityChoiceNum ~ condition + futureImpact +
## futureSacrifice + futureResponsibility, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.6083 -0.3391 -0.1641 0.4614 1.0583
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.35645 0.05996 -5.945 3.98e-09 ***
## conditionassuredSuccess 0.02888 0.03558 0.812 0.417279
## conditionuncertainSuccess 0.06973 0.03563 1.957 0.050662 .
## futureImpact 0.02036 0.01663 1.224 0.221183
## futureSacrifice 0.06193 0.01691 3.662 0.000266 ***
## futureResponsibility 0.06382 0.02014 3.169 0.001585 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4309 on 881 degrees of freedom
## Multiple R-squared: 0.1543, Adjusted R-squared: 0.1495
## F-statistic: 32.16 on 5 and 881 DF, p-value: < 2.2e-16
mod_opportunityChoiceMec <- lm(opportunityChoiceNum ~ condition + lifestylePG + thankfulPG + sacrificesPG + gratitudePG, data = gjg)
summary(mod_opportunityChoiceMec)
##
## Call:
## lm(formula = opportunityChoiceNum ~ condition + lifestylePG +
## thankfulPG + sacrificesPG + gratitudePG, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.5280 -0.3585 -0.2326 0.5556 1.0354
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.003111 0.054987 0.057 0.95490
## conditionassuredSuccess -0.015294 0.040236 -0.380 0.70395
## conditionuncertainSuccess 0.029820 0.040142 0.743 0.45776
## lifestylePG 0.050999 0.016510 3.089 0.00207 **
## thankfulPG 0.011506 0.018326 0.628 0.53025
## sacrificesPG 0.025267 0.019574 1.291 0.19709
## gratitudePG -0.031560 0.017545 -1.799 0.07240 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.453 on 879 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.06508, Adjusted R-squared: 0.0587
## F-statistic: 10.2 on 6 and 879 DF, p-value: 6.291e-11
gjg$effortEfficacy
## [1] 3 1 3 4 3 4 4 1 4 4 2 2 2 3 2 3 4 4 1 2 2 2 2 5 5 4 5 3 5 3 4 2 2 1 1 2 5
## [38] 1 2 2 2 2 3 4 3 4 1 1 5 2 2 2 4 3 2 4 5 5 3 1 3 2 2 2 3 3 3 3 3 4 3 2 4 2
## [75] 3 2 2 1 2 1 2 4 5 5 2 5 3 4 3 2 4 1 3 3 4 3 2 3 4 3 2 4 5 4 3 5 4 4 1 3 2
## [112] 3 2 4 3 2 2 3 1 4 1 5 3 2 2 3 4 4 2 2 4 3 5 3 3 3 1 5 5 3 3 1 4 3 5 1 1 3
## [149] 3 1 1 2 3 2 1 2 2 3 2 1 4 2 4 5 3 3 2 5 3 3 3 1 5 1 3 4 2 1 1 2 4 4 2 2 3
## [186] 5 1 5 3 3 4 4 4 1 5 4 5 4 2 4 4 4 4 2 5 3 2 3 3 5 2 4 4 4 5 3 4 3 3 1 5 4
## [223] 3 2 4 4 3 4 5 2 1 2 3 2 3 4 2 4 2 3 2 3 3 3 4 4 5 3 1 4 2 2 2 3 1 4 2 1 2
## [260] 2 3 5 3 2 3 4 4 2 3 1 4 4 4 2 4 3 4 2 3 3 2 5 3 4 4 5 2 2 3 5 5 2 3 4 2 2
## [297] 3 3 4 3 2 2 1 3 2 2 2 2 5 5 3 2 2 2 5 3 1 2 2 1 5 3 2 3 4 3 3 3 1 2 5 5 4
## [334] 3 2 5 5 5 4 4 2 2 3 1 2 3 4 3 1 3 3 4 2 4 2 3 5 3 3 2 1 3 3 1 2 1 4 1 2 3
## [371] 2 3 2 2 4 3 4 2 3 5 2 1 3 5 4 5 2 3 4 4 2 1 4 2 5 4 3 3 3 1 3 5 3 3 4 3 4
## [408] 3 4 4 3 4 5 1 2 2 5 2 1 2 1 1 1 3 4 3 3 4 3 5 3 5 2 3 1 2 5 3 2 1 4 3 2 3
## [445] 4 4 2 3 4 1 1 3 1 4 3 1 2 3 1 4 2 2 4 1 3 1 3 3 2 3 1 3 3 2 2 4 1 5 2 3 4
## [482] 3 2 5 5 3 3 3 2 3 2 1 5 2 4 2 5 2 3 2 3 2 4 1 5 1 2 4 2 2 3 2 2 3 3 3 4 5
## [519] 2 4 1 4 3 1 4 3 2 2 3 4 3 3 2 1 4 4 1 2 5 5 5 3 1 4 3 2 2 2 4 4 2 4 4 1 1
## [556] 2 3 3 2 3 4 3 3 2 4 2 1 5 5 2 3 2 4 4 2 4 2 2 4 5 1 5 2 2 2 3 4 4 1 3 2 4
## [593] 5 4 1 1 2 2 4 2 3 2 3 4 3 3 3 1 4 4 5 3 3 3 4 4 4 2 3 4 2 1 4 4 3 4 4 1 3
## [630] 2 4 3 5 2 4 4 4 1 3 3 3 3 3 1 3 4 2 2 2 1 1 4 5 2 2 1 3 4 2 3 3 4 3 4 4 2
## [667] 2 3 3 1 2 1 4 4 4 5 4 2 4 1 5 2 1 5 3 3 1 2 5 4 2 3 4 3 5 5 2 3 3 5 4 3 3
## [704] 3 3 4 4 3 3 3 3 5 4 1 3 2 3 4 1 2 5 1 2 1 5 2 4 1 3 1 5 3 4 1 3 2 5 1 2 1
## [741] 4 1 2 2 5 3 2 4 2 3 3 2 5 4 3 2 1 2 1 1 1 4 2 1 1 3 2 2 3 4 2 2 3 4 5 2 3
## [778] 2 2 4 4 3 1 4 2 3 4 3 1 4 2 5 5 2 3 3 3 1 3 1 4 2 4 1 3 3 5 3 2 3 1 4 1 2
## [815] 3 5 3 3 3 3 4 2 5 4 3 2 2 4 1 3 3 2 1 4 3 2 1 5 4 5 3 1 4 5 5 3 3 4 4 3 3
## [852] 3 1 2 4 2 4 1 5 5 4 4 3 3 2 3 4 4 4 4 2 2 3 5 5 3 4 3 5 4 3 2 2 2 3 3 4
mod_donation <- lm(donation ~ condition, data = gjg)
summary(mod_donation)
##
## Call:
## lm(formula = donation ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -9.640 -8.725 -7.963 15.360 42.037
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 7.9628 0.6443 12.360 <2e-16 ***
## conditionassuredSuccess 0.7620 0.9096 0.838 0.4024
## conditionuncertainSuccess 1.6776 0.9142 1.835 0.0668 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 11.08 on 883 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.003808, Adjusted R-squared: 0.001552
## F-statistic: 1.688 on 2 and 883 DF, p-value: 0.1856
# Fit regression model
mod_clicked <- glm(clicked ~ condition, data = gjg, family = binomial)
summary(mod_clicked)
##
## Call:
## glm(formula = clicked ~ condition, family = binomial, data = gjg)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.4783 -0.4783 -0.4648 -0.4098 2.2446
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.11021 0.18718 -11.273 <2e-16 ***
## conditionassuredSuccess -0.32486 0.28347 -1.146 0.252
## conditionuncertainSuccess -0.06074 0.26865 -0.226 0.821
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 564.74 on 886 degrees of freedom
## Residual deviance: 563.27 on 884 degrees of freedom
## AIC: 569.27
##
## Number of Fisher Scoring iterations: 5
mod_aclicked <- glm(clicked ~ condition, data = gjg_aRef, family = binomial)
summary(mod_aclicked)
##
## Call:
## glm(formula = clicked ~ condition, family = binomial, data = gjg_aRef)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.4783 -0.4783 -0.4648 -0.4098 2.2446
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.4351 0.2129 -11.439 <2e-16 ***
## conditioncontrol 0.3249 0.2835 1.146 0.252
## conditionuncertainSuccess 0.2641 0.2871 0.920 0.358
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 564.74 on 886 degrees of freedom
## Residual deviance: 563.27 on 884 degrees of freedom
## AIC: 569.27
##
## Number of Fisher Scoring iterations: 5
percep_plot_list <- list(plot_cooker(gjg, condition, gratitude_z, "Gratitude to Past Generations"),
plot_cooker(gjg, condition, obligation_z, "Obligation to Future Generations"),
plot_cooker(gjg, condition, moralToAct_z, "Moral to Act Despite Uncertainty"),
plot_cooker(gjg, condition, efficacy_z, "Efficacy"),
plot_cooker(gjg, condition, HP_z, "Hope and Optimism"),
plot_cooker(gjg, condition, IG_z, "Intergenerational Identity")
)
percep_plot_arranged <- ggarrange(plotlist = percep_plot_list, ncol = 3, nrow = 2)
percep_plot_arranged
mod_lifestylePG <- lm(gratitude_z ~ condition, data = gjg)
summary(mod_lifestylePG)
##
## Call:
## lm(formula = gratitude_z ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.55843 -0.51053 0.08895 0.62673 1.61668
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.39069 0.04917 -7.945 5.90e-15 ***
## conditionassuredSuccess 0.63334 0.06943 9.122 < 2e-16 ***
## conditionuncertainSuccess 0.53851 0.06978 7.717 3.21e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.846 on 883 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.09856, Adjusted R-squared: 0.09652
## F-statistic: 48.27 on 2 and 883 DF, p-value: < 2.2e-16
moda_lifestylePG <- lm(gratitude_z ~ condition, data = gjg_aRef)
summary(moda_lifestylePG)
##
## Call:
## lm(formula = gratitude_z ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.55843 -0.51053 0.08895 0.62673 1.61668
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.24265 0.04901 4.951 8.84e-07 ***
## conditioncontrol -0.63334 0.06943 -9.122 < 2e-16 ***
## conditionuncertainSuccess -0.09483 0.06966 -1.361 0.174
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.846 on 883 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.09856, Adjusted R-squared: 0.09652
## F-statistic: 48.27 on 2 and 883 DF, p-value: < 2.2e-16
mod_alifestylePG <- lm(obligation_z ~ condition, data = gjg)
summary(mod_alifestylePG)
##
## Call:
## lm(formula = obligation_z ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.7044 -0.5188 0.1226 0.6346 1.3759
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.12778 0.05280 -2.420 0.01571 *
## conditionassuredSuccess 0.20008 0.07454 2.684 0.00741 **
## conditionuncertainSuccess 0.18334 0.07486 2.449 0.01451 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9084 on 884 degrees of freedom
## Multiple R-squared: 0.009903, Adjusted R-squared: 0.007662
## F-statistic: 4.421 on 2 and 884 DF, p-value: 0.01229
moda_alifestylePG <- lm(obligation_z ~ condition, data = gjg_aRef)
summary(mod_alifestylePG)
##
## Call:
## lm(formula = obligation_z ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.7044 -0.5188 0.1226 0.6346 1.3759
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.12778 0.05280 -2.420 0.01571 *
## conditionassuredSuccess 0.20008 0.07454 2.684 0.00741 **
## conditionuncertainSuccess 0.18334 0.07486 2.449 0.01451 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9084 on 884 degrees of freedom
## Multiple R-squared: 0.009903, Adjusted R-squared: 0.007662
## F-statistic: 4.421 on 2 and 884 DF, p-value: 0.01229
mod_thankfulPG <- lm(moralToAct_z ~ condition, data = gjg)
summary(mod_thankfulPG)
##
## Call:
## lm(formula = moralToAct_z ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.23114 -0.42108 0.00942 0.58208 1.55631
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.11806 0.04582 -2.577 0.01013 *
## conditionassuredSuccess 0.18021 0.06469 2.786 0.00545 **
## conditionuncertainSuccess 0.17377 0.06490 2.677 0.00756 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7869 on 882 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.01117, Adjusted R-squared: 0.008925
## F-statistic: 4.98 on 2 and 882 DF, p-value: 0.007067
moda_thankfulPG <- lm(moralToAct_z ~ condition, data = gjg_aRef)
summary(mod_thankfulPG)
##
## Call:
## lm(formula = moralToAct_z ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.23114 -0.42108 0.00942 0.58208 1.55631
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.11806 0.04582 -2.577 0.01013 *
## conditionassuredSuccess 0.18021 0.06469 2.786 0.00545 **
## conditionuncertainSuccess 0.17377 0.06490 2.677 0.00756 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7869 on 882 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.01117, Adjusted R-squared: 0.008925
## F-statistic: 4.98 on 2 and 882 DF, p-value: 0.007067
mod_athankfulPG <- lm(efficacy_z ~ condition, data = gjg)
summary(mod_athankfulPG)
##
## Call:
## lm(formula = efficacy_z ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.9400 -0.5010 0.1131 0.5402 1.5631
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.13066 0.04679 -2.792 0.00535 **
## conditionassuredSuccess 0.20295 0.06606 3.072 0.00219 **
## conditionuncertainSuccess 0.18912 0.06634 2.851 0.00446 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.8051 on 884 degrees of freedom
## Multiple R-squared: 0.01311, Adjusted R-squared: 0.01088
## F-statistic: 5.873 on 2 and 884 DF, p-value: 0.002926
moda_athankfulPG <- lm(efficacy_z ~ condition, data = gjg_aRef)
summary(mod_athankfulPG)
##
## Call:
## lm(formula = efficacy_z ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.9400 -0.5010 0.1131 0.5402 1.5631
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.13066 0.04679 -2.792 0.00535 **
## conditionassuredSuccess 0.20295 0.06606 3.072 0.00219 **
## conditionuncertainSuccess 0.18912 0.06634 2.851 0.00446 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.8051 on 884 degrees of freedom
## Multiple R-squared: 0.01311, Adjusted R-squared: 0.01088
## F-statistic: 5.873 on 2 and 884 DF, p-value: 0.002926
mod_thankfulPG <- lm(HP_z ~ condition, data = gjg)
summary(mod_thankfulPG)
##
## Call:
## lm(formula = HP_z ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.3071 -0.5980 0.1027 0.6993 1.4000
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.16792 0.05357 -3.135 0.00178 **
## conditionassuredSuccess 0.30771 0.07563 4.069 5.15e-05 ***
## conditionuncertainSuccess 0.19539 0.07595 2.573 0.01025 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9216 on 884 degrees of freedom
## Multiple R-squared: 0.01881, Adjusted R-squared: 0.01659
## F-statistic: 8.472 on 2 and 884 DF, p-value: 0.0002268
moda_thankfulPG <- lm(HP_z ~ condition, data = gjg_aRef)
summary(moda_thankfulPG)
##
## Call:
## lm(formula = HP_z ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.3071 -0.5980 0.1027 0.6993 1.4000
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.13978 0.05339 2.618 0.00899 **
## conditioncontrol -0.30771 0.07563 -4.069 5.15e-05 ***
## conditionuncertainSuccess -0.11231 0.07582 -1.481 0.13888
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9216 on 884 degrees of freedom
## Multiple R-squared: 0.01881, Adjusted R-squared: 0.01659
## F-statistic: 8.472 on 2 and 884 DF, p-value: 0.0002268
percep_plot_list <- list(plot_cooker(gjg, condition, lifestylePG, "Lifestyle only possible due to Past Generations env. sacrifices"),
plot_cooker(gjg, condition, thankfulPG, "Thankful for Past Generations env. sacrifices"),
plot_cooker(gjg, condition, sacrificesPG, "Past Generations made meaningful env. sacrifices that benefit you"),
plot_cooker(gjg, condition, gratitudePG, "To what extend do you feel grateful to past generations")
)
percep_plot_arranged <- ggarrange(plotlist = percep_plot_list, ncol = 2, nrow = 2)
plot_grid(percep_plot_arranged, ncol = 1, rel_heights = c(0.1, 0.9))
pol_line(gjg, pol, lifestylePG)
pol_line(gjg, pol, thankfulPG)
pol_line(gjg, pol, sacrificesPG)
pol_line(gjg, pol, gratitudePG)
mod_lifestylePG <- lm(lifestylePG ~ condition, data = gjg)
summary(mod_lifestylePG)
##
## Call:
## lm(formula = lifestylePG ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.124 -1.124 0.058 1.058 2.821
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.17905 0.09557 43.728 < 2e-16 ***
## conditionassuredSuccess 0.94511 0.13493 7.004 4.91e-12 ***
## conditionuncertainSuccess 0.76293 0.13550 5.630 2.42e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.644 on 884 degrees of freedom
## Multiple R-squared: 0.05869, Adjusted R-squared: 0.05656
## F-statistic: 27.56 on 2 and 884 DF, p-value: 2.456e-12
mod_alifestylePG <- lm(lifestylePG ~ condition, data = gjg_aRef)
summary(mod_alifestylePG)
##
## Call:
## lm(formula = lifestylePG ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.124 -1.124 0.058 1.058 2.821
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.12416 0.09525 53.798 < 2e-16 ***
## conditioncontrol -0.94511 0.13493 -7.004 4.91e-12 ***
## conditionuncertainSuccess -0.18218 0.13528 -1.347 0.178
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.644 on 884 degrees of freedom
## Multiple R-squared: 0.05869, Adjusted R-squared: 0.05656
## F-statistic: 27.56 on 2 and 884 DF, p-value: 2.456e-12
mod_thankfulPG <- lm(thankfulPG ~ condition, data = gjg)
summary(mod_thankfulPG)
##
## Call:
## lm(formula = thankfulPG ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.6275 -0.6275 0.3725 1.3725 2.5811
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.41892 0.08809 50.164 < 2e-16 ***
## conditionassuredSuccess 1.20860 0.12437 9.718 < 2e-16 ***
## conditionuncertainSuccess 1.03842 0.12490 8.314 3.46e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.516 on 884 degrees of freedom
## Multiple R-squared: 0.111, Adjusted R-squared: 0.109
## F-statistic: 55.19 on 2 and 884 DF, p-value: < 2.2e-16
mod_athankfulPG <- lm(thankfulPG ~ condition, data = gjg_aRef)
summary(mod_athankfulPG)
##
## Call:
## lm(formula = thankfulPG ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.6275 -0.6275 0.3725 1.3725 2.5811
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.62752 0.08779 64.100 <2e-16 ***
## conditioncontrol -1.20860 0.12437 -9.718 <2e-16 ***
## conditionuncertainSuccess -0.17018 0.12469 -1.365 0.173
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.516 on 884 degrees of freedom
## Multiple R-squared: 0.111, Adjusted R-squared: 0.109
## F-statistic: 55.19 on 2 and 884 DF, p-value: < 2.2e-16
mod_thankfulPG <- lm(sacrificesPG ~ condition, data = gjg)
summary(mod_thankfulPG)
##
## Call:
## lm(formula = sacrificesPG ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.4195 -0.9899 0.0101 1.0101 3.0101
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.98986 0.09074 43.97 <2e-16 ***
## conditionassuredSuccess 1.42960 0.12812 11.16 <2e-16 ***
## conditionuncertainSuccess 1.30706 0.12866 10.16 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.561 on 884 degrees of freedom
## Multiple R-squared: 0.1471, Adjusted R-squared: 0.1452
## F-statistic: 76.26 on 2 and 884 DF, p-value: < 2.2e-16
mod_asacrificesPG <- lm(sacrificesPG ~ condition, data = gjg_aRef)
summary(mod_asacrificesPG)
##
## Call:
## lm(formula = sacrificesPG ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.4195 -0.9899 0.0101 1.0101 3.0101
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.41946 0.09044 59.923 <2e-16 ***
## conditioncontrol -1.42960 0.12812 -11.159 <2e-16 ***
## conditionuncertainSuccess -0.12253 0.12845 -0.954 0.34
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.561 on 884 degrees of freedom
## Multiple R-squared: 0.1471, Adjusted R-squared: 0.1452
## F-statistic: 76.26 on 2 and 884 DF, p-value: < 2.2e-16
mod_gratitudePG <- lm(gratitudePG ~ condition, data = gjg)
summary(mod_gratitudePG)
##
## Call:
## lm(formula = gratitudePG ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.7584 -0.7584 0.2416 1.2416 1.6926
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.30743 0.06894 47.974 < 2e-16 ***
## conditionassuredSuccess 0.45096 0.09734 4.633 4.15e-06 ***
## conditionuncertainSuccess 0.33983 0.09783 3.474 0.000539 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.186 on 883 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.02567, Adjusted R-squared: 0.02346
## F-statistic: 11.63 on 2 and 883 DF, p-value: 1.034e-05
mod_agratitudePG <- lm(gratitudePG ~ condition, data = gjg_aRef)
summary(mod_agratitudePG)
##
## Call:
## lm(formula = gratitudePG ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.7584 -0.7584 0.2416 1.2416 1.6926
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.75839 0.06871 54.699 < 2e-16 ***
## conditioncontrol -0.45096 0.09734 -4.633 4.15e-06 ***
## conditionuncertainSuccess -0.11113 0.09767 -1.138 0.256
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.186 on 883 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.02567, Adjusted R-squared: 0.02346
## F-statistic: 11.63 on 2 and 883 DF, p-value: 1.034e-05
percep_plot_list <- list(plot_cooker(gjg, condition, futureImpact, "I have a duty to think about how my \n\ actions impact climate for future generations"),
plot_cooker(gjg, condition, futureSacrifice, "I'm willing to sacrifice aspects of my \n\ life if it will help people living in the future"),
plot_cooker(gjg, condition, futureObligation, "People living today have an obligation to help future generations"),
plot_cooker(gjg, condition, futureResponsibility, "Do you feel a personal responsibility to save resources for \n\ future generations, even if it means making to do with less"))
percep_plot_arranged <- ggarrange(plotlist = percep_plot_list, ncol = 2, nrow = 2)
plot_grid(percep_plot_arranged, ncol = 1, rel_heights = c(0.1, 0.9))
pol_line(gjg, pol, futureImpact)
pol_line(gjg, pol, futureSacrifice)
pol_line(gjg, pol, futureObligation)
pol_line(gjg, pol, futureResponsibility)
mod_futureImpact <- lm(futureImpact ~ condition + pol, data = gjg)
summary(mod_futureImpact)
##
## Call:
## lm(formula = futureImpact ~ condition + pol, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.0318 -0.7429 0.2038 0.9682 2.6707
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.09375 0.14902 27.471 <2e-16 ***
## conditionassuredSuccess 0.25203 0.11408 2.209 0.0274 *
## conditionuncertainSuccess 0.28888 0.11457 2.521 0.0119 *
## pol 0.23560 0.02636 8.938 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.39 on 883 degrees of freedom
## Multiple R-squared: 0.08969, Adjusted R-squared: 0.0866
## F-statistic: 29 on 3 and 883 DF, p-value: < 2.2e-16
mod_afutureImpact <- lm(futureImpact ~ condition, data = gjg_aRef)
summary(mod_afutureImpact)
##
## Call:
## lm(formula = futureImpact ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.4915 -0.4915 0.5085 0.7872 1.7872
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.45973 0.08405 64.961 <2e-16 ***
## conditioncontrol -0.24689 0.11906 -2.074 0.0384 *
## conditionuncertainSuccess 0.03174 0.11937 0.266 0.7904
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.451 on 884 degrees of freedom
## Multiple R-squared: 0.007336, Adjusted R-squared: 0.00509
## F-statistic: 3.266 on 2 and 884 DF, p-value: 0.0386
mod_futureSacrifice <- lm(futureSacrifice ~ condition + pol, data = gjg)
summary(mod_futureSacrifice)
##
## Call:
## lm(formula = futureSacrifice ~ condition + pol, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.6138 -0.6138 0.1451 0.9432 2.6310
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.20698 0.15305 27.488 < 2e-16 ***
## conditionassuredSuccess 0.24195 0.11716 2.065 0.0392 *
## conditionuncertainSuccess 0.27302 0.11766 2.320 0.0206 *
## pol 0.16197 0.02707 5.983 3.18e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.428 on 883 degrees of freedom
## Multiple R-squared: 0.0454, Adjusted R-squared: 0.04216
## F-statistic: 14 on 3 and 883 DF, p-value: 6.371e-09
mod_afutureSacrifice <- lm(futureSacrifice ~ condition, data = gjg_aRef)
summary(mod_afutureSacrifice)
##
## Call:
## lm(formula = futureSacrifice ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.2423 -0.2423 0.0236 1.0236 2.0236
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.21477 0.08432 61.846 <2e-16 ***
## conditioncontrol -0.23841 0.11945 -1.996 0.0462 *
## conditionuncertainSuccess 0.02756 0.11975 0.230 0.8181
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.456 on 884 degrees of freedom
## Multiple R-squared: 0.006706, Adjusted R-squared: 0.004459
## F-statistic: 2.984 on 2 and 884 DF, p-value: 0.0511
mod_futureObligation <- lm(futureObligation ~ condition + pol, data = gjg)
summary(mod_futureObligation)
##
## Call:
## lm(formula = futureObligation ~ condition + pol, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.6536 -0.6536 0.1641 0.8481 2.2580
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.55972 0.13525 33.712 < 2e-16 ***
## conditionassuredSuccess 0.33669 0.10354 3.252 0.00119 **
## conditionuncertainSuccess 0.31605 0.10399 3.039 0.00244 **
## pol 0.18231 0.02393 7.620 6.55e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.262 on 883 degrees of freedom
## Multiple R-squared: 0.07427, Adjusted R-squared: 0.07113
## F-statistic: 23.61 on 3 and 883 DF, p-value: 1.045e-14
mod_afutureObligation <- lm(futureObligation ~ condition, data = gjg_aRef)
summary(mod_afutureObligation)
##
## Call:
## lm(formula = futureObligation ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.7584 -0.7338 0.2416 1.2416 1.5743
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.75839 0.07541 76.357 <2e-16 ***
## conditioncontrol -0.33271 0.10683 -3.114 0.0019 **
## conditionuncertainSuccess -0.02460 0.10711 -0.230 0.8184
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.302 on 884 degrees of freedom
## Multiple R-squared: 0.0134, Adjusted R-squared: 0.01117
## F-statistic: 6.004 on 2 and 884 DF, p-value: 0.002571
mod_futureResponsibility <- lm(futureResponsibility ~ condition + pol, data = gjg)
summary(mod_futureResponsibility)
##
## Call:
## lm(formula = futureResponsibility ~ condition + pol, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.8383 -0.7056 0.1617 0.7964 2.2745
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.59282 0.12288 21.101 < 2e-16 ***
## conditionassuredSuccess 0.31683 0.09407 3.368 0.000789 ***
## conditionuncertainSuccess 0.21283 0.09447 2.253 0.024508 *
## pol 0.13266 0.02174 6.104 1.55e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.146 on 883 degrees of freedom
## Multiple R-squared: 0.05233, Adjusted R-squared: 0.04911
## F-statistic: 16.25 on 3 and 883 DF, p-value: 2.739e-10
mod_afutureResponsibility <- lm(futureResponsibility ~ condition, data = gjg_aRef)
summary(mod_afutureResponsibility)
##
## Call:
## lm(formula = futureResponsibility ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.5369 -0.5369 0.4631 0.7770 1.7770
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.53691 0.06775 52.205 < 2e-16 ***
## conditioncontrol -0.31394 0.09598 -3.271 0.00111 **
## conditionuncertainSuccess -0.10688 0.09622 -1.111 0.26698
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.17 on 884 degrees of freedom
## Multiple R-squared: 0.01235, Adjusted R-squared: 0.01011
## F-statistic: 5.526 on 2 and 884 DF, p-value: 0.004121
percep_plot_list <- list(plot_cooker(gjg, condition, moralMitigate, "Is it IMMORAL if you don't take action to mitigate climate change \n\ because you're uncertain about efficacy"),
plot_cooker(gjg, condition, moralProtectR, "When my efforts are not guaranteed, I am less obligated \n\ to take costly action to help future generations"),
plot_cooker(gjg, condition, moralCollective, "Even if we're uncertain about efficacy, \n\ we should make a collective effort to address climate change"))
percep_plot_arranged <- ggarrange(plotlist = percep_plot_list, ncol = 2, nrow = 2)
plot_grid(percep_plot_arranged, ncol = 1, rel_heights = c(0.1, 0.9))
pol_line(gjg, pol, moralMitigate)
pol_line(gjg, pol, moralProtectR)
pol_line(gjg, pol, moralCollective)
mod_moralMitigate <- lm(moralMitigate ~ condition, data = gjg)
summary(mod_moralMitigate)
##
## Call:
## lm(formula = moralMitigate ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.4579 -1.3106 -0.0203 1.5421 2.9797
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.0203 0.1012 39.715 < 2e-16 ***
## conditionassuredSuccess 0.4376 0.1429 3.062 0.00227 **
## conditionuncertainSuccess 0.2902 0.1434 2.024 0.04328 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.739 on 882 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.01088, Adjusted R-squared: 0.008633
## F-statistic: 4.849 on 2 and 882 DF, p-value: 0.008047
mod_amoralMitigate <- lm(moralMitigate ~ condition, data = gjg_aRef)
summary(mod_amoralMitigate)
##
## Call:
## lm(formula = moralMitigate ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.4579 -1.3106 -0.0203 1.5421 2.9797
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.4579 0.1009 44.186 < 2e-16 ***
## conditioncontrol -0.4376 0.1429 -3.062 0.00227 **
## conditionuncertainSuccess -0.1473 0.1432 -1.029 0.30371
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.739 on 882 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.01088, Adjusted R-squared: 0.008633
## F-statistic: 4.849 on 2 and 882 DF, p-value: 0.008047
mod_moralProtectR <- lm(moralProtectR ~ condition, data = gjg)
summary(mod_moralProtectR)
##
## Call:
## lm(formula = moralProtectR ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.922 -1.741 0.198 1.259 3.259
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.9223 0.1005 39.028 <2e-16 ***
## conditionassuredSuccess -0.1203 0.1419 -0.848 0.397
## conditionuncertainSuccess -0.1817 0.1425 -1.275 0.203
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.729 on 884 degrees of freedom
## Multiple R-squared: 0.001902, Adjusted R-squared: -0.0003557
## F-statistic: 0.8425 on 2 and 884 DF, p-value: 0.431
mod_amoralProtectR <- lm(moralProtectR ~ condition, data = gjg_aRef)
summary(mod_amoralProtectR)
##
## Call:
## lm(formula = moralProtectR ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.922 -1.741 0.198 1.259 3.259
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.8020 0.1002 37.959 <2e-16 ***
## conditioncontrol 0.1203 0.1419 0.848 0.397
## conditionuncertainSuccess -0.0614 0.1422 -0.432 0.666
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.729 on 884 degrees of freedom
## Multiple R-squared: 0.001902, Adjusted R-squared: -0.0003557
## F-statistic: 0.8425 on 2 and 884 DF, p-value: 0.431
mod_moralCollective <- lm(moralCollective ~ condition, data = gjg)
summary(mod_moralCollective)
##
## Call:
## lm(formula = moralCollective ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.4334 -0.4334 0.5666 0.9561 1.9561
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.04392 0.08859 56.935 < 2e-16 ***
## conditionassuredSuccess 0.35205 0.12508 2.815 0.00499 **
## conditionuncertainSuccess 0.38953 0.12561 3.101 0.00199 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.524 on 884 degrees of freedom
## Multiple R-squared: 0.01312, Adjusted R-squared: 0.01089
## F-statistic: 5.876 on 2 and 884 DF, p-value: 0.002918
mod_amoralCollective <- lm(moralCollective ~ condition, data = gjg_aRef)
summary(mod_amoralCollective)
##
## Call:
## lm(formula = moralCollective ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.4334 -0.4334 0.5666 0.9561 1.9561
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.39597 0.08829 61.114 < 2e-16 ***
## conditioncontrol -0.35205 0.12508 -2.815 0.00499 **
## conditionuncertainSuccess 0.03747 0.12540 0.299 0.76513
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.524 on 884 degrees of freedom
## Multiple R-squared: 0.01312, Adjusted R-squared: 0.01089
## F-statistic: 5.876 on 2 and 884 DF, p-value: 0.002918
percep_plot_list <- list(plot_cooker(gjg, condition, effortEfficacy, "Can you meaningfully contribute to efforts to address climate change"),
plot_cooker(gjg, condition, dayToDayEfficacyR, "Your day-to-day behaviors have \n\ no impact on efforts to mitigate climate change"),
plot_cooker(gjg, condition, americansEfficacy1, "Americans are capable of effectively mitigating climate change"),
plot_cooker(gjg, condition, americansEfficacy2, "Americans are capable of engaging in \n\ collaborative efforts to mitigate climate change"))
percep_plot_arranged <- ggarrange(plotlist = percep_plot_list, ncol = 2, nrow = 2)
plot_grid(percep_plot_arranged, ncol = 1, rel_heights = c(0.1, 0.9))
mod_effortEfficacy <- lm(effortEfficacy ~ condition, data = gjg)
summary(mod_effortEfficacy)
##
## Call:
## lm(formula = effortEfficacy ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.06376 -0.99317 0.00683 0.93624 2.27027
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.72973 0.07016 38.905 < 2e-16 ***
## conditionassuredSuccess 0.33403 0.09906 3.372 0.000779 ***
## conditionuncertainSuccess 0.26344 0.09948 2.648 0.008236 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.207 on 884 degrees of freedom
## Multiple R-squared: 0.01406, Adjusted R-squared: 0.01183
## F-statistic: 6.304 on 2 and 884 DF, p-value: 0.001912
mod_aeffortEfficacy <- lm(effortEfficacy ~ condition, data = gjg_aRef)
summary(mod_aeffortEfficacy)
##
## Call:
## lm(formula = effortEfficacy ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.06376 -0.99317 0.00683 0.93624 2.27027
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.06376 0.06993 43.813 < 2e-16 ***
## conditioncontrol -0.33403 0.09906 -3.372 0.000779 ***
## conditionuncertainSuccess -0.07058 0.09931 -0.711 0.477445
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.207 on 884 degrees of freedom
## Multiple R-squared: 0.01406, Adjusted R-squared: 0.01183
## F-statistic: 6.304 on 2 and 884 DF, p-value: 0.001912
mod_dayToDayEfficacyR <- lm(dayToDayEfficacyR ~ condition, data = gjg)
summary(mod_dayToDayEfficacyR)
##
## Call:
## lm(formula = dayToDayEfficacyR ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.520 -1.372 -0.372 0.628 2.628
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.52027 0.07370 34.195 <2e-16 ***
## conditionassuredSuccess -0.09074 0.10406 -0.872 0.383
## conditionuncertainSuccess -0.14826 0.10450 -1.419 0.156
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.268 on 884 degrees of freedom
## Multiple R-squared: 0.002312, Adjusted R-squared: 5.466e-05
## F-statistic: 1.024 on 2 and 884 DF, p-value: 0.3595
mod_adayToDayEfficacyR <- lm(dayToDayEfficacyR ~ condition, data = gjg_aRef)
summary(mod_adayToDayEfficacyR)
##
## Call:
## lm(formula = dayToDayEfficacyR ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.520 -1.372 -0.372 0.628 2.628
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.42953 0.07345 33.075 <2e-16 ***
## conditioncontrol 0.09074 0.10406 0.872 0.383
## conditionuncertainSuccess -0.05752 0.10432 -0.551 0.582
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.268 on 884 degrees of freedom
## Multiple R-squared: 0.002312, Adjusted R-squared: 5.466e-05
## F-statistic: 1.024 on 2 and 884 DF, p-value: 0.3595
mod_americansEfficacy1 <- lm(americansEfficacy1 ~ condition, data = gjg)
summary(mod_americansEfficacy1)
##
## Call:
## lm(formula = americansEfficacy1 ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.36913 -1.02365 -0.02365 0.73379 1.97635
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.02365 0.06894 43.862 < 2e-16 ***
## conditionassuredSuccess 0.34548 0.09733 3.550 0.000406 ***
## conditionuncertainSuccess 0.24256 0.09774 2.482 0.013259 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.186 on 884 degrees of freedom
## Multiple R-squared: 0.01479, Adjusted R-squared: 0.01256
## F-statistic: 6.635 on 2 and 884 DF, p-value: 0.001381
mod_aamericansEfficacy1 <- lm(americansEfficacy1 ~ condition, data = gjg_aRef)
summary(mod_aamericansEfficacy1)
##
## Call:
## lm(formula = americansEfficacy1 ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.36913 -1.02365 -0.02365 0.73379 1.97635
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.36913 0.06870 49.038 < 2e-16 ***
## conditioncontrol -0.34548 0.09733 -3.550 0.000406 ***
## conditionuncertainSuccess -0.10292 0.09758 -1.055 0.291839
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.186 on 884 degrees of freedom
## Multiple R-squared: 0.01479, Adjusted R-squared: 0.01256
## F-statistic: 6.635 on 2 and 884 DF, p-value: 0.001381
mod_americansEfficacy2 <- lm(americansEfficacy2 ~ condition, data = gjg)
summary(mod_americansEfficacy2)
##
## Call:
## lm(formula = americansEfficacy2 ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.4607 -0.4607 -0.2027 0.7973 1.7973
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.20270 0.06813 47.006 <2e-16 ***
## conditionassuredSuccess 0.20669 0.09619 2.149 0.0319 *
## conditionuncertainSuccess 0.25805 0.09660 2.671 0.0077 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.172 on 884 degrees of freedom
## Multiple R-squared: 0.00899, Adjusted R-squared: 0.006748
## F-statistic: 4.01 on 2 and 884 DF, p-value: 0.01847
mod_aamericansEfficacy2 <- lm(americansEfficacy2 ~ condition, data = gjg_aRef)
summary(mod_aamericansEfficacy2)
##
## Call:
## lm(formula = americansEfficacy2 ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.4607 -0.4607 -0.2027 0.7973 1.7973
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.40940 0.06790 50.209 <2e-16 ***
## conditioncontrol -0.20669 0.09619 -2.149 0.0319 *
## conditionuncertainSuccess 0.05135 0.09644 0.533 0.5945
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.172 on 884 degrees of freedom
## Multiple R-squared: 0.00899, Adjusted R-squared: 0.006748
## F-statistic: 4.01 on 2 and 884 DF, p-value: 0.01847
percep_plot_list <- list(plot_cooker(gjg, condition, optimism, "I'm optimistic we can mitigate climate change"),
plot_cooker(gjg, condition, hope, "I am hopeful that we will successfully mitigate climate change"))
percep_plot_arranged <- ggarrange(plotlist = percep_plot_list, ncol = 2, nrow = 1)
plot_grid(percep_plot_arranged, ncol = 1, rel_heights = c(0.1, 0.9))
pol_line(gjg, pol, optimism)
pol_line(gjg, pol, hope)
mod_optimism <- lm(optimism ~ condition, data = gjg)
summary(mod_optimism)
##
## Call:
## lm(formula = optimism ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.0403 -0.9655 0.1092 1.1092 2.5878
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.41216 0.09628 45.825 < 2e-16 ***
## conditionassuredSuccess 0.62811 0.13594 4.621 4.4e-06 ***
## conditionuncertainSuccess 0.47862 0.13651 3.506 0.000478 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.657 on 884 degrees of freedom
## Multiple R-squared: 0.02564, Adjusted R-squared: 0.02344
## F-statistic: 11.63 on 2 and 884 DF, p-value: 1.033e-05
mod_aoptimism <- lm(optimism ~ condition, data = gjg_aRef)
summary(mod_aoptimism)
##
## Call:
## lm(formula = optimism ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.0403 -0.9655 0.1092 1.1092 2.5878
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.04027 0.09596 52.525 < 2e-16 ***
## conditioncontrol -0.62811 0.13594 -4.621 4.4e-06 ***
## conditionuncertainSuccess -0.14948 0.13628 -1.097 0.273
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.657 on 884 degrees of freedom
## Multiple R-squared: 0.02564, Adjusted R-squared: 0.02344
## F-statistic: 11.63 on 2 and 884 DF, p-value: 1.033e-05
mod_hope <- lm(hope ~ condition, data = gjg)
summary(mod_hope)
##
## Call:
## lm(formula = hope ~ condition, data = gjg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.7383 -0.7383 0.2617 1.2617 1.5608
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.43919 0.07194 47.805 < 2e-16 ***
## conditionassuredSuccess 0.29907 0.10157 2.944 0.00332 **
## conditionuncertainSuccess 0.13078 0.10200 1.282 0.20015
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.238 on 884 degrees of freedom
## Multiple R-squared: 0.009765, Adjusted R-squared: 0.007524
## F-statistic: 4.358 on 2 and 884 DF, p-value: 0.01307
mod_ahope <- lm(hope ~ condition, data = gjg_aRef)
summary(mod_ahope)
##
## Call:
## lm(formula = hope ~ condition, data = gjg_aRef)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.7383 -0.7383 0.2617 1.2617 1.5608
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.7383 0.0717 52.137 < 2e-16 ***
## conditioncontrol -0.2991 0.1016 -2.944 0.00332 **
## conditionuncertainSuccess -0.1683 0.1018 -1.653 0.09876 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.238 on 884 degrees of freedom
## Multiple R-squared: 0.009765, Adjusted R-squared: 0.007524
## F-statistic: 4.358 on 2 and 884 DF, p-value: 0.01307
percep_plot_list <- list(plot_cooker(gjg, condition, intergenerational1, "I feel connected to future generations"),
plot_cooker(gjg, condition, intergenerational2, "I feel connected to those that came before me"),
plot_cooker(gjg, condition, american1, "I identify as American"),
plot_cooker(gjg, condition, american2, "Being an American is an important part of who I am"))
percep_plot_arranged <- ggarrange(plotlist = percep_plot_list, ncol = 2, nrow = 2)
plot_grid(percep_plot_arranged, ncol = 1, rel_heights = c(0.1, 0.9))
pol_line(gjg, pol, intergenerational1)
pol_line(gjg, pol, intergenerational2)
pol_line(gjg, pol, american1)
pol_line(gjg, pol, american2)
# mod_intergenerational1 <- lm(intergenerational1 ~ condition, data = gjg)
# summary(mod_taxForFuture)
#
# mod_aintergenerational1 <- lm(intergenerational1 ~ condition, data = gjg_aRef)
# summary(mod_ataxForFuture)
#
# mod_intergenerational2 <- lm(intergenerational2 ~ condition, data = gjg)
# summary(mod_intergenerational2)
#
# mod_aintergenerational2 <- lm(intergenerational2 ~ condition, data = gjg_aRef)
# summary(mod_aintergenerational2)
#
# mod_american1 <- lm(american1 ~ condition, data = gjg)
# summary(mod_american1)
#
# mod_aamerican1 <- lm(american1 ~ condition, data = gjg_aRef)
# summary(mod_aamerican1)
#
# mod_american2 <- lm(american2 ~ condition, data = gjg)
# summary(mod_american2)
#
# mod_aamerican2 <- lm(american2 ~ condition, data = gjg_aRef)
# summary(mod_aamerican2)
gjg <- within(gjg, {
uncertainSuccess <- ifelse(condition == "uncertainSuccess", 1, 0)
assuredSuccess <- ifelse(condition == "assuredSuccess", 1, 0)
})
# Define the serial mediation model
mediation.model <- '
donation ~ c*obligation_z + e*gratitude_z + f1*uncertainSuccess + f2*assuredSuccess
gratitude_z ~ a1*uncertainSuccess + a2*assuredSuccess
obligation_z ~ b*gratitude_z + d1*uncertainSuccess + d2*assuredSuccess
UN_grat_obl_don := a1 * b * c
UN_grat_don := a1 * e
UN_obl_don := d1 * c
AS_grat_obl_don := a2 * b * c
AS_grat_don := a2 * e
AS_obl_don := d2 * c
total_UN_M := a1 * b * c + a1*e + d1*c + f1
total_AS_M := a2 * b * c + a1*e + d2*c + f2
total_I := b*c*e
'
# fit model
fit <- sem(mediation.model, data = gjg, bootstrap = 500)
# Summarize the model results
summary(fit, rsquare=T, fit.measures=T, ci=TRUE)
## lavaan 0.6.15 ended normally after 1 iteration
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 12
##
## Used Total
## Number of observations 885 887
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Model Test Baseline Model:
##
## Test statistic 481.704
## Degrees of freedom 9
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -5470.614
## Loglikelihood unrestricted model (H1) -5470.614
##
## Akaike (AIC) 10965.228
## Bayesian (BIC) 11022.655
## Sample-size adjusted Bayesian (SABIC) 10984.545
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.000
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## donation ~
## obligtn_z (c) 3.968 0.426 9.314 0.000 3.133 4.803
## gratitd_z (e) 1.625 0.458 3.551 0.000 0.728 2.522
## uncrtnScc (f1) 0.025 0.865 0.029 0.977 -1.671 1.721
## assrdSccs (f2) -1.061 0.872 -1.217 0.224 -2.770 0.648
## gratitude_z ~
## uncrtnScc (a1) 0.538 0.070 7.714 0.000 0.401 0.675
## assrdSccs (a2) 0.633 0.069 9.133 0.000 0.497 0.769
## obligation_z ~
## gratitd_z (b) 0.508 0.032 15.964 0.000 0.446 0.570
## uncrtnScc (d1) -0.091 0.068 -1.327 0.184 -0.224 0.043
## assrdSccs (d2) -0.122 0.069 -1.771 0.077 -0.256 0.013
##
## Variances:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## .donation 102.774 4.886 21.036 0.000 93.198 112.350
## .gratitude_z 0.714 0.034 21.036 0.000 0.648 0.781
## .obligation_z 0.640 0.030 21.036 0.000 0.580 0.699
##
## R-Square:
## Estimate
## donation 0.163
## gratitude_z 0.098
## obligation_z 0.231
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## UN_grat_obl_dn 1.085 0.195 5.568 0.000 0.703 1.466
## UN_grat_don 0.874 0.271 3.226 0.001 0.343 1.406
## UN_obl_don -0.359 0.273 -1.314 0.189 -0.895 0.177
## AS_grat_obl_dn 1.276 0.211 6.037 0.000 0.862 1.691
## AS_grat_don 1.029 0.311 3.310 0.001 0.420 1.639
## AS_obl_don -0.483 0.277 -1.740 0.082 -1.026 0.061
## total_UN_M 1.625 0.913 1.780 0.075 -0.165 3.414
## total_AS_M 0.607 0.900 0.675 0.500 -1.157 2.371
## total_I 3.275 0.842 3.888 0.000 1.624 4.927
gjg <- within(gjg, {
treatments <- ifelse(condition == "uncertainSuccess", 1, ifelse(condition == "assuredSuccess", 0, NA))
})
gjg$treatments
## [1] 1 0 NA 1 0 NA 0 0 NA 0 1 NA 0 1 NA 1 0 NA NA NA 0 1 0 NA NA
## [26] NA 1 1 1 0 0 1 NA 0 1 0 1 NA 1 0 1 1 NA 0 NA 0 0 0 1 NA
## [51] NA 0 NA 1 1 0 0 0 0 0 0 NA 1 1 1 NA NA 1 0 1 NA NA 1 0 1
## [76] 1 0 1 1 NA 0 0 NA NA NA NA 1 1 1 0 1 1 0 NA 0 1 1 1 NA 1
## [101] NA 1 0 0 NA NA 1 1 1 0 0 0 NA 1 0 NA NA NA NA 0 NA 0 1 NA 0
## [126] 1 0 NA 1 0 0 NA 0 NA NA 0 1 0 0 0 0 NA 0 NA NA 0 NA 0 NA NA
## [151] NA NA 1 0 1 NA 0 1 NA 1 0 0 1 NA NA 0 1 0 1 0 1 NA 1 NA NA
## [176] NA 0 1 NA 0 1 NA NA 0 0 0 0 0 0 1 1 0 NA NA NA 0 1 1 1 1
## [201] NA 0 1 NA 1 NA NA NA NA 0 NA 1 NA NA 0 0 NA 1 1 0 1 NA 1 1 0
## [226] 0 1 1 NA 1 0 NA 1 1 1 0 0 0 0 1 NA NA 1 NA NA 1 1 1 1 0
## [251] 0 1 1 NA 0 NA NA 1 NA NA NA 1 NA 0 0 1 NA NA 0 0 0 0 0 1 1
## [276] NA 1 1 1 0 0 NA NA 1 1 0 1 0 NA 0 0 1 NA 1 NA 1 0 1 0 1
## [301] 0 0 NA 1 NA NA 1 0 0 0 NA NA 1 0 1 NA NA NA NA NA 0 1 NA 0 0
## [326] NA 1 NA 0 0 NA NA 0 0 NA NA 0 1 1 0 0 1 1 NA NA 1 NA 1 1 1
## [351] NA NA 1 0 0 NA 0 0 0 1 NA 1 NA NA 0 0 1 NA 0 0 0 NA 1 0 0
## [376] NA 1 0 NA 1 0 1 0 1 NA 1 0 1 0 0 NA 1 NA 1 1 0 0 NA 1 NA
## [401] 0 1 NA 1 0 NA NA 0 1 1 NA NA 1 0 NA NA NA NA 0 NA 1 0 1 1 1
## [426] NA NA NA 1 NA 1 NA 1 1 NA NA 1 1 NA 0 0 0 NA 0 0 1 0 0 0 NA
## [451] 0 0 1 0 NA 1 0 0 NA 1 1 1 0 NA 1 0 0 1 1 0 NA 0 1 NA NA
## [476] 1 0 1 1 NA 1 1 0 0 NA NA 1 1 0 0 1 1 1 NA NA 0 1 NA 1 1
## [501] NA NA 1 1 0 NA 0 NA NA NA 1 0 1 1 1 0 1 0 NA 0 1 1 0 0 NA
## [526] 0 1 1 1 1 NA 1 0 1 0 1 0 0 0 1 1 0 NA 0 1 NA NA 1 0 0
## [551] 1 NA 1 0 1 NA NA 1 1 NA 0 1 1 1 0 NA NA 0 0 0 NA 0 0 0 NA
## [576] 0 0 1 1 0 1 NA NA 1 0 NA NA 0 NA 0 NA 0 1 1 1 1 NA NA 0 NA
## [601] 0 NA 1 0 0 1 1 NA 0 1 0 1 1 NA NA NA 0 0 NA 1 0 NA NA 1 NA
## [626] 1 0 0 1 NA NA 1 0 0 NA 0 0 NA NA 1 0 NA 0 1 1 1 0 NA NA NA
## [651] NA 1 1 1 NA 0 0 0 0 0 NA NA 0 NA 0 NA NA 0 0 0 NA 0 0 NA 1
## [676] 0 1 NA 0 0 NA 1 NA 0 NA NA 0 1 0 NA NA 0 NA 1 0 1 0 1 0 1
## [701] NA 0 1 0 NA 0 0 NA NA 1 NA 1 1 NA 1 NA NA NA 1 NA 1 NA 1 1 NA
## [726] 0 0 0 0 NA NA NA NA 1 1 0 1 NA 0 NA 0 NA 0 1 1 0 0 0 1 NA
## [751] 1 1 NA NA 1 0 NA 1 NA 1 NA 0 1 NA NA 0 NA 1 0 NA NA 0 0 NA 0
## [776] NA 0 1 1 1 0 0 NA 1 NA 1 NA 0 1 0 0 1 0 NA 1 0 1 1 1 1
## [801] 0 NA 1 0 0 1 NA 0 0 NA NA 1 NA 0 1 1 0 NA 1 0 1 1 0 0 1
## [826] NA 1 NA 1 0 NA 1 NA 0 0 1 0 NA 0 1 NA 1 1 1 NA NA NA 0 0 0
## [851] NA 1 1 1 0 NA 0 1 1 NA 0 1 NA 0 NA 0 0 NA NA NA NA NA 1 NA 1
## [876] 0 NA 1 1 1 NA 0 NA NA 1 0 NA
levels(gjg$treatments)
## NULL
# Define the serial mediation model
mediation.model <- '
opportunityChoiceNum ~ b*HP_z + c*treatments
HP_z ~ a*treatments
indirect := a * b
'
multipleMediation <- '
opportunityChoiceNum ~ b1 * gratitude_z + b2 * obligation_z + b3 * moralToAct_z + b4 * efficacy_z + b5 * HP_z + b6 * IG_z + c * treatments
gratitude_z ~ a1*treatments
obligation_z ~ a2*treatments
moralToAct_z ~ a3*treatments
efficacy_z ~ a4*treatments
HP_z ~ a5*treatments
IG_z ~ a6*treatments
gratitude_indirect := a1 * b1
obligation_indirect := a2 * b2
moral_indirect := a3 * b3
efficacy_indirect := a4 * b4
HP_indirect := a5 * b5
IG_indirect := a6 * b6
total := c + (a1 * b1) + (a2 * b2) + (a3 * b3) + (a4 * b4) + (a5 * b5) + (a6 * b6)
'
# fit model
fit <- sem(multipleMediation, data = gjg, bootstrap = 500)
# Summarize the model results
summary(fit, rsquare=T, fit.measures=T, ci=TRUE)
## lavaan 0.6.15 ended normally after 10 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 20
##
## Used Total
## Number of observations 589 887
##
## Model Test User Model:
##
## Test statistic 1657.038
## Degrees of freedom 15
## P-value (Chi-square) 0.000
##
## Model Test Baseline Model:
##
## Test statistic 1776.925
## Degrees of freedom 28
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.061
## Tucker-Lewis Index (TLI) -0.753
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -4648.176
## Loglikelihood unrestricted model (H1) -3819.657
##
## Akaike (AIC) 9336.351
## Bayesian (BIC) 9423.920
## Sample-size adjusted Bayesian (SABIC) 9360.427
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.431
## 90 Percent confidence interval - lower 0.414
## 90 Percent confidence interval - upper 0.449
## P-value H_0: RMSEA <= 0.050 0.000
## P-value H_0: RMSEA >= 0.080 1.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.343
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## opportunityChoiceNum ~
## gratitd_z (b1) -0.008 0.022 -0.365 0.715 -0.051 0.035
## obligtn_z (b2) 0.085 0.020 4.195 0.000 0.045 0.124
## mrlTAct_z (b3) 0.161 0.023 6.937 0.000 0.115 0.206
## efficcy_z (b4) 0.008 0.023 0.341 0.733 -0.037 0.052
## HP_z (b5) 0.021 0.020 1.034 0.301 -0.019 0.060
## IG_z (b6) 0.018 0.023 0.790 0.430 -0.027 0.063
## treatmnts (c) 0.038 0.036 1.050 0.294 -0.033 0.108
## gratitude_z ~
## treatmnts (a1) -0.099 0.067 -1.478 0.139 -0.230 0.032
## obligation_z ~
## treatmnts (a2) -0.018 0.073 -0.244 0.807 -0.160 0.125
## moralToAct_z ~
## treatmnts (a3) -0.006 0.063 -0.102 0.919 -0.131 0.118
## efficacy_z ~
## treatmnts (a4) -0.018 0.065 -0.278 0.781 -0.145 0.109
## HP_z ~
## treatmnts (a5) -0.114 0.073 -1.561 0.118 -0.257 0.029
## IG_z ~
## treatmnts (a6) -0.011 0.064 -0.177 0.860 -0.137 0.114
##
## Variances:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## .opportntyChcNm 0.187 0.011 17.161 0.000 0.166 0.208
## .gratitude_z 0.660 0.038 17.161 0.000 0.585 0.736
## .obligation_z 0.780 0.045 17.161 0.000 0.691 0.869
## .moralToAct_z 0.591 0.034 17.161 0.000 0.524 0.659
## .efficacy_z 0.622 0.036 17.161 0.000 0.551 0.693
## .HP_z 0.786 0.046 17.161 0.000 0.696 0.876
## .IG_z 0.606 0.035 17.161 0.000 0.537 0.675
##
## R-Square:
## Estimate
## opportntyChcNm 0.104
## gratitude_z 0.004
## obligation_z 0.000
## moralToAct_z 0.000
## efficacy_z 0.000
## HP_z 0.004
## IG_z 0.000
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## gratitud_ndrct 0.001 0.002 0.355 0.723 -0.004 0.005
## obligatn_ndrct -0.002 0.006 -0.244 0.807 -0.014 0.011
## moral_indirect -0.001 0.010 -0.102 0.919 -0.021 0.019
## efficacy_ndrct -0.000 0.001 -0.215 0.829 -0.001 0.001
## HP_indirect -0.002 0.003 -0.862 0.389 -0.008 0.003
## IG_indirect -0.000 0.001 -0.173 0.863 -0.003 0.002
## total 0.033 0.038 0.880 0.379 -0.041 0.107
# just treatment conditions
gjg_treat <- gjg %>% filter(gjg$condition != "control")
gjg_treat$treatment <- paste(gjg_treat$condition)
gjg_treat$treatment
## [1] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [4] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [7] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [10] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [13] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [16] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [19] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [22] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [25] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [28] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [31] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [34] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [37] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [40] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [43] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [46] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [49] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [52] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [55] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [58] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [61] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [64] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [67] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [70] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [73] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [76] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [79] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [82] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [85] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [88] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [91] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [94] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [97] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [100] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [103] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [106] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [109] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [112] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [115] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [118] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [121] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [124] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [127] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [130] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [133] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [136] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [139] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [142] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [145] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [148] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [151] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [154] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [157] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [160] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [163] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [166] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [169] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [172] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [175] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [178] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [181] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [184] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [187] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [190] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [193] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [196] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [199] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [202] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [205] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [208] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [211] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [214] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [217] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [220] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [223] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [226] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [229] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [232] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [235] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [238] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [241] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [244] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [247] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [250] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [253] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [256] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [259] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [262] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [265] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [268] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [271] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [274] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [277] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [280] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [283] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [286] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [289] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [292] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [295] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [298] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [301] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [304] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [307] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [310] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [313] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [316] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [319] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [322] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [325] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [328] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [331] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [334] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [337] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [340] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [343] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [346] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [349] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [352] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [355] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [358] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [361] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [364] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [367] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [370] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [373] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [376] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [379] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [382] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [385] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [388] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [391] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [394] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [397] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [400] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [403] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [406] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [409] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [412] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [415] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [418] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [421] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [424] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [427] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [430] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [433] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [436] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [439] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [442] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [445] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [448] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [451] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [454] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [457] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [460] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [463] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [466] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [469] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [472] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [475] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [478] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [481] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [484] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [487] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [490] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [493] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [496] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [499] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [502] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [505] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [508] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [511] "uncertainSuccess" "assuredSuccess" "assuredSuccess"
## [514] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [517] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [520] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [523] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [526] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [529] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [532] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [535] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [538] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [541] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [544] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [547] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
## [550] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [553] "assuredSuccess" "uncertainSuccess" "uncertainSuccess"
## [556] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [559] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [562] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [565] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [568] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [571] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [574] "assuredSuccess" "assuredSuccess" "uncertainSuccess"
## [577] "uncertainSuccess" "assuredSuccess" "uncertainSuccess"
## [580] "assuredSuccess" "assuredSuccess" "assuredSuccess"
## [583] "uncertainSuccess" "uncertainSuccess" "assuredSuccess"
## [586] "uncertainSuccess" "uncertainSuccess" "uncertainSuccess"
## [589] "assuredSuccess" "uncertainSuccess" "assuredSuccess"
gjg_treat$treatment <- as.factor(gjg_treat$treatment)
levels(gjg_treat$treatment)
## [1] "assuredSuccess" "uncertainSuccess"
library(lsr)
cohensD(gjg_treat$opportunityChoiceNum ~ gjg_treat$treatment)
## [1] 0.07619912
# merging reflection on past generations open response into one column
gjg_treat$openResponse <- paste(gjg_treat$assuredP2Response, gjg_treat$uncertainP2Response)
# making a token for each word
tidy_treat <- gjg_treat %>%
unnest_tokens(word, openResponse)
#removing stop words
tidy_treat <- tidy_treat %>%
anti_join(stop_words)
# word count sorted most to least frequent and by condition
tidy_treat %>%
dplyr::count(word, sort = TRUE) %>%
mutate(word = reorder(word, n)) %>%
slice_max(n = 10, order_by = n) %>%
ggplot(aes(word, n)) +
geom_col() +
xlab(NULL) +
coord_flip()
tidy_treat %>%
dplyr::count(condition, word, sort = TRUE) %>%
group_by(condition) %>%
mutate(word = reorder(word, n)) %>%
slice_max(n = 10, order_by = n) %>%
ggplot(aes(word, n, fill = condition)) +
geom_col(position = "dodge") +
xlab(NULL) +
coord_flip()
tidy_treat %>%
dplyr::count(condition, word, sort = TRUE) %>%
group_by(condition) %>%
mutate(rank = row_number()) %>%
filter(rank <= 10) %>%
ungroup() %>%
ggplot(aes(word, n, fill = condition)) +
geom_col(position = "dodge") +
xlab(NULL) +
coord_flip() +
facet_wrap(~ condition, scales = "free", ncol = 1)
tidy_treat %>%
dplyr::count(condition, word, sort = TRUE) %>%
pivot_wider(names_from = condition, values_from = n, values_fill = 0) %>%
mutate(difference = abs(`assuredSuccess` - `uncertainSuccess`)) %>%
arrange(desc(difference)) %>%
slice_head(n = 10) %>%
ggplot(aes(word, difference, fill = factor(assuredSuccess > uncertainSuccess))) +
geom_col(position = "dodge") +
xlab(NULL) +
coord_flip()
tidy_treat %>%
anti_join(stop_words) %>%
dplyr::count(word) %>%
with(wordcloud(word, n, max.words = 100))
tidy_treat %>%
filter(tidy_treat$condition == "assuredSuccess") %>%
anti_join(stop_words) %>%
dplyr::count(word) %>%
with(wordcloud(word, n, max.words = 100))
tidy_treat %>%
filter(tidy_treat$condition == "uncertainSuccess") %>%
anti_join(stop_words) %>%
dplyr::count(word) %>%
with(wordcloud(word, n, max.words = 100))
nrc <- get_sentiments("nrc")
sent_treat <- tidy_treat %>%
inner_join(nrc) %>%
group_by(condition, word) %>%
dplyr::count(word, sort = TRUE)
top_words_by_condition <- sent_treat %>%
group_by(condition) %>%
top_n(10, n) %>%
ungroup()
ggplot(top_words_by_condition, aes(reorder(word, n), n, fill = condition)) +
geom_col(position = "dodge") +
xlab(NULL) +
coord_flip() +
facet_wrap(~ condition, scales = "free", ncol = 1)
tidy_treat %>%
filter(tidy_treat$condition == "assuredSuccess") %>%
inner_join(get_sentiments("bing")) %>%
dplyr::count(word, sentiment, sort = TRUE) %>%
acast(word ~ sentiment, value.var = "n", fill = 0) %>%
comparison.cloud(colors = c("red", "green"),
max.words = 100)
tidy_treat %>%
filter(tidy_treat$condition == "uncertainSuccess") %>%
inner_join(get_sentiments("bing")) %>%
dplyr::count(word, sentiment, sort = TRUE) %>%
acast(word ~ sentiment, value.var = "n", fill = 0) %>%
comparison.cloud(colors = c("red", "green"),
max.words = 100)
tidy_treat %>%
inner_join(get_sentiments("bing")) %>%
dplyr::count(condition, sentiment) %>%
spread(sentiment, n, fill = 0) %>%
mutate(sentiment = positive - negative)
## condition negative positive sentiment
## 1 assuredSuccess 148 279 131
## 2 uncertainSuccess 181 279 98