Load Libraries

library(dplyr)
library(papaja)

Load Data

# Data are in tab--delimited text files created from the original Excel File on OSF at:  https://osf.io/pszjz/

s1 <- read.table("https://raw.githubusercontent.com/ndphillips/PsyKo-2017/master/data/jordan_s1.txt", sep = "\t", header = TRUE, stringsAsFactors = FALSE)
s2 <- read.table("https://raw.githubusercontent.com/ndphillips/PsyKo-2017/master/data/jordan_s2.txt", sep = "\t", header = TRUE, stringsAsFactors = FALSE)

Clean Data

s1 <- s1 %>% mutate(
  likeall = (likework + likeromantic + likeacademic + likedrugs) / 4,
  gender = ifelse(gender == 1, "male", "female"),
  goodinfo = ifelse(goodinfo == 1, "Good", "None"),
  condemn = ifelse(condemn == 1, "Target", "Other")) %>%
  filter(percCorrect == 1 & 
           is.finite(age))    # As recommended by the main study author in an email

s2 <- s2 %>% mutate(
  likeall = (likework + likeromantic + likeacademic + likedrugs) / 4,
  gender = ifelse(gender == 1, "male", "female"),
  direct = ifelse(direct == 1, "Direct", "Moral"),
  signal = ifelse(signal == 1, "Target", "Other")) %>%
  filter(percCorrect == 1)

Study 1

# Show structure of study 1 data
# Should have 619 participants
str(s1)
## 'data.frame':    619 obs. of  51 variables:
##  $ id                : int  1 3 4 5 8 9 11 13 15 16 ...
##  $ goodinfo          : chr  "Good" "Good" "None" "None" ...
##  $ condemn           : chr  "Target" "Target" "Target" "Other" ...
##  $ qAnswered         : int  16 16 16 16 16 16 16 16 16 16 ...
##  $ totalCorrect      : int  16 16 16 16 16 16 16 16 16 16 ...
##  $ percCorrect       : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ ansall            : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ dowork            : int  4 2 4 3 2 2 1 4 1 1 ...
##  $ doromantic        : int  2 1 5 5 2 2 1 4 1 1 ...
##  $ doacademic        : int  2 5 4 3 3 2 2 4 1 1 ...
##  $ dodrugs           : int  2 3 3 2 3 2 1 5 2 1 ...
##  $ trustswork        : int  5 5 4 5 6 6 7 5 6 7 ...
##  $ trustsromantic    : int  3 6 5 4 5 5 7 5 7 7 ...
##  $ trustsacademic    : int  5 5 4 5 3 5 5 6 7 7 ...
##  $ trustsdrugs       : int  5 5 4 5 5 5 7 5 6 7 ...
##  $ trustgwork        : int  4 5 4 5 5 5 7 6 6 6 ...
##  $ trustgromantic    : int  4 5 4 5 5 5 6 5 6 7 ...
##  $ trustgacademic    : int  5 3 4 5 3 5 6 5 6 6 ...
##  $ trustgdrugs       : int  5 3 4 5 5 5 5 4 6 5 ...
##  $ likework          : int  5 6 4 4 5 5 6 5 6 7 ...
##  $ likeromantic      : int  3 7 3 5 5 5 7 5 6 7 ...
##  $ likeacademic      : int  5 6 4 5 4 5 3 6 6 5 ...
##  $ likedrugs         : int  5 4 4 4 4 5 6 4 6 5 ...
##  $ compq1work        : int  2 2 1 1 2 1 2 2 1 2 ...
##  $ compq1romantic    : int  2 2 1 1 2 1 2 2 1 2 ...
##  $ compq1academic    : int  2 2 1 1 2 1 2 2 1 2 ...
##  $ compq1drugs       : int  2 2 1 1 2 1 2 2 1 2 ...
##  $ compq2work        : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ compq2romantic    : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ compq2academic    : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ compq2drugs       : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ compq3work        : int  3 3 3 3 3 3 3 3 3 3 ...
##  $ compq3romantic    : int  3 3 3 3 3 3 3 3 3 3 ...
##  $ compq3academic    : int  3 3 3 3 3 3 3 3 3 3 ...
##  $ compq3drugs       : int  3 3 3 3 3 3 3 3 3 3 ...
##  $ compq4work        : int  1 1 1 2 2 1 1 1 1 1 ...
##  $ compq4romantic    : int  1 1 1 2 2 1 1 1 1 1 ...
##  $ compq4academic    : int  1 1 1 2 2 1 1 1 1 1 ...
##  $ compq4drugs       : int  1 1 1 2 2 1 1 1 1 1 ...
##  $ sumdo             : num  5.5 5.25 4 4.75 5.5 6 6.75 3.75 6.75 7 ...
##  $ sumtrusts         : num  4.5 5.25 4.25 4.75 4.75 5.25 6.5 5.25 6.5 7 ...
##  $ sumtrustg         : num  4.5 4 4 5 4.5 5 6 5 6 6 ...
##  $ sumlike           : num  4.5 5.75 3.75 4.5 4.5 5 5.5 5 6 6 ...
##  $ sumtotal          : num  4.75 5.06 4 4.75 4.81 ...
##  $ age               : int  47 35 38 24 29 34 23 28 24 24 ...
##  $ gender            : chr  "male" "male" "male" "female" ...
##  $ edu               : int  6 5 4 5 6 4 6 4 6 5 ...
##  $ income            : int  1 7 7 3 4 5 7 4 4 4 ...
##  $ generaltrust      : int  5 6 1 5 6 5 5 4 6 6 ...
##  $ previousexperience: int  3 2 3 2 4 3 1 1 1 1 ...
##  $ likeall           : num  4.5 5.75 3.75 4.5 4.5 5 5.5 5 6 6 ...

