knitr::opts_chunk$set(echo = TRUE)
#Set up the packages
if(!require(rcompanion)){install.packages('rcompanion', dependencies = TRUE)} #For cramer V
## Loading required package: rcompanion
## Warning: package 'rcompanion' was built under R version 4.0.3
if(!require(readxl)){install.packages('readxl', dependencies = TRUE)} #For reading excel file
## Loading required package: readxl
if(!require(compute.es)){install.packages('compute.es', dependencies = TRUE)} #For effect size conversion
## Loading required package: compute.es
## Warning: package 'compute.es' was built under R version 4.0.3
if(!require(DescTools)){install.packages('DescTools', dependencies = TRUE)} #For cramer V CIs calculations
## Loading required package: DescTools
## Warning: package 'DescTools' was built under R version 4.0.3
if(!require(corpora)){install.packages('corpora', dependencies = TRUE)} #For z score
## Loading required package: corpora
## Warning: package 'corpora' was built under R version 4.0.3
if(!require(pander)){install.packages('pander', dependencies = TRUE)} #For session info
## Loading required package: pander
## Warning: package 'pander' was built under R version 4.0.3
if(!require(exact2x2)){install.packages('exact2x2', dependencies = TRUE)} #For McNemar test
## Loading required package: exact2x2
## Warning: package 'exact2x2' was built under R version 4.0.3
## Loading required package: exactci
## Warning: package 'exactci' was built under R version 4.0.3
## Loading required package: ssanv
## Warning: package 'ssanv' was built under R version 4.0.3
if(!require(haven)){install.packages('haven', dependencies = TRUE)} #For reading SPSS file
## Loading required package: haven
if(!require(tidyverse)){install.packages('tidyverse', dependencies = TRUE)} #For cleaning
## Loading required package: tidyverse
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.3 v purrr 0.3.4
## v tibble 3.0.4 v dplyr 1.0.2
## v tidyr 1.1.2 v stringr 1.4.0
## v readr 1.3.1 v forcats 0.5.0
## Warning: package 'ggplot2' was built under R version 4.0.5
## Warning: package 'tibble' was built under R version 4.0.3
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
if(!require(ggplot2)){install.packages('ggplot2', dependencies = TRUE)} #For plotting
if(!require(patchwork)){install.packages('patchwork', dependencies = TRUE)} #For combining plots
## Loading required package: patchwork
## Warning: package 'patchwork' was built under R version 4.0.4
if(!require(ggtext)){install.packages('ggtext', dependencies = TRUE)} #For annotation in ggplots
## Loading required package: ggtext
## Warning: package 'ggtext' was built under R version 4.0.5
library(rcompanion)
library(readxl)
library(compute.es)
library(DescTools)
library(corpora)
library(pander)
library(exact2x2)
library(haven)
library(tidyverse)
library(ggplot2)
library(patchwork)
library(ggtext)
##Study 1A General Action and Inaction Regret
#Read the datafile
datagmr <- read_sav("Gilovich+and+Medvec+(1994)+replication+and+extension+V3-G_May+4,+2021_10.10.sav")
#Count action and inaction frequencies and no. of participants. There are two columns for the same question with different orders
inaction1a_a <- sum((datagmr$actinactregret_a[!is.na(datagmr$actinactregret_a)])==1)
action1a_a <- sum((datagmr$actinactregret_a[!is.na(datagmr$actinactregret_a)])==2)
n1_a <- length(datagmr$actinactregret_a[!is.na(datagmr$actinactregret_a)])
inaction1a_b <- sum((datagmr$actinactregret_b[!is.na(datagmr$actinactregret_b)])==1)
action1a_b <- sum((datagmr$actinactregret_b[!is.na(datagmr$actinactregret_b)])==2)
n1_b <- length(datagmr$actinactregret_b[!is.na(datagmr$actinactregret_b)])
inaction1a <- inaction1a_a + inaction1a_b
inaction1a
## [1] 341
action1a <- action1a_a + action1a_b
action1a
## [1] 205
n1 <- n1_a+n1_b
n1
## [1] 546
#Create a vector with action and inaction
observed1areg = c( action1a, inaction1a)
#Calculate chi square
chisqstudy1a <- chisq.test(observed1areg, p = c(1/2, 1/2))
chisqstudy1a
##
## Chi-squared test for given probabilities
##
## data: observed1areg
## X-squared = 33.875, df = 1, p-value = 5.876e-09
#Calculate z score
z.score(action1a, n1, p = 0.5, correct = TRUE)
## [1] -5.777467
#Calculate proportions and CIs of action and inaction
propaction1a <- prop.test(x = action1a, n = n1, p = 0.5,
correct = FALSE)
propaction1a
##
## 1-sample proportions test without continuity correction
##
## data: action1a out of n1, null probability 0.5
## X-squared = 33.875, df = 1, p-value = 5.876e-09
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.3358433 0.4168127
## sample estimates:
## p
## 0.3754579
propinaction1a <- prop.test(x = inaction1a, n = n1, p = 0.5,
correct = FALSE)
propinaction1a
##
## 1-sample proportions test without continuity correction
##
## data: inaction1a out of n1, null probability 0.5
## X-squared = 33.875, df = 1, p-value = 5.876e-09
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.5831873 0.6641567
## sample estimates:
## p
## 0.6245421
#Calculate cramer V
expected1areg = c( 1/2, 1/2)
oneacramerreg <- cramerVFit(x = observed1areg, p = expected1areg, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
oneacramerreg
## Cramer.V lower.ci upper.ci
## 1 0.2491 0.1722 0.337
#Transform the counts into percentages
inaction1a_perc <- inaction1a/n1 * 100
action1a_perc <- action1a/n1 * 100
observed1areg_per <- c(action1a_perc, inaction1a_perc)
## Study 1A General Action and Inaction Responsibility
#Count action and inaction frequencies and no. of participants. There are two columns for the same question with different orders
inaction1aresp_a <- sum((datagmr$actinactres_a[!is.na(datagmr$actinactres_a)])==1)
action1aresp_a <- sum((datagmr$actinactres_a[!is.na(datagmr$actinactres_a)])==2)
n1res_a <- length(datagmr$actinactres_a[!is.na(datagmr$actinactres_a)])
inaction1aresp_b <- sum((datagmr$actinactres_b[!is.na(datagmr$actinactres_b)])==1)
action1aresp_b <- sum((datagmr$actinactres_b[!is.na(datagmr$actinactres_b)])==2)
n1res_b <- length(datagmr$actinactres_b[!is.na(datagmr$actinactres_b)])
inaction1aresp <- inaction1aresp_a + inaction1aresp_b
inaction1aresp
## [1] 181
action1aresp <- action1aresp_a + action1aresp_b
action1aresp
## [1] 290
n1resp <- n1res_a+n1res_b
n1resp
## [1] 471
#Create a vector with action and inaction
observed1aresp = c( action1aresp, inaction1aresp)
#Calculate chi square
chisqstudy1a_resp <- chisq.test(observed1aresp, p = c(1/2, 1/2))
chisqstudy1a_resp
##
## Chi-squared test for given probabilities
##
## data: observed1aresp
## X-squared = 25.225, df = 1, p-value = 5.102e-07
#Calculate z score
z.score(action1aresp, n1resp, p = 0.5, correct = TRUE)
## [1] 4.976377
#Calculate proportions and CIs of action and inaction
propaction1aresp <- prop.test(x = action1aresp, n = n1resp, p = 0.5,
correct = FALSE)
propaction1aresp
##
## 1-sample proportions test without continuity correction
##
## data: action1aresp out of n1resp, null probability 0.5
## X-squared = 25.225, df = 1, p-value = 5.102e-07
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.5710138 0.6585365
## sample estimates:
## p
## 0.6157113
propinaction1aresp <- prop.test(x = inaction1aresp, n = n1resp, p = 0.5,
correct = FALSE)
propinaction1aresp
##
## 1-sample proportions test without continuity correction
##
## data: inaction1aresp out of n1resp, null probability 0.5
## X-squared = 25.225, df = 1, p-value = 5.102e-07
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.3414635 0.4289862
## sample estimates:
## p
## 0.3842887
#Calculate cramer V
expected1aresp = c( 1/2, 1/2)
oneacramerresp <- cramerVFit(x = observed1aresp, p = expected1aresp, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
oneacramerresp
## Cramer.V lower.ci upper.ci
## 1 0.2314 0.138 0.3205
#Transform the counts into percentages
inaction1a_resp_perc <- inaction1aresp/n1resp * 100
action1a_resp_perc <- action1aresp/n1resp * 100
observed1aresp_per <- c(action1a_resp_perc, inaction1a_resp_perc)
#Code adapted from https://community.rstudio.com/t/inserting-error-bars-on-a-percentage-graph/54337, for bar plots
#Regret data for plotting
DF1Regret <- data.frame(ActionInactionRegret = c(rep("Action", action1a), rep("Inaction", inaction1a)))
DF1Regreterror <- data.frame(ActionInactionRegret = c("Action", "Inaction"),
Lower = c(33.58433, 58.31873),
Upper = c(41.68127, 66.41567))
DF1Regreterror
## ActionInactionRegret Lower Upper
## 1 Action 33.58433 41.68127
## 2 Inaction 58.31873 66.41567
#Regret plot
Study1_Regret_Plot <- ggplot(DF1Regret, aes(x = ActionInactionRegret, fill = ActionInactionRegret)) + labs(y = "Percentage Experiencing Stronger Regret", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF1Regreterror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 1A: Regret") + theme(plot.title = element_text(hjust = 0.5)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.25, 95% CI [0.17, 0.34]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.8, y = 5, label = "37.55%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.8, y = 5, label = "62.45%", hjust = 0, vjust = 1, fill = "cornsilk")
#Responsibility data for plotting
DF1Responsibility <- data.frame(ActionInactionResponsibility = c(rep("Action", action1aresp), rep("Inaction",inaction1aresp)))
DF1Responsibilityerror <- data.frame(ActionInactionResponsibility = c("Action", "Inaction"),
Lower = c(57.10138, 34.14635),
Upper = c(65.85365, 42.89862))
DF1Responsibilityerror
## ActionInactionResponsibility Lower Upper
## 1 Action 57.10138 65.85365
## 2 Inaction 34.14635 42.89862
#Responsibility plot
Study1_Responsibility_Plot <- ggplot(DF1Responsibility, aes(x = ActionInactionResponsibility, fill = ActionInactionResponsibility)) + labs(y = "Percentage Experiencing Stronger Responsibility", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF1Responsibilityerror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 1A: Responsibility") + theme(plot.title = element_text(hjust = 0.5)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.23, 95% CI [0.13, 0.32]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.8, y = 5, label = "61.57%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.8, y = 5, label = "38.42%", hjust = 0, vjust = 1, fill = "cornsilk")
#Combine above plots of Study 1
Study1_Regret_Plot + Study1_Responsibility_Plot
Summary:
We found support for inaction-effect in Study 1 for regret.
We found support for stronger responsibility for action.
## Study 5 Short Term Regret
#Read the datafile
datagmr <- read_sav("C:/Users/u3517/Dropbox/Gilovich and Medvec (1994) Replication/Datasets/Gilovich+and+Medvec+(1994)+replication+and+extension+V3-G_May+4,+2021_10.10.sav")
#Set up the table
tablestudy5regst <- table(datagmr$pastweekactinactreg)
tablestudy5regst
##
## 1 2
## 262 284
#Run the chi-square test
chisqstudy5regst <- chisq.test(tablestudy5regst, p = c(1/2, 1/2))
chisqstudy5regst
##
## Chi-squared test for given probabilities
##
## data: tablestudy5regst
## X-squared = 0.88645, df = 1, p-value = 0.3464
#Count action and inaction frequencies and no. of participants
inaction5regst <- sum((datagmr$pastweekactinactreg[!is.na(datagmr$pastweekactinactreg)])==1)
action5regst <- sum((datagmr$pastweekactinactreg[!is.na(datagmr$pastweekactinactreg)])==2)
n5regst <- length(datagmr$pastweekactinactreg[!is.na(datagmr$pastweekactinactreg)])
#Calculate z score
z.score(action5regst, n5regst, p = 0.5, correct = TRUE)
## [1] 0.898717
#Calculate proportions and CIs of action and inaction
propaction5regst <- prop.test(x = action5regst, n = n5regst, p = 0.5,
correct = FALSE)
propaction5regst
##
## 1-sample proportions test without continuity correction
##
## data: action5regst out of n5regst, null probability 0.5
## X-squared = 0.88645, df = 1, p-value = 0.3464
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.4782469 0.5617647
## sample estimates:
## p
## 0.5201465
propinaction5regst <- prop.test(x = inaction5regst, n = n5regst, p = 0.5,
correct = FALSE)
propinaction5regst
##
## 1-sample proportions test without continuity correction
##
## data: inaction5regst out of n5regst, null probability 0.5
## X-squared = 0.88645, df = 1, p-value = 0.3464
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.4382353 0.5217531
## sample estimates:
## p
## 0.4798535
#Calculate cramer V
observed5regst = c( inaction5regst, action5regst)
expected5regst = c( 1/2, 1/2)
fivecramerregst <- cramerVFit(x = observed5regst, p = expected5regst, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
fivecramerregst
## Cramer.V lower.ci upper.ci
## 1 0.04029 0.003663 0.1209
#Transform the counts into percentages
inaction5_regst_perc <- inaction5regst/n5regst * 100
action5_regst_perc <- action5regst/n5regst * 100
observed5regst_per <- c(action5_regst_perc, inaction5_regst_perc)
#Study 5 Lifetime Regret
tablestudy5reglt <- table(datagmr$gr8actinactreg)
tablestudy5reglt
##
## 1 2
## 262 284
chisqstudy5reglt <- chisq.test(tablestudy5reglt, p = c(1/2, 1/2))
chisqstudy5reglt
##
## Chi-squared test for given probabilities
##
## data: tablestudy5reglt
## X-squared = 0.88645, df = 1, p-value = 0.3464
#Count action and inaction frequencies and no. of participants
inaction5reglt <- sum((datagmr$gr8actinactreg[!is.na(datagmr$gr8actinactreg)])==1)
action5reglt <- sum((datagmr$gr8actinactreg[!is.na(datagmr$gr8actinactreg)])==2)
n5reglt <- length(datagmr$gr8actinactreg[!is.na(datagmr$gr8actinactreg)])
#Calculate z score
z.score(action5reglt, n5reglt, p = 0.5, correct = TRUE)
## [1] 0.898717
#Calculate proportions and CIs of action and inaction
propaction5reglt <- prop.test(x = action5reglt, n = n5reglt, p = 0.5,
correct = FALSE)
propaction5reglt
##
## 1-sample proportions test without continuity correction
##
## data: action5reglt out of n5reglt, null probability 0.5
## X-squared = 0.88645, df = 1, p-value = 0.3464
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.4782469 0.5617647
## sample estimates:
## p
## 0.5201465
propinaction5reglt <- prop.test(x = inaction5reglt, n = n5reglt, p = 0.5,
correct = FALSE)
propinaction5reglt
##
## 1-sample proportions test without continuity correction
##
## data: inaction5reglt out of n5reglt, null probability 0.5
## X-squared = 0.88645, df = 1, p-value = 0.3464
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.4382353 0.5217531
## sample estimates:
## p
## 0.4798535
#Calculate cramer V
observed5reglt = c( inaction5reglt, action5reglt)
expected5reglt = c( 1/2, 1/2)
fivecramerreglt <- cramerVFit(x = observed5reglt, p = expected5reglt, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
fivecramerreglt
## Cramer.V lower.ci upper.ci
## 1 0.04029 9.306e-05 0.1172
#Transform the counts into percentages
inaction5_reglt_perc <- inaction5reglt/n5reglt * 100
action5_reglt_perc <- action5reglt/n5reglt * 100
observed5reglt_per <- c(action5_reglt_perc, inaction5_reglt_perc)
#Regret short-term plot
DF5RegretST <- data.frame(ActionInactionRegretST5 = c(rep("Action", action5regst), rep("Inaction", inaction5regst)))
DF5RegretSTerror <- data.frame(ActionInactionRegretST5 = c("Action", "Inaction"),
Lower = c(47.82469, 43.82353),
Upper = c(56.17647, 52.17531))
DF5RegretSTerror
## ActionInactionRegretST5 Lower Upper
## 1 Action 47.82469 56.17647
## 2 Inaction 43.82353 52.17531
Study5_RegretST_Plot <- ggplot(DF5RegretST, aes(x = ActionInactionRegretST5, fill = ActionInactionRegretST5)) + labs(y = "Percentage Experiencing Stronger Regret", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF5RegretSTerror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 5: Short-Term Regret") + theme(plot.title = element_text(hjust = 0.5)) + theme(axis.title.y = element_text(size = 7)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.04, 95% CI [0.00, 0.12]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.77, y = 5, label = "52.01%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.77, y = 5, label = "47.99%", hjust = 0, vjust = 1, fill = "cornsilk")
#Regret long-term plot
DF5RegretLT <- data.frame(ActionInactionRegretLT5 = c(rep("Action", action5reglt), rep("Inaction", inaction5reglt)))
DF5RegretLTerror <- data.frame(ActionInactionRegretLT5 = c("Action", "Inaction"),
Lower = c(47.82469, 43.82353),
Upper = c(56.17647, 52.17531))
DF5RegretLTerror
## ActionInactionRegretLT5 Lower Upper
## 1 Action 47.82469 56.17647
## 2 Inaction 43.82353 52.17531
Study5_RegretLT_Plot <- ggplot(DF5RegretLT, aes(x = ActionInactionRegretLT5, fill = ActionInactionRegretLT5)) + labs(y = "Percentage Experiencing Stronger Regret", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF5RegretLTerror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 5: Long-Term Regret") + theme(plot.title = element_text(hjust = 0.5)) + theme(axis.title.y = element_text(size = 7)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.04, 95% CI [0.00, 0.13]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.77, y = 5, label = "52.01%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.77, y = 5, label = "47.99%", hjust = 0, vjust = 1, fill = "cornsilk")
#Study 5 Change from Action to Inaction vs Inaction to Action Regret
tablereg <- table(datagmr$pastweekactinactreg, datagmr$gr8actinactreg)
tablereg
##
## 1 2
## 1 127 135
## 2 135 149
observed5chan = c(135, 135)
#Calculate chi square
chisqstudy5regchan <- chisq.test(observed5chan, p = c(1/2, 1/2))
chisqstudy5regchan
##
## Chi-squared test for given probabilities
##
## data: observed5chan
## X-squared = 0, df = 1, p-value = 1
#Calculate Cramer V
expected5chan = c( 1/2, 1/2)
fivechancramer <- cramerVFit(x = observed5chan, p = expected5chan, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
fivechancramer
## Cramer.V lower.ci upper.ci
## 1 0 0 0.1407
#Calculate z score
z.score(135, 270, p = 0.5, correct = TRUE)
## [1] 0
#Calculate proportions and CIs of action to inaction change and inaction to action change
propacttoinactreg <- prop.test(x = 135, n = 270, p = 0.5,
correct = FALSE)
propacttoinactreg
##
## 1-sample proportions test without continuity correction
##
## data: 135 out of 270, null probability 0.5
## X-squared = 0, df = 1, p-value = 1
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.44078 0.55922
## sample estimates:
## p
## 0.5
propinacttoactreg <- prop.test(x = 135, n = 270, p = 0.5,
correct = FALSE)
propinacttoactreg
##
## 1-sample proportions test without continuity correction
##
## data: 135 out of 270, null probability 0.5
## X-squared = 0, df = 1, p-value = 1
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.44078 0.55922
## sample estimates:
## p
## 0.5
#Transform the counts into percentages
acttoinactreg_perc <- 135/270 * 100
inacttoactreg_perc <- 135/270 * 100
observed5regchan <- c(acttoinactreg_perc, inacttoactreg_perc)
#Study 5 McNemar tests for Regret
#Chi square
mcnemar.test(tablereg,
correct = TRUE)
##
## McNemar's Chi-squared test
##
## data: tablereg
## McNemar's chi-squared = 0, df = 1, p-value = 1
library(exact2x2)
#Odds ratio with CIs
mcnemar.exact(tablereg, conf.level = 0.95)
##
## Exact McNemar test (with central confidence intervals)
##
## data: tablereg
## b = 135, c = 135, p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.781879 1.278970
## sample estimates:
## odds ratio
## 1
#Study 5 Short Term Responsibility
#Set up the table
tablestudy5respst <- table(datagmr$pastweekactinactres)
tablestudy5respst
##
## 1 2
## 207 264
#Run Chi-Square test
chisqstudy5respst <- chisq.test(tablestudy5respst, p = c(1/2, 1/2))
chisqstudy5respst
##
## Chi-squared test for given probabilities
##
## data: tablestudy5respst
## X-squared = 6.8981, df = 1, p-value = 0.008629
#Count action and inaction frequencies and no. of participants
inaction5respst <- sum((datagmr$pastweekactinactres[!is.na(datagmr$pastweekactinactres)])==1)
action5respst <- sum((datagmr$pastweekactinactres[!is.na(datagmr$pastweekactinactres)])==2)
n5respst <- length(datagmr$pastweekactinactres[!is.na(datagmr$pastweekactinactres)])
#Calculate z score
z.score(action5respst, n5respst, p = 0.5, correct = TRUE)
## [1] 2.580344
#Calculate proportions and CIs of action and inaction
propaction5respst <- prop.test(x = action5respst, n = n5respst, p = 0.5,
correct = FALSE)
propaction5respst
##
## 1-sample proportions test without continuity correction
##
## data: action5respst out of n5respst, null probability 0.5
## X-squared = 6.8981, df = 1, p-value = 0.008629
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.5153757 0.6046643
## sample estimates:
## p
## 0.5605096
propinaction5respst <- prop.test(x = inaction5respst, n = n5respst, p = 0.5,
correct = FALSE)
propinaction5respst
##
## 1-sample proportions test without continuity correction
##
## data: inaction5respst out of n5respst, null probability 0.5
## X-squared = 6.8981, df = 1, p-value = 0.008629
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.3953357 0.4846243
## sample estimates:
## p
## 0.4394904
#Calculate Cramer V
observed5respst = c( inaction5respst, action5respst)
expected5respst = c( 1/2, 1/2)
fivecramerrespst <- cramerVFit(x = observed5respst, p = expected5respst, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
fivecramerrespst
## Cramer.V lower.ci upper.ci
## 1 0.121 0.0276 0.2059
#Transform the counts into percentages
inaction5_respst_perc <- inaction5respst/n5respst * 100
action5_respst_perc <- action5respst/n5respst * 100
observed5respst_per <- c(inaction5_respst_perc, action5_respst_perc)
#Study 5 Long Term Responsibility
#Set up the table
tablestudy5resplt <- table(datagmr$lifetimeactinactres)
tablestudy5resplt
##
## 1 2
## 204 267
chisqstudy5resplt <- chisq.test(tablestudy5resplt, p = c(1/2, 1/2))
chisqstudy5resplt
##
## Chi-squared test for given probabilities
##
## data: tablestudy5resplt
## X-squared = 8.4268, df = 1, p-value = 0.003697
#Count action and inaction frequencies and no. of participants
inaction5resplt <- sum((datagmr$lifetimeactinactres[!is.na(datagmr$lifetimeactinactres)])==1)
action5resplt <- sum((datagmr$lifetimeactinactres[!is.na(datagmr$lifetimeactinactres)])==2)
n5resplt <- length(datagmr$lifetimeactinactres[!is.na(datagmr$lifetimeactinactres)])
#Calculate z score
z.score(action5resplt, n5resplt, p = 0.5, correct = TRUE)
## [1] 2.856809
#Calculate proportions and CIs of action and inaction
propaction5resplt <- prop.test(x = action5resplt, n = n5resplt, p = 0.5,
correct = FALSE)
propaction5resplt
##
## 1-sample proportions test without continuity correction
##
## data: action5resplt out of n5resplt, null probability 0.5
## X-squared = 8.4268, df = 1, p-value = 0.003697
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.5217666 0.6109093
## sample estimates:
## p
## 0.566879
propinaction5resplt <- prop.test(x = inaction5resplt, n = n5resplt, p = 0.5,
correct = FALSE)
propinaction5resplt
##
## 1-sample proportions test without continuity correction
##
## data: inaction5resplt out of n5resplt, null probability 0.5
## X-squared = 8.4268, df = 1, p-value = 0.003697
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.3890907 0.4782334
## sample estimates:
## p
## 0.433121
#Calculate cramer V
observed5resplt = c( inaction5resplt, action5resplt)
expected5resplt = c( 1/2, 1/2)
fivecramerresplt <- cramerVFit(x = observed5resplt, p = expected5resplt, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
fivecramerresplt
## Cramer.V lower.ci upper.ci
## 1 0.1338 0.04459 0.2229
#Transform the counts into percentages
inaction5_resplt_perc <- inaction5resplt/n5resplt * 100
inaction5_resplt_perc
## [1] 43.3121
action5_resplt_perc <- action5resplt/n5resplt * 100
action5_resplt_perc
## [1] 56.6879
observed5resplt_per <- c(inaction5_resplt_perc, action5_resplt_perc)
#Code adapted from https://community.rstudio.com/t/inserting-error-bars-on-a-percentage-graph/54337, for bar plots
#Responsibility short-term plot
DF5ResponsibilityST <- data.frame(ActionInactionResponsibilityST5 = c(rep("Action", action5respst), rep("Inaction", inaction5respst)))
DF5ResponsibilitySTerror <- data.frame(ActionInactionResponsibilityST5 = c("Action", "Inaction"),
Lower = c(51.53757, 39.53357),
Upper = c(60.46643, 48.46243))
DF5ResponsibilitySTerror
## ActionInactionResponsibilityST5 Lower Upper
## 1 Action 51.53757 60.46643
## 2 Inaction 39.53357 48.46243
Study5_ResponsibilityST_Plot <- ggplot(DF5ResponsibilityST, aes(x = ActionInactionResponsibilityST5, fill = ActionInactionResponsibilityST5)) + labs(y = "Percentage Experiencing Stronger Responsibility", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF5ResponsibilitySTerror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 5: Short-Term Responsibility") + theme(plot.title = element_text(hjust = 0.5)) + theme(axis.title.y = element_text(size = 7)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.12, 95% CI [0.04, 0.21]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.77, y = 10, label = "56.05%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.77, y = 10, label = "43.95%", hjust = 0, vjust = 1, fill = "cornsilk")
#Responsibility long-term plot
DF5ResponsibilityLT <- data.frame(ActionInactionResponsibilityLT5 = c(rep("Action", action5resplt), rep("Inaction", inaction5resplt)))
DF5ResponsibilityLTerror <- data.frame(ActionInactionResponsibilityLT5 = c("Action", "Inaction"),
Lower = c(51.91115, 38.99638),
Upper = c(61.00362, 48.08885))
DF5ResponsibilityLTerror
## ActionInactionResponsibilityLT5 Lower Upper
## 1 Action 51.91115 61.00362
## 2 Inaction 38.99638 48.08885
Study5_ResponsibilityLT_Plot <- ggplot(DF5ResponsibilityLT, aes(x = ActionInactionResponsibilityLT5, fill = ActionInactionResponsibilityLT5)) + labs(y = "Percentage Experiencing Stronger Responsibility", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF5ResponsibilityLTerror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 5: Long-Term Responsibility") + theme(plot.title = element_text(hjust = 0.5)) + theme(axis.title.y = element_text(size = 7)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.13, 95% CI [0.03, 0.23]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.77, y = 10, label = "56.51%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.77, y = 10, label = "43.49%", hjust = 0, vjust = 1, fill = "cornsilk")
#Combine above plots of Study 5
Study5_RegretST_Plot + Study5_RegretLT_Plot + Study5_ResponsibilityST_Plot + Study5_ResponsibilityLT_Plot
#Study 5 Change from Action to Inaction vs Inaction to Action Responsibility
tableresp <- table(datagmr$pastweekactinactres, datagmr$lifetimeactinactres)
tableresp
##
## 1 2
## 1 102 105
## 2 102 162
observed5chan_resp = c(102, 105)
#Calculate chi square
chisqstudy5chan_resp <- chisq.test(observed5chan_resp, p = c(1/2, 1/2))
chisqstudy5chan_resp
##
## Chi-squared test for given probabilities
##
## data: observed5chan_resp
## X-squared = 0.043478, df = 1, p-value = 0.8348
#Calculate Cramer V
expected5chan_resp = c( 1/2, 1/2)
fivechancramer_resp <- cramerVFit(x = observed5chan_resp, p = expected5chan_resp, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
fivechancramer_resp
## Cramer.V lower.ci upper.ci
## 1 0.01449 0.004831 0.1592
#Calculate z score
z.score(102, 207, p = 0.5, correct = TRUE)
## [1] -0.1390096
#Calculate proportions and CIs of action to inaction change and inaction to action change
propacttoinactresp <- prop.test(x = 102, n = 207, p = 0.5,
correct = FALSE)
propacttoinactresp
##
## 1-sample proportions test without continuity correction
##
## data: 102 out of 207, null probability 0.5
## X-squared = 0.043478, df = 1, p-value = 0.8348
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.4254025 0.5603688
## sample estimates:
## p
## 0.4927536
propinacttoactresp <- prop.test(x = 105, n = 207, p = 0.5,
correct = FALSE)
propinacttoactresp
##
## 1-sample proportions test without continuity correction
##
## data: 105 out of 207, null probability 0.5
## X-squared = 0.043478, df = 1, p-value = 0.8348
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.4396312 0.5745975
## sample estimates:
## p
## 0.5072464
#Transform the counts into percentages
acttoinactresp_perc <- 102/207 * 100
inacttoactresp_perc <- 105/207 * 100
observed5respchan <- c(acttoinactresp_perc, inacttoactresp_perc)
#Study 5 McNemar tests for Responsibility
#Chi square
mcnemar.test(tableresp,
correct = TRUE)
##
## McNemar's Chi-squared test with continuity correction
##
## data: tableresp
## McNemar's chi-squared = 0.019324, df = 1, p-value = 0.8894
library(exact2x2)
#Odds ratio with CIs
mcnemar.exact(tableresp, conf.level = 0.95)
##
## Exact McNemar test (with central confidence intervals)
##
## data: tableresp
## b = 105, c = 102, p-value = 0.8895
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.7763553 1.3653674
## sample estimates:
## odds ratio
## 1.029412
Summary:
We failed to find support for action-effect in the short-run and inaction-effect in the long run for regret.
We found support for stronger responsibility for action in the short-run and in the long-run.
#Study 3 Short Term Regret
#Read the datafile
datagmr <- read_sav("C:/Users/u3517/Dropbox/Gilovich and Medvec (1994) Replication/Datasets/Gilovich+and+Medvec+(1994)+replication+and+extension+V3-G_May+4,+2021_10.10.sav")
#Set up the table for frequencies of action Jim and inaction Dave
tablestudy3regst <- table(datagmr$regretdavejimshort)
tablestudy3regst
##
## 1 2
## 195 313
#Run chi-square test
chisqstudy3regst <- chisq.test(tablestudy3regst, p = c(1/2, 1/2))
chisqstudy3regst
##
## Chi-squared test for given probabilities
##
## data: tablestudy3regst
## X-squared = 27.409, df = 1, p-value = 1.646e-07
#Count action and inaction frequencies and no. of participants
inaction3regst <- sum((datagmr$regretdavejimshort[!is.na(datagmr$regretdavejimshort)])==1)
action3regst <- sum((datagmr$regretdavejimshort[!is.na(datagmr$regretdavejimshort)])==2)
n3regst <- length(datagmr$regretdavejimshort[!is.na(datagmr$regretdavejimshort)])
#Calculate z score
z.score(action3regst, n3regst, p = 0.5, correct = TRUE)
## [1] 5.191036
#Calculate proportions and CIs of action and inaction
propaction3regst <- prop.test(x = action3regst, n = n3regst, p = 0.5,
correct = FALSE)
propaction3regst
##
## 1-sample proportions test without continuity correction
##
## data: action3regst out of n3regst, null probability 0.5
## X-squared = 27.409, df = 1, p-value = 1.646e-07
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.5731296 0.6574105
## sample estimates:
## p
## 0.6161417
propinaction3regst <- prop.test(x = inaction3regst, n = n3regst, p = 0.5,
correct = FALSE)
propinaction3regst
##
## 1-sample proportions test without continuity correction
##
## data: inaction3regst out of n3regst, null probability 0.5
## X-squared = 27.409, df = 1, p-value = 1.646e-07
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.3425895 0.4268704
## sample estimates:
## p
## 0.3838583
#Calculate cramer V
observed3regst = c( inaction3regst, action3regst)
expected3regst = c( 1/2, 1/2)
threecramerregst <- cramerVFit(x = observed3regst, p = expected3regst, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
threecramerregst
## Cramer.V lower.ci upper.ci
## 1 0.2323 0.1457 0.311
#Transform the counts into percentages
inaction3_regst_perc <- inaction3regst/n3regst * 100
action3_regst_perc <- action3regst/n3regst * 100
observed3regst_per <- c(action3_regst_perc, inaction3_regst_perc)
#Study 3 Long Term Regret
#Set up the table for frequencies of action Jim and inaction Dave
tablestudy3reglt <- table(datagmr$regdavejimlong)
tablestudy3reglt
##
## 1 2
## 295 213
#Run chi-square test
chisqstudy3reglt <- chisq.test(tablestudy3reglt, p = c(1/2, 1/2))
chisqstudy3reglt
##
## Chi-squared test for given probabilities
##
## data: tablestudy3reglt
## X-squared = 13.236, df = 1, p-value = 0.0002746
#Count action and inaction frequencies and no. of participants
inaction3reglt <- sum((datagmr$regdavejimlong[!is.na(datagmr$regdavejimlong)])==1)
action3reglt <- sum((datagmr$regdavejimlong[!is.na(datagmr$regdavejimlong)])==2)
n3reglt <- length(datagmr$regdavejimlong[!is.na(datagmr$regdavejimlong)])
#Calculate z score
z.score(action3reglt, n3reglt, p = 0.5, correct = TRUE)
## [1] -3.593794
#Calculate proportions and CIs of action and inaction
propaction3reglt <- prop.test(x = action3reglt, n = n3reglt, p = 0.5,
correct = FALSE)
propaction3reglt
##
## 1-sample proportions test without continuity correction
##
## data: action3reglt out of n3reglt, null probability 0.5
## X-squared = 13.236, df = 1, p-value = 0.0002746
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.3771446 0.4626495
## sample estimates:
## p
## 0.4192913
propinaction3reglt <- prop.test(x = inaction3reglt, n = n3reglt, p = 0.5,
correct = FALSE)
propinaction3reglt
##
## 1-sample proportions test without continuity correction
##
## data: inaction3reglt out of n3reglt, null probability 0.5
## X-squared = 13.236, df = 1, p-value = 0.0002746
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.5373505 0.6228554
## sample estimates:
## p
## 0.5807087
#Calculate cramer V
observed3reglt = c( inaction3reglt, action3reglt)
expected3reglt = c( 1/2, 1/2)
threecramerreglt <- cramerVFit(x = observed3reglt, p = expected3reglt, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
threecramerreglt
## Cramer.V lower.ci upper.ci
## 1 0.1614 0.0748 0.248
#Transform the counts into percentages
inaction3_reglt_perc <- inaction3reglt/n3reglt * 100
action3_reglt_perc <- action3reglt/n3reglt * 100
observed3reglt_per <- c(action3_reglt_perc, inaction3_reglt_perc)
#Code adapted from https://community.rstudio.com/t/inserting-error-bars-on-a-percentage-graph/54337, for bar plots
#Regret short-term plot
DF3RegretST <- data.frame(ActionInactionRegretST3 = c(rep("Action", action3regst), rep("Inaction", inaction3regst)))
DF3RegretSTerror <- data.frame(ActionInactionRegretST3 = c("Action", "Inaction"),
Lower = c(57.31296, 34.25895),
Upper = c(65.74105, 42.68704))
DF3RegretSTerror
## ActionInactionRegretST3 Lower Upper
## 1 Action 57.31296 65.74105
## 2 Inaction 34.25895 42.68704
Study3_RegretST_Plot <- ggplot(DF3RegretST, aes(x = ActionInactionRegretST3, fill = ActionInactionRegretST3)) + labs(y = "Percentage Perceiving Stronger Regret", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF3RegretSTerror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 3: Short-Term Regret") + theme(plot.title = element_text(hjust = 0.5)) + theme(axis.title.y = element_text(size = 7)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.23, 95% CI [0.15, 0.31]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.77, y = 10, label = "61.61%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.77, y = 10, label = "38.39%", hjust = 0, vjust = 1, fill = "cornsilk")
#Regret long-term plot
DF3RegretLT <- data.frame(ActionInactionRegretLT3 = c(rep("Action", action3reglt), rep("Inaction", inaction3reglt)))
DF3RegretLTerror <- data.frame(ActionInactionRegretLT3 = c("Action", "Inaction"),
Lower = c(37.71446, 53.73505),
Upper = c(46.26495, 62.28554))
DF3RegretLTerror
## ActionInactionRegretLT3 Lower Upper
## 1 Action 37.71446 46.26495
## 2 Inaction 53.73505 62.28554
Study3_RegretLT_Plot <- ggplot(DF3RegretLT, aes(x = ActionInactionRegretLT3, fill = ActionInactionRegretLT3)) + labs(y = "Percentage Perceiving Stronger Regret", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF3RegretLTerror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 3: Long-Term Regret") + theme(plot.title = element_text(hjust = 0.5)) + theme(axis.title.y = element_text(size = 7)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.16, 95% CI [0.07, 0.24]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.77, y = 10, label = "41.93%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.77, y = 10, label = "58.07%", hjust = 0, vjust = 1, fill = "cornsilk")
#Study 3 Change from Action to Inaction vs Inaction to Action Regret
tablestudy3reg <- table(datagmr$regretdavejimshort, datagmr$regdavejimlong)
tablestudy3reg
##
## 1 2
## 1 174 21
## 2 121 192
observed3chan = c(121, 21)
#Calculate chi square
chisqstudy3chan <- chisq.test(observed3chan, p = c(1/2, 1/2))
chisqstudy3chan
##
## Chi-squared test for given probabilities
##
## data: observed3chan
## X-squared = 70.423, df = 1, p-value < 2.2e-16
#Calculate Cramer V
expected3chan = c( 1/2, 1/2)
threechancramer <- cramerVFit(x = observed3chan, p = expected3chan, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
threechancramer
## Cramer.V lower.ci upper.ci
## 1 0.7042 0.5915 0.8169
#Calculate z score
z.score(121, 142, p = 0.5, correct = TRUE)
## [1] 8.307895
#Calculate proportions and CIs of action to inaction change and inaction to action change
prop3regacttoinact <- prop.test(x = 121, n = 142, p = 0.5,
correct = FALSE)
prop3regacttoinact
##
## 1-sample proportions test without continuity correction
##
## data: 121 out of 142, null probability 0.5
## X-squared = 70.423, df = 1, p-value < 2.2e-16
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.7844831 0.9011929
## sample estimates:
## p
## 0.8521127
prop3reginacttoact <- prop.test(x = 21, n = 142, p = 0.5,
correct = FALSE)
prop3reginacttoact
##
## 1-sample proportions test without continuity correction
##
## data: 21 out of 142, null probability 0.5
## X-squared = 70.423, df = 1, p-value < 2.2e-16
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.09880707 0.21551685
## sample estimates:
## p
## 0.1478873
#Transform the counts into percentages
acttoinactreg3_perc <- 121/142 * 100
inacttoactreg3_perc <- 21/142 * 100
observed3regchan <- c(acttoinactreg3_perc, inacttoactreg3_perc)
#Study 3 McNemar tests for Regret
#Chi square
mcnemar.test(tablestudy3reg,
correct = TRUE)
##
## McNemar's Chi-squared test with continuity correction
##
## data: tablestudy3reg
## McNemar's chi-squared = 69.021, df = 1, p-value < 2.2e-16
library(exact2x2)
#Odds ratio with CIs
mcnemar.exact(tablestudy3reg, conf.level = 0.95)
##
## Exact McNemar test (with central confidence intervals)
##
## data: tablestudy3reg
## b = 21, c = 121, p-value < 2.2e-16
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.1036746 0.2773605
## sample estimates:
## odds ratio
## 0.1735537
#Study 3 Short Term Responsibility
#Set up the table for frequencies of action Jim and inaction Dave
tablestudy3respst <- table(datagmr$respdavejimshort)
tablestudy3respst
##
## 1 2
## 132 376
#Run chi-square test
chisqstudy3respst <- chisq.test(tablestudy3respst, p = c(1/2, 1/2))
chisqstudy3respst
##
## Chi-squared test for given probabilities
##
## data: tablestudy3respst
## X-squared = 117.2, df = 1, p-value < 2.2e-16
#Count action and inaction frequencies and no. of participants
inaction3respst <- sum((datagmr$respdavejimshort[!is.na(datagmr$respdavejimshort)])==1)
action3respst <- sum((datagmr$respdavejimshort[!is.na(datagmr$respdavejimshort)])==2)
n3respst <- length(datagmr$respdavejimshort[!is.na(datagmr$respdavejimshort)])
#Calculate z score
z.score(action3respst, n3respst, p = 0.5, correct = TRUE)
## [1] 10.78138
#Calculate proportions and CIs of action and inaction
propaction3respst <- prop.test(x = action3respst, n = n3respst, p = 0.5,
correct = FALSE)
propaction3respst
##
## 1-sample proportions test without continuity correction
##
## data: action3respst out of n3respst, null probability 0.5
## X-squared = 117.2, df = 1, p-value < 2.2e-16
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.7003199 0.7763903
## sample estimates:
## p
## 0.7401575
propinaction3respst <- prop.test(x = inaction3respst, n = n3respst, p = 0.5,
correct = FALSE)
propinaction3respst
##
## 1-sample proportions test without continuity correction
##
## data: inaction3respst out of n3respst, null probability 0.5
## X-squared = 117.2, df = 1, p-value < 2.2e-16
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.2236097 0.2996801
## sample estimates:
## p
## 0.2598425
#Calculate cramer V
observed3respst = c( inaction3respst, action3respst)
expected3respst = c( 1/2, 1/2)
threecramerrespst <- cramerVFit(x = observed3respst, p = expected3respst, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
threecramerrespst
## Cramer.V lower.ci upper.ci
## 1 0.4803 0.4016 0.559
#Transform the counts into percentages
inaction3_respst_perc <- inaction3respst/n3respst * 100
action3_respst_perc <- action3respst/n3respst * 100
observed3respst_per <- c(action3_respst_perc, inaction3_respst_perc)
#Study 3 Long Term Responsibility
#Set up the table for frequencies of action Jim and inaction Dave
tablestudy3resplt <- table(datagmr$respdavejimlong)
tablestudy3resplt
##
## 1 2
## 200 308
#Run chi-square test
chisqstudy3resplt <- chisq.test(tablestudy3resplt, p = c(1/2, 1/2))
chisqstudy3resplt
##
## Chi-squared test for given probabilities
##
## data: tablestudy3resplt
## X-squared = 22.961, df = 1, p-value = 1.654e-06
#Count action and inaction frequencies and no. of participants
inaction3resplt <- sum((datagmr$respdavejimlong[!is.na(datagmr$respdavejimlong)])==1)
action3resplt <- sum((datagmr$respdavejimlong[!is.na(datagmr$respdavejimlong)])==2)
n3resplt <- length(datagmr$respdavejimlong[!is.na(datagmr$respdavejimlong)])
#Calculate z score
z.score(action3resplt, n3resplt, p = 0.5, correct = TRUE)
## [1] 4.747357
#Calculate proportions and CIs of action and inaction
propaction3resplt <- prop.test(x = action3resplt, n = n3resplt, p = 0.5,
correct = FALSE)
propaction3resplt
##
## 1-sample proportions test without continuity correction
##
## data: action3resplt out of n3resplt, null probability 0.5
## X-squared = 22.961, df = 1, p-value = 1.654e-06
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.5631679 0.6478349
## sample estimates:
## p
## 0.6062992
propinaction3resplt <- prop.test(x = inaction3resplt, n = n3resplt, p = 0.5,
correct = FALSE)
propinaction3resplt
##
## 1-sample proportions test without continuity correction
##
## data: inaction3resplt out of n3resplt, null probability 0.5
## X-squared = 22.961, df = 1, p-value = 1.654e-06
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.3521651 0.4368321
## sample estimates:
## p
## 0.3937008
#Calculate cramer V
observed3resplt = c( inaction3resplt, action3resplt)
expected3resplt = c( 1/2, 1/2)
threecramerresplt <- cramerVFit(x = observed3resplt, p = expected3resplt, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
threecramerresplt
## Cramer.V lower.ci upper.ci
## 1 0.2126 0.1299 0.303
#Transform the counts into percentages
inaction3_resplt_perc <- inaction3resplt/n3resplt * 100
action3_resplt_perc <- action3resplt/n3resplt * 100
observed3resplt_per <- c(action3_resplt_perc, inaction3_resplt_perc)
#Code adapted from https://community.rstudio.com/t/inserting-error-bars-on-a-percentage-graph/54337, for bar plots
#Responsibility short-term plot
DF3ResponsibilityST <- data.frame(ActionInactionResponsibilityST3 = c(rep("Action", action3respst), rep("Inaction", inaction3respst)))
DF3ResponsibilitySTerror <- data.frame(ActionInactionResponsibilityST3 = c("Action", "Inaction"),
Lower = c(70.03199, 22.36097),
Upper = c(77.63903, 29.96801))
DF3ResponsibilitySTerror
## ActionInactionResponsibilityST3 Lower Upper
## 1 Action 70.03199 77.63903
## 2 Inaction 22.36097 29.96801
Study3_ResponsibilityST_Plot <- ggplot(DF3ResponsibilityST, aes(x = ActionInactionResponsibilityST3, fill = ActionInactionResponsibilityST3)) + labs(y = "Percentage Perceiving Stronger Responsibility", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF3ResponsibilitySTerror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 3: Short-Term Responsibility") + theme(plot.title = element_text(hjust = 0.5)) + theme(axis.title.y = element_text(size = 7)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.48, 95% CI [0.40, 0.56]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.77, y = 10, label = "74.02%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.77, y = 10, label = "25.98%", hjust = 0, vjust = 1, fill = "cornsilk")
#Responsibility long-term plot
DF3ResponsibilityLT <- data.frame(ActionInactionResponsibilityLT3 = c(rep("Action", action3resplt), rep("Inaction", inaction3resplt)))
DF3ResponsibilityLTerror <- data.frame(ActionInactionResponsibilityLT3 = c("Action", "Inaction"),
Lower = c(56.31679, 35.21651),
Upper = c(64.78349, 43.68321))
DF3ResponsibilityLTerror
## ActionInactionResponsibilityLT3 Lower Upper
## 1 Action 56.31679 64.78349
## 2 Inaction 35.21651 43.68321
Study3_ResponsibilityLT_Plot <- ggplot(DF3ResponsibilityLT, aes(x = ActionInactionResponsibilityLT3, fill = ActionInactionResponsibilityLT3)) + labs(y = "Percentage Perceiving Stronger Responsibility", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF3ResponsibilityLTerror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 3: Long-Term Responsibility") + theme(plot.title = element_text(hjust = 0.5)) + theme(axis.title.y = element_text(size = 7)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.21, 95% CI [0.13, 0.31]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.77, y = 10, label = "60.63%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.77, y = 10, label = "39.37%", hjust = 0, vjust = 1, fill = "cornsilk")
#Combine Study 3 Plots
Study3_RegretST_Plot + Study3_RegretLT_Plot + Study3_ResponsibilityST_Plot + Study3_ResponsibilityLT_Plot
#Study 3 Change from Action to Inaction vs Inaction to Action Responsibility
tablestudy3resp <- table(datagmr$respdavejimshort, datagmr$respdavejimlong)
tablestudy3resp
##
## 1 2
## 1 103 29
## 2 97 279
observed3chanresp = c(97, 29)
#Calculate chi square
chisqstudy3chanresp <- chisq.test(observed3chanresp, p = c(1/2, 1/2))
chisqstudy3chanresp
##
## Chi-squared test for given probabilities
##
## data: observed3chanresp
## X-squared = 36.698, df = 1, p-value = 1.379e-09
#Calculate Cramer V
expected3chanresp = c( 1/2, 1/2)
threechancramer <- cramerVFit(x = observed3chanresp, p = expected3chanresp, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
threechancramer
## Cramer.V lower.ci upper.ci
## 1 0.5397 0.3968 0.6825
#Calculate z score
z.score(97, 126, p = 0.5, correct = TRUE)
## [1] 5.968834
#Calculate proportions and CIs of action to inaction change and inaction to action change
prop3respacttoinact <- prop.test(x = 97, n = 126, p = 0.5,
correct = FALSE)
prop3respacttoinact
##
## 1-sample proportions test without continuity correction
##
## data: 97 out of 126, null probability 0.5
## X-squared = 36.698, df = 1, p-value = 1.379e-09
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.6890161 0.8346995
## sample estimates:
## p
## 0.7698413
prop3respinacttoact <- prop.test(x = 29, n = 126, p = 0.5,
correct = FALSE)
prop3respinacttoact
##
## 1-sample proportions test without continuity correction
##
## data: 29 out of 126, null probability 0.5
## X-squared = 36.698, df = 1, p-value = 1.379e-09
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.1653005 0.3109839
## sample estimates:
## p
## 0.2301587
#Transform the counts into percentages
acttoinactresp3_perc <- 97/126 * 100
inacttoactresp3_perc <- 29/126 * 100
observed3respchan <- c(acttoinactresp3_perc, inacttoactresp3_perc)
#Study 3 McNemar tests for Responsibility
#Chi square
mcnemar.test(tablestudy3resp,
correct = TRUE)
##
## McNemar's Chi-squared test with continuity correction
##
## data: tablestudy3resp
## McNemar's chi-squared = 35.627, df = 1, p-value = 2.39e-09
library(exact2x2)
#Odds ratio with CIs
mcnemar.exact(tablestudy3resp, conf.level = 0.95)
##
## Exact McNemar test (with central confidence intervals)
##
## data: tablestudy3resp
## b = 29, c = 97, p-value = 9.245e-10
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.1903086 0.4567414
## sample estimates:
## odds ratio
## 0.2989691
Summary:
We found support for action-effect in the short-run, and we found support for inaction-effect in the long-run.
We found support for the temporal effect of action-inaction effect.
# Study 4 Short Term Regret
#Read the datafile
datagmr <- read_sav("C:/Users/u3517/Dropbox/Gilovich and Medvec (1994) Replication/Datasets/Gilovich+and+Medvec+(1994)+replication+and+extension+V3-G_May+4,+2021_10.10.sav")
#Set up the table for frequencies of action Jim and inaction Dave
tablestudy4regst <- table(datagmr$regretdavejimshort4)
tablestudy4regst
##
## 1 2
## 95 159
#Run chi-square test
chisqstudy4regst <- chisq.test(tablestudy4regst, p = c(1/2, 1/2))
chisqstudy4regst
##
## Chi-squared test for given probabilities
##
## data: tablestudy4regst
## X-squared = 16.126, df = 1, p-value = 5.927e-05
#Count action and inaction frequencies and no. of participants
inaction4regst <- sum((datagmr$regretdavejimshort4[!is.na(datagmr$regretdavejimshort4)])==1)
action4regst <- sum((datagmr$regretdavejimshort4[!is.na(datagmr$regretdavejimshort4)])==2)
n4regst <- length(datagmr$regretdavejimshort4[!is.na(datagmr$regretdavejimshort4)])
#Calculate z score
z.score(action4regst, n4regst, p = 0.5, correct = TRUE)
## [1] 3.952972
#Calculate proportions and CIs of action and inaction
propaction4regst <- prop.test(x = action4regst, n = n4regst, p = 0.5,
correct = FALSE)
propaction4regst
##
## 1-sample proportions test without continuity correction
##
## data: action4regst out of n4regst, null probability 0.5
## X-squared = 16.126, df = 1, p-value = 5.927e-05
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.5650168 0.6831978
## sample estimates:
## p
## 0.6259843
propinaction4regst <- prop.test(x = inaction4regst, n = n4regst, p = 0.5,
correct = FALSE)
propinaction4regst
##
## 1-sample proportions test without continuity correction
##
## data: inaction4regst out of n4regst, null probability 0.5
## X-squared = 16.126, df = 1, p-value = 5.927e-05
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.3168022 0.4349832
## sample estimates:
## p
## 0.3740157
#Calculate cramer V
observed4regst = c( inaction4regst, action4regst)
expected4regst = c( 1/2, 1/2)
fourcramerregst <- cramerVFit(x = observed4regst, p = expected4regst, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
fourcramerregst
## Cramer.V lower.ci upper.ci
## 1 0.252 0.126 0.3701
#Transform the counts into percentages
inaction4_regst_perc <- inaction4regst/n4regst * 100
action4_regst_perc <- action4regst/n4regst * 100
observed4regst_per <- c(action4_regst_perc, inaction4_regst_perc)
# Study 4 Long Term Regret
#Set up the table for frequencies of action Jim and inaction Dave
tablestudy4reglt <- table(datagmr$regdavejimlong4)
tablestudy4reglt
##
## 1 2
## 142 113
#Run chi-square test
chisqstudy4reglt <- chisq.test(tablestudy4reglt, p = c(1/2, 1/2))
chisqstudy4reglt
##
## Chi-squared test for given probabilities
##
## data: tablestudy4reglt
## X-squared = 3.298, df = 1, p-value = 0.06936
#Count action and inaction frequencies and no. of participants
inaction4reglt <- sum((datagmr$regdavejimlong4[!is.na(datagmr$regdavejimlong4)])==1)
action4reglt <- sum((datagmr$regdavejimlong4[!is.na(datagmr$regdavejimlong4)])==2)
n4reglt <- length(datagmr$regdavejimlong4[!is.na(datagmr$regdavejimlong4)])
#Calculate z score
z.score(action4reglt, n4reglt, p = 0.5, correct = TRUE)
## [1] -1.753428
#Calculate proportions and CIs of action and inaction
propaction4reglt <- prop.test(x = action4reglt, n = n4reglt, p = 0.5,
correct = FALSE)
propaction4reglt
##
## 1-sample proportions test without continuity correction
##
## data: action4reglt out of n4reglt, null probability 0.5
## X-squared = 3.298, df = 1, p-value = 0.06936
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.3834587 0.5045036
## sample estimates:
## p
## 0.4431373
propinaction4reglt <- prop.test(x = inaction4reglt, n = n4reglt, p = 0.5,
correct = FALSE)
propinaction4reglt
##
## 1-sample proportions test without continuity correction
##
## data: inaction4reglt out of n4reglt, null probability 0.5
## X-squared = 3.298, df = 1, p-value = 0.06936
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.4954964 0.6165413
## sample estimates:
## p
## 0.5568627
#Calculate cramer V
observed4reglt = c( inaction4reglt, action4reglt)
expected4reglt = c( 1/2, 1/2)
fourcramerreglt <- cramerVFit(x = observed4reglt, p = expected4reglt, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
fourcramerreglt
## Cramer.V lower.ci upper.ci
## 1 0.1137 0.01176 0.2392
#Transform the counts into percentages
inaction4_reglt_perc <- inaction4reglt/n4reglt * 100
action4_reglt_perc <- action4reglt/n4reglt * 100
observed4reglt_per <- c(action4_reglt_perc, inaction4_reglt_perc)
#Code adapted from https://community.rstudio.com/t/inserting-error-bars-on-a-percentage-graph/54337, for bar plots
#Regret short-term plot
DF4RegretST <- data.frame(ActionInactionRegretST4 = c(rep("Action", action4regst), rep("Inaction", inaction4regst)))
DF4RegretSTerror <- data.frame(ActionInactionRegretST4 = c("Action", "Inaction"),
Lower = c(56.50168, 31.68022),
Upper = c(68.31978, 43.49832))
DF4RegretSTerror
## ActionInactionRegretST4 Lower Upper
## 1 Action 56.50168 68.31978
## 2 Inaction 31.68022 43.49832
Study4_RegretST_Plot <- ggplot(DF4RegretST, aes(x = ActionInactionRegretST4, fill = ActionInactionRegretST4)) + labs(y = "Percentage Perceiving Stronger Regret", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF4RegretSTerror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 4: Short-Term Regret") + theme(plot.title = element_text(hjust = 0.5)) + theme(axis.title.y = element_text(size = 7)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.25, 95% CI [0.13, 0.38]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.77, y = 10, label = "62.60%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.77, y = 10, label = "37.40%", hjust = 0, vjust = 1, fill = "cornsilk")
#Regret long-term plot
DF4RegretLT <- data.frame(ActionInactionRegretLT4 = c(rep("Action", action4reglt), rep("Inaction", inaction4reglt)))
DF4RegretLTerror <- data.frame(ActionInactionRegretLT4 = c("Action", "Inaction"),
Lower = c(38.34587, 49.54964),
Upper = c(50.45036, 61.65413))
DF4RegretLTerror
## ActionInactionRegretLT4 Lower Upper
## 1 Action 38.34587 50.45036
## 2 Inaction 49.54964 61.65413
Study4_RegretLT_Plot <- ggplot(DF4RegretLT, aes(x = ActionInactionRegretLT4, fill = ActionInactionRegretLT4)) + labs(y = "Percentage Perceiving Stronger Regret", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF4RegretLTerror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 4: Long-Term Regret") + theme(plot.title = element_text(hjust = 0.5)) + theme(axis.title.y = element_text(size = 7)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.11, 95% CI [0.01, 0.23]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.77, y = 10, label = "44.31%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.77, y = 10, label = "55.69%", hjust = 0, vjust = 1, fill = "cornsilk")
#Study 4 Test of Independence Regret
#Combine short-term tables and long-term tables
tab4reg <- as.table(rbind(tablestudy4regst, tablestudy4reglt))
tab4reg
## 1 2
## tablestudy4regst 95 159
## tablestudy4reglt 142 113
#COnduct chi-square test
study4regtestindependence <- chisq.test(tab4reg, correct = FALSE)
study4regtestindependence
##
## Pearson's Chi-squared test
##
## data: tab4reg
## X-squared = 17.098, df = 1, p-value = 3.55e-05
#Cramer V
CramerV(tab4reg, conf.level = 0.95)
## Cramer V lwr.ci upr.ci
## 0.18328046 0.09640944 0.27015113
# Study 4 Short Term Responsibility
#Set up the table for frequencies of action Jim and inaction Dave
tablestudy4respst <- table(datagmr$respdavejimshort4)
tablestudy4respst
##
## 1 2
## 64 190
#Run chi-square test
chisqstudy4respst <- chisq.test(tablestudy4respst, p = c(1/2, 1/2))
chisqstudy4respst
##
## Chi-squared test for given probabilities
##
## data: tablestudy4respst
## X-squared = 62.504, df = 1, p-value = 2.659e-15
#Count action and inaction frequencies and no. of participants
inaction4respst <- sum((datagmr$respdavejimshort4[!is.na(datagmr$respdavejimshort4)])==1)
action4respst <- sum((datagmr$respdavejimshort4[!is.na(datagmr$respdavejimshort4)])==2)
n4respst <- length(datagmr$respdavejimshort4[!is.na(datagmr$respdavejimshort4)])
#Calculate z score
z.score(action4respst, n4respst, p = 0.5, correct = TRUE)
## [1] 7.843198
#Calculate proportions and CIs of action and inaction
propaction4respst <- prop.test(x = action4respst, n = n4respst, p = 0.5,
correct = FALSE)
propaction4respst
##
## 1-sample proportions test without continuity correction
##
## data: action4respst out of n4respst, null probability 0.5
## X-squared = 62.504, df = 1, p-value = 2.659e-15
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.6912162 0.7974562
## sample estimates:
## p
## 0.7480315
propinaction4respst <- prop.test(x = inaction4respst, n = n4respst, p = 0.5,
correct = FALSE)
propinaction4respst
##
## 1-sample proportions test without continuity correction
##
## data: inaction4respst out of n4respst, null probability 0.5
## X-squared = 62.504, df = 1, p-value = 2.659e-15
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.2025438 0.3087838
## sample estimates:
## p
## 0.2519685
#Calculate cramer V
observed4respst = c( inaction4respst, action4respst)
expected4respst = c( 1/2, 1/2)
fourcramerrespst <- cramerVFit(x = observed4respst, p = expected4respst, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
fourcramerrespst
## Cramer.V lower.ci upper.ci
## 1 0.4961 0.3858 0.5906
#Transform the counts into percentages
inaction4_respst_perc <- inaction4respst/n4respst * 100
action4_respst_perc <- action4respst/n4respst * 100
observed4respst_per <- c(action4_respst_perc, inaction4_respst_perc)
# Study 4 Long Term Responsibility
#Set up the table for frequencies of action Jim and inaction Dave
tablestudy4resplt <- table(datagmr$respdavejimlong4)
tablestudy4resplt
##
## 1 2
## 79 176
#Run chi-square test
chisqstudy4resplt <- chisq.test(tablestudy4resplt, p = c(1/2, 1/2))
chisqstudy4resplt
##
## Chi-squared test for given probabilities
##
## data: tablestudy4resplt
## X-squared = 36.898, df = 1, p-value = 1.245e-09
#Count action and inaction frequencies and no. of participants
inaction4resplt <- sum((datagmr$respdavejimlong4[!is.na(datagmr$respdavejimlong4)])==1)
action4resplt <- sum((datagmr$respdavejimlong4[!is.na(datagmr$respdavejimlong4)])==2)
n4resplt <- length(datagmr$respdavejimlong4[!is.na(datagmr$respdavejimlong4)])
#Calculate z score
z.score(action4resplt, n4resplt, p = 0.5, correct = TRUE)
## [1] 6.011753
#Calculate proportions and CIs of action and inaction
propaction4resplt <- prop.test(x = action4resplt, n = n4resplt, p = 0.5,
correct = FALSE)
propaction4resplt
##
## 1-sample proportions test without continuity correction
##
## data: action4resplt out of n4resplt, null probability 0.5
## X-squared = 36.898, df = 1, p-value = 1.245e-09
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.6309700 0.7437768
## sample estimates:
## p
## 0.6901961
propinaction4resplt <- prop.test(x = inaction4resplt, n = n4resplt, p = 0.5,
correct = FALSE)
propinaction4resplt
##
## 1-sample proportions test without continuity correction
##
## data: inaction4resplt out of n4resplt, null probability 0.5
## X-squared = 36.898, df = 1, p-value = 1.245e-09
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.2562232 0.3690300
## sample estimates:
## p
## 0.3098039
#Calculate cramer V
observed4resplt = c( inaction4resplt, action4resplt)
expected4resplt = c( 1/2, 1/2)
fourcramerresplt <- cramerVFit(x = observed4resplt, p = expected4resplt, ci = TRUE, conf = 0.95, type = "perc", R = 1000, reportIncomplete = TRUE)
fourcramerresplt
## Cramer.V lower.ci upper.ci
## 1 0.3804 0.2706 0.4824
#Transform the counts into percentages
inaction4_resplt_perc <- inaction4resplt/n4resplt * 100
action4_resplt_perc <- action4resplt/n4resplt * 100
observed4resplt_per <- c(action4_resplt_perc, inaction4_resplt_perc)
#Code adapted from https://community.rstudio.com/t/inserting-error-bars-on-a-percentage-graph/54337, for bar plots
#Responsibility short-term plot
DF4ResponsibilityST <- data.frame(ActionInactionResponsibilityST4 = c(rep("Action", action4respst), rep("Inaction", inaction4respst)))
DF4ResponsibilitySTerror <- data.frame(ActionInactionResponsibilityST4 = c("Action", "Inaction"),
Lower = c(69.12162, 20.25438),
Upper = c(79.74562, 30.87838))
DF4ResponsibilitySTerror
## ActionInactionResponsibilityST4 Lower Upper
## 1 Action 69.12162 79.74562
## 2 Inaction 20.25438 30.87838
Study4_ResponsibilityST_Plot <- ggplot(DF4ResponsibilityST, aes(x = ActionInactionResponsibilityST4, fill = ActionInactionResponsibilityST4)) + labs(y = "Percentage Perceiving Stronger Responsibility", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF4ResponsibilitySTerror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 4: Short-Term Responsibility") + theme(plot.title = element_text(hjust = 0.5)) + theme(axis.title.y = element_text(size = 7)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.50, 95% CI [0.39, 0.61]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.77, y = 10, label = "74.80%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.77, y = 10, label = "25.20%", hjust = 0, vjust = 1, fill = "cornsilk")
#Responsibility long-term plot
DF4ResponsibilityLT <- data.frame(ActionInactionResponsibilityLT4 = c(rep("Action", action4resplt), rep("Inaction", inaction4resplt)))
DF4ResponsibilityLTerror <- data.frame(ActionInactionResponsibilityLT4 = c("Action", "Inaction"),
Lower = c(63.09700, 25.62232),
Upper = c(74.37768, 36.90300))
DF4ResponsibilityLTerror
## ActionInactionResponsibilityLT4 Lower Upper
## 1 Action 63.09700 74.37768
## 2 Inaction 25.62232 36.90300
Study4_ResponsibilityLT_Plot <- ggplot(DF4ResponsibilityLT, aes(x = ActionInactionResponsibilityLT4, fill = ActionInactionResponsibilityLT4)) + labs(y = "Percentage Perceiving Stronger Responsibility", x = NULL) + geom_bar(aes(y = (..count..)/sum(..count..)*100)) + geom_errorbar(aes(ymin = Lower, ymax = Upper), data = DF4ResponsibilityLTerror, width = 0.2) + coord_cartesian(ylim = c(0, 100)) + geom_hline(yintercept = 50, linetype = 2, colour = "black") + theme(legend.position = "none") + ggtitle("Study 4: Long-Term Responsibility") + theme(plot.title = element_text(hjust = 0.5)) + theme(axis.title.y = element_text(size = 7)) + geom_richtext(x = -Inf, y = Inf, label = "*V* = 0.38, 95% CI [0.27, 0.50]", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 0.77, y = 10, label = "69.02%", hjust = 0, vjust = 1, fill = "cornsilk") + geom_richtext(x = 1.77, y = 10, label = "30.98%", hjust = 0, vjust = 1, fill = "cornsilk")
#Combine Study 4 Plots
Study4_RegretST_Plot + Study4_RegretLT_Plot + Study4_ResponsibilityST_Plot + Study4_ResponsibilityLT_Plot
#Study 4 Test of Independence Responsibility
#Combine short-term tables and long-term tables
tab4resp <- as.table(rbind(tablestudy4respst, tablestudy4resplt))
tab4resp
## 1 2
## tablestudy4respst 64 190
## tablestudy4resplt 79 176
#COnduct chi-square test
study4resptestindependence <- chisq.test(tab4resp, correct = FALSE)
study4resptestindependence
##
## Pearson's Chi-squared test
##
## data: tab4resp
## X-squared = 2.107, df = 1, p-value = 0.1466
#Cramer V
CramerV(tab4resp, conf.level = 0.95)
## Cramer V lwr.ci upr.ci
## 0.0643387 0.0000000 0.1512088
Summary:
We failed to replicate study 5 regret, stronger responsibility for action in both short-term and long-term.
#Age summary
summary(datagmr$Age)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 18.00 33.00 41.00 43.84 54.25 89.00 1
#Gender distribution
table(datagmr$Gender)
##
## 1 2 3 4
## 421 581 8 6
We thank Qinyu Xiao and Adrien Fillon for comments and suggestions on the RMarkdown.
pander(sessionInfo(), compact = FALSE)
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale: LC_COLLATE=English_Hong Kong SAR.1252, LC_CTYPE=English_Hong Kong SAR.1252, LC_MONETARY=English_Hong Kong SAR.1252, LC_NUMERIC=C and LC_TIME=English_Hong Kong SAR.1252
attached base packages:
other attached packages:
loaded via a namespace (and not attached):