Barplot

papaja::apa_barplot(data = s1, 
                    dv = "likeall", 
                    factors = c("goodinfo", "condemn"), 
                    id = "id", args_legend = list(x = "topleft"), ylim = c(1, 7))

ANOVA

# Conduct an ANOVA on likeall as a function of goodinfo and condemn

# According to the paper on p. 359
#  Information main effect, F(1, 165) = 137.93, p < .001
#  Condemn main effect, F(1, 165) = 13.20, p < .001
#  Interaction: F(1, 165) = 8.51, p = .004

s1.aov <- aov(likeall ~ goodinfo * condemn, 
              data = s1)

summary(s1.aov)
##                   Df Sum Sq Mean Sq F value Pr(>F)    
## goodinfo           1   69.4   69.44  88.850 <2e-16 ***
## condemn            1    1.5    1.47   1.886 0.1701    
## goodinfo:condemn   1    2.5    2.46   3.151 0.0764 .  
## Residuals        614  479.8    0.78                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 1 observation deleted due to missingness

Study 2

# Show structure of study 2 data
# Should have 803 participants
str(s2)
## 'data.frame':    803 obs. of  38 variables:
##  $ id                : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ direct            : chr  "Moral" "Moral" "Direct" "Moral" ...
##  $ signal            : chr  "Other" "Target" "Other" "Other" ...
##  $ qAnswered         : int  4 4 4 4 4 4 4 4 4 4 ...
##  $ totalCorrect      : int  4 4 4 4 4 4 4 4 4 4 ...
##  $ percCorrect       : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ dowork            : int  4 2 4 4 4 5 4 2 4 4 ...
##  $ doromantic        : int  4 2 3 4 4 3 4 3 3 3 ...
##  $ doacademic        : int  4 2 4 4 1 3 2 6 5 3 ...
##  $ dodrugs           : int  4 2 5 4 3 3 4 4 3 5 ...
##  $ trustswork        : int  4 6 4 4 5 5 2 4 5 4 ...
##  $ trustsromantic    : int  3 6 4 4 3 5 4 4 5 2 ...
##  $ trustsacademic    : int  4 6 4 4 4 5 2 4 4 5 ...
##  $ trustsdrugs       : int  4 6 3 4 4 5 4 4 4 5 ...
##  $ trustgwork        : int  4 6 4 4 4 5 2 4 5 4 ...
##  $ trustgromantic    : int  4 6 4 4 2 5 4 4 4 3 ...
##  $ trustgacademic    : int  4 6 4 4 4 5 2 4 4 5 ...
##  $ trustgdrugs       : int  4 6 4 4 3 5 4 4 3 6 ...
##  $ likework          : int  5 6 4 4 5 5 2 4 5 4 ...
##  $ likeromantic      : int  3 6 4 4 4 5 4 4 4 5 ...
##  $ likeacademic      : int  4 6 4 4 4 5 2 4 5 2 ...
##  $ likedrugs         : int  4 6 4 4 4 5 4 4 3 6 ...
##  $ compq1work        : int  2 1 2 2 1 1 2 1 2 2 ...
##  $ compq1romantic    : int  2 1 2 2 1 1 2 1 2 2 ...
##  $ compq1academic    : int  2 1 2 2 1 1 2 1 2 2 ...
##  $ compq1drugs       : int  2 1 2 2 1 1 2 1 2 2 ...
##  $ sumdo             : num  4 6 4 4 5 4.5 4.5 4.25 4.25 4.25 ...
##  $ sumtrusts         : num  3.75 6 3.75 4 4 5 3 4 4.5 4 ...
##  $ sumtrustg         : num  4 6 4 4 3.25 5 3 4 4 4.5 ...
##  $ sumlike           : num  4 6 4 4 4.25 5 3 4 4.25 4.25 ...
##  $ sumtotal          : num  3.94 6 3.94 4 4.12 ...
##  $ age               : num  27 28 27 25 30 24 24 37 22 22 ...
##  $ gender            : chr  "male" "female" "male" "male" ...
##  $ edu               : int  5 5 5 5 4 4 5 4 5 5 ...
##  $ income            : int  5 5 9 6 5 3 6 2 4 7 ...
##  $ generaltrust      : int  3 6 3 5 3 4 1 2 5 5 ...
##  $ previousexperience: int  2 1 1 1 1 1 3 3 1 1 ...
##  $ likeall           : num  4 6 4 4 4.25 5 3 4 4.25 4.25 ...

Barplot

papaja::apa_barplot(data = s2, 
                    dv = "likeall", 
                    factors = c("signal", "direct"), 
                    id = "id", args_legend = list(x = "topleft"), ylim = c(1, 7))

ANOVA

# Conduct an ANOVA on likeall as a function of goodinfo and condemn

# According to paper on page 361:
#   Signal type, F(1, 799) = 9.92, p = .002
#   Signaler:  F(1,799) = 198.62, p < .001
#   Interaction: F(1, 799) = 14.01, p < .001

s2.aov <- aov(likeall ~ direct * signal, 
              data = s2)

summary(s2.aov)
##                Df Sum Sq Mean Sq F value Pr(>F)    
## direct          1    1.2    1.23   2.065 0.1511    
## signal          1   79.5   79.46 133.892 <2e-16 ***
## direct:signal   1    2.4    2.43   4.097 0.0433 *  
## Residuals     799  474.2    0.59                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1