Analysis Group 4

Loading Packages

if (!require(haven)){
  install.packages("haven", dependencies = TRUE)
  require(haven)
}
Loading required package: haven
 if (!require(tidyverse)){
  install.packages("tidyverse", dependencies = TRUE)
  require(tidyverse)
}
Loading required package: tidyverse
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.2     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.0
✔ ggplot2   3.4.2     ✔ tibble    3.2.1
✔ lubridate 1.9.2     ✔ tidyr     1.3.0
✔ purrr     1.0.1     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
if (!require(afex)){
  install.packages("afex", dependencies = TRUE)
  require(afex)
}
Loading required package: afex
Loading required package: lme4
Loading required package: Matrix

Attaching package: 'Matrix'
The following objects are masked from 'package:tidyr':

    expand, pack, unpack
************
Welcome to afex. For support visit: http://afex.singmann.science/
- Functions for ANOVAs: aov_car(), aov_ez(), and aov_4()
- Methods for calculating p-values with mixed(): 'S', 'KR', 'LRT', and 'PB'
- 'afex_aov' and 'mixed' objects can be passed to emmeans() for follow-up tests
- Get and set global package options with: afex_options()
- Set sum-to-zero contrasts globally: set_sum_contrasts()
- For example analyses see: browseVignettes("afex")
************

Attaching package: 'afex'
The following object is masked from 'package:lme4':

    lmer
if (!require(summarytools)){
  install.packages("summarytools", dependencies = TRUE)
  require(summarytools)
}
Loading required package: summarytools
Warning in fun(libname, pkgname): couldn't connect to display ":0"
system might not have X11 capabilities; in case of errors when using dfSummary(), set st_options(use.x11 = FALSE)

Attaching package: 'summarytools'
The following object is masked from 'package:tibble':

    view

Import Data

datasets <- read_sav("Group4data.sav")

Tidy Data

datasets 
# A tibble: 500 × 36
   StartDate           EndDate             Status          IPAddress Progress
   <dttm>              <dttm>              <dbl+lbl>       <chr>        <dbl>
 1 2023-08-04 16:43:37 2023-08-04 16:43:37 2 [Survey Test] ""             100
 2 2023-08-04 16:43:37 2023-08-04 16:43:37 2 [Survey Test] ""             100
 3 2023-08-04 16:43:37 2023-08-04 16:43:37 2 [Survey Test] ""             100
 4 2023-08-04 16:43:38 2023-08-04 16:43:38 2 [Survey Test] ""             100
 5 2023-08-04 16:43:38 2023-08-04 16:43:38 2 [Survey Test] ""             100
 6 2023-08-04 16:43:38 2023-08-04 16:43:38 2 [Survey Test] ""             100
 7 2023-08-04 16:43:38 2023-08-04 16:43:38 2 [Survey Test] ""             100
 8 2023-08-04 16:43:39 2023-08-04 16:43:39 2 [Survey Test] ""             100
 9 2023-08-04 16:43:39 2023-08-04 16:43:39 2 [Survey Test] ""             100
10 2023-08-04 16:43:39 2023-08-04 16:43:39 2 [Survey Test] ""             100
# ℹ 490 more rows
# ℹ 31 more variables: Duration__in_seconds_ <dbl>, Finished <dbl+lbl>,
#   RecordedDate <dttm>, ResponseId <chr>, RecipientLastName <chr>,
#   RecipientFirstName <chr>, RecipientEmail <chr>, ExternalReference <chr>,
#   LocationLatitude <chr>, LocationLongitude <chr>, DistributionChannel <chr>,
#   UserLanguage <chr>, Q2 <dbl+lbl>, tender_feelings <dbl+lbl>,
#   don_t_feel_sorry <dbl+lbl>, taken_advantage_of <dbl+lbl>, …

Codebook

print(dfSummary(datasets, graph.magnif = .75), method = 'render')
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''

Data Frame Summary

datasets

Dimensions: 500 x 36
Duplicates: 0
No Variable Label Stats / Values Freqs (% of Valid) Graph Valid Missing
1 StartDate [POSIXct, POSIXt] Start Date
min : 2023-08-04 16:43:37
med : 2023-08-04 16:45:28.5
max : 2023-08-04 16:47:21
range : 3M 44S
167 distinct values 500 (100.0%) 0 (0.0%)
2 EndDate [POSIXct, POSIXt] End Date
min : 2023-08-04 16:43:37
med : 2023-08-04 16:45:28.5
max : 2023-08-04 16:47:21
range : 3M 44S
168 distinct values 500 (100.0%) 0 (0.0%)
3 Status [haven_labelled, vctrs_vctr, double] Response Type 1 distinct value
2 : 500 ( 100.0% )
500 (100.0%) 0 (0.0%)
4 IPAddress [character] IP Address
All empty strings
500 (100.0%) 0 (0.0%)
5 Progress [numeric] Progress 1 distinct value
100 : 500 ( 100.0% )
500 (100.0%) 0 (0.0%)
6 Duration__in_seconds_ [numeric] Duration (in seconds)
Min : 0
Mean : 0.1
Max : 1
0 : 467 ( 93.4% )
1 : 33 ( 6.6% )
500 (100.0%) 0 (0.0%)
7 Finished [haven_labelled, vctrs_vctr, double] Finished 1 distinct value
1 : 500 ( 100.0% )
500 (100.0%) 0 (0.0%)
8 RecordedDate [POSIXct, POSIXt] Recorded Date
min : 2023-08-04 16:43:37
med : 2023-08-04 16:45:29
max : 2023-08-04 16:47:21
range : 3M 44S
170 distinct values 500 (100.0%) 0 (0.0%)
9 ResponseId [character] Response ID
1. R_00qPiiflfmzkwQu
2. R_01k3KEpCoxk9HYW
3. R_02R7q78otgt3QDc
4. R_064ON7LdeDHpA6W
5. R_06V3zqsb5ELmSa2
6. R_07Bmuf9KvloM4JM
7. R_07JdVcansioR5cO
8. R_080M1NYB7Zvji8m
9. R_088ZsbHZh3vWNx4
10. R_08u9CSs4CfmImOO
[ 490 others ]
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
490 ( 98.0% )
500 (100.0%) 0 (0.0%)
10 RecipientLastName [character] Recipient Last Name
All empty strings
500 (100.0%) 0 (0.0%)
11 RecipientFirstName [character] Recipient First Name
All empty strings
500 (100.0%) 0 (0.0%)
12 RecipientEmail [character] Recipient Email
All empty strings
500 (100.0%) 0 (0.0%)
13 ExternalReference [character] External Data Reference
All empty strings
500 (100.0%) 0 (0.0%)
14 LocationLatitude [character] Location Latitude
All empty strings
500 (100.0%) 0 (0.0%)
15 LocationLongitude [character] Location Longitude
All empty strings
500 (100.0%) 0 (0.0%)
16 DistributionChannel [character] Distribution Channel 1. test
500 ( 100.0% )
500 (100.0%) 0 (0.0%)
17 UserLanguage [character] User Language
All empty strings
500 (100.0%) 0 (0.0%)
18 Q2 [haven_labelled, vctrs_vctr, double] I ATTEST THAT I AM AT LEAST 18 YEARS OLD. I HAVE HAD THE OPPORTUNITY TO READ THIS CONSENT FORM, ASK QUESTIONS ABOUT THE RESEARCH STUDY & I AM PREPARED TO PARTICIPATE IN THIS STUDY.
Min : 1
Mean : 1.5
Max : 2
1 : 261 ( 52.2% )
2 : 239 ( 47.8% )
500 (100.0%) 0 (0.0%)
19 tender_feelings [haven_labelled, vctrs_vctr, double] I often have tender, concerned feelings for people less fortunate than me.
Mean (sd) : 2 (1.4)
min ≤ med ≤ max:
0 ≤ 2 ≤ 4
IQR (CV) : 2 (0.7)
0 : 47 ( 19.7% )
1 : 48 ( 20.1% )
2 : 45 ( 18.8% )
3 : 49 ( 20.5% )
4 : 50 ( 20.9% )
239 (47.8%) 261 (52.2%)
20 don_t_feel_sorry [haven_labelled, vctrs_vctr, double] Sometimes I don't feel very sorry for other people when they are having problems.
Mean (sd) : 1.9 (1.4)
min ≤ med ≤ max:
0 ≤ 2 ≤ 4
IQR (CV) : 2 (0.8)
0 : 58 ( 24.3% )
1 : 48 ( 20.1% )
2 : 45 ( 18.8% )
3 : 45 ( 18.8% )
4 : 43 ( 18.0% )
239 (47.8%) 261 (52.2%)
21 taken_advantage_of [haven_labelled, vctrs_vctr, double] When I see someone being taken advantage of, I feel kind of protective towards them.
Mean (sd) : 2 (1.4)
min ≤ med ≤ max:
0 ≤ 2 ≤ 4
IQR (CV) : 2 (0.7)
0 : 46 ( 19.2% )
1 : 52 ( 21.8% )
2 : 46 ( 19.2% )
3 : 50 ( 20.9% )
4 : 45 ( 18.8% )
239 (47.8%) 261 (52.2%)
22 misfortunes_of_other [haven_labelled, vctrs_vctr, double] Other people's misfortunes do not usually disturb me a great deal.
Mean (sd) : 2.2 (1.4)
min ≤ med ≤ max:
0 ≤ 2 ≤ 4
IQR (CV) : 2 (0.7)
0 : 38 ( 15.9% )
1 : 53 ( 22.2% )
2 : 33 ( 13.8% )
3 : 62 ( 25.9% )
4 : 53 ( 22.2% )
239 (47.8%) 261 (52.2%)
23 pity [haven_labelled, vctrs_vctr, double] When I see someone being treated unfairly, I sometimes don't feel very much pity for them.
Mean (sd) : 2 (1.4)
min ≤ med ≤ max:
0 ≤ 2 ≤ 4
IQR (CV) : 2 (0.7)
0 : 38 ( 15.9% )
1 : 59 ( 24.7% )
2 : 48 ( 20.1% )
3 : 51 ( 21.3% )
4 : 43 ( 18.0% )
239 (47.8%) 261 (52.2%)
24 touched [haven_labelled, vctrs_vctr, double] I am often quite touched by things that I see happen.
Mean (sd) : 1.9 (1.4)
min ≤ med ≤ max:
0 ≤ 2 ≤ 4
IQR (CV) : 2 (0.7)
0 : 53 ( 22.2% )
1 : 49 ( 20.5% )
2 : 52 ( 21.8% )
3 : 43 ( 18.0% )
4 : 42 ( 17.6% )
239 (47.8%) 261 (52.2%)
25 soft_hearted [haven_labelled, vctrs_vctr, double] I would describe myself as a pretty soft-hearted person.
Mean (sd) : 2.1 (1.4)
min ≤ med ≤ max:
0 ≤ 2 ≤ 4
IQR (CV) : 2 (0.7)
0 : 44 ( 18.4% )
1 : 41 ( 17.2% )
2 : 54 ( 22.6% )
3 : 45 ( 18.8% )
4 : 55 ( 23.0% )
239 (47.8%) 261 (52.2%)
26 gender [character] Please specify your gender.
1. (Empty string)
2. Ab fermentum porta! Metus
3. Ab nec sollicitudin dolor
4. Accusamus fusce! Ligula e
5. Aenean vestibulum ante en
6. Aliquam eget dignissim na
7. Aliquam phasellus dictums
8. Amet? Interdum blandit fa
9. Ante nunc? Enim tempor mi
10. Ante ullamcorper curabitu
[ 230 others ]
261 ( 52.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
230 ( 46.0% )
500 (100.0%) 0 (0.0%)
27 race [character] Please specify your race or ethnic background.
1. (Empty string)
2. A vitae aliquet convallis
3. Ac justo? Fringilla fusce
4. Ac leo in per iaculis, su
5. Accumsan enim vulputate e
6. Accusamus massa malesuada
7. Aenean non, iaculis eleif
8. Aenean ridiculus quis! Eu
9. Aenean tempora eros, wisi
10. Aenean! Pede curabitur wi
[ 230 others ]
261 ( 52.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
230 ( 46.0% )
500 (100.0%) 0 (0.0%)
28 age_4 [numeric] Please enter your age (must be a number that is at least 18) - Age
Mean (sd) : 60.9 (24.9)
min ≤ med ≤ max:
18 ≤ 65 ≤ 100
IQR (CV) : 43.5 (0.4)
78 distinct values 239 (47.8%) 261 (52.2%)
29 hypothesis [character] What did you think the hypothesis of this study were?
1. (Empty string)
2. Ab enim ut dolor! Ante ac
3. Ab vulputate rutrum suspe
4. Ac platea cursus pretium
5. Ac ultricies tincidunt? C
6. Accusamus malesuada, dapi
7. Aliquam ultrices lorem fe
8. Amet praesent dictumst pe
9. Amet tempor proin dolorem
10. Ante dictumst eros a! Ant
[ 230 others ]
261 ( 52.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
1 ( 0.2% )
230 ( 46.0% )
500 (100.0%) 0 (0.0%)
30 FL_17_DO_Condition1__PositiveExposureandImage [numeric] FL_17 - Block Randomizer - Display Order Condition1: PositiveExposureandImage 1 distinct value
1 : 60 ( 100.0% )
60 (12.0%) 440 (88.0%)
31 FL_17_DO_Condition2_PositiveExposureandNoImage [numeric] FL_17 - Block Randomizer - Display Order Condition2:PositiveExposureandNoImage 1 distinct value
1 : 60 ( 100.0% )
60 (12.0%) 440 (88.0%)
32 FL_17_DO_Condition3_NegativeExposureandImage [numeric] FL_17 - Block Randomizer - Display Order Condition3:NegativeExposureandImage 1 distinct value
1 : 59 ( 100.0% )
59 (11.8%) 441 (88.2%)
33 FL_17_DO_Condition4_NegativeExposureandNoImage [numeric] FL_17 - Block Randomizer - Display Order Condition4:NegativeExposureandNoImage 1 distinct value
1 : 60 ( 100.0% )
60 (12.0%) 440 (88.0%)
34 Condition1__PositiveExposureandImage_DO_Q3 [numeric] Condition 1: Positive Exposure and Image - Display Order Q3 1 distinct value
1 : 60 ( 100.0% )
60 (12.0%) 440 (88.0%)
35 Condition2_PositiveExposureandNoImage_DO_Q12 [numeric] Condition 2: Positive Exposure and No Image - Display Order Q12 1 distinct value
1 : 60 ( 100.0% )
60 (12.0%) 440 (88.0%)
36 Condition4_NegativeExposureandNoImage_DO_Q30 [numeric] Condition 4: Negative Exposure and No Image - Display Order Q30 1 distinct value
1 : 60 ( 100.0% )
60 (12.0%) 440 (88.0%)

Generated by summarytools 1.0.1 (R version 4.3.1)
2023-08-05

Create Mood Valence IV

datasets %>%
  mutate(MoodValenceIV = case_when(FL_17_DO_Condition1__PositiveExposureandImage == 1 ~ "Positive", FL_17_DO_Condition2_PositiveExposureandNoImage == 1 ~ "Positive", FL_17_DO_Condition3_NegativeExposureandImage == 1 ~ "Negative", FL_17_DO_Condition4_NegativeExposureandNoImage == 1 ~ "Negative")) -> datasets

Create Image IV

datasets %>%
  mutate(ImageIV = case_when(FL_17_DO_Condition1__PositiveExposureandImage == 1 ~ "Image", FL_17_DO_Condition2_PositiveExposureandNoImage == 1 ~ "None", FL_17_DO_Condition3_NegativeExposureandImage == 1 ~ "Image",FL_17_DO_Condition4_NegativeExposureandNoImage == 1 ~ "None")) -> datasets 

ANOVA

datasets %>%
  mutate(feelingsDV = as.numeric(tender_feelings)) -> datasets
aov_ez(id = "ResponseId",
       dv = "feelingsDV", 
       data = datasets, 
       between=c('MoodValenceIV', "ImageIV"),
       anova_table = list(es = "pes"))
Converting to factor: MoodValenceIV, ImageIV
Warning: Missing values for 261 ID(s), which were removed before analysis:
R_064ON7LdeDHpA6W, R_07Bmuf9KvloM4JM, R_07JdVcansioR5cO, R_080M1NYB7Zvji8m, R_088ZsbHZh3vWNx4, R_09glXsS5d2Bcv9I, R_0BZmUo4KxR4Dgma, R_0c6552agj5znstU, R_0cxz5sRzAHsdPZY, R_0f8WhTlww5YfmKy, ... [showing first 10 only]
Below the first few rows (in wide format) of the removed cases with missing data.
            ResponseId MoodValenceIV ImageIV  .
# 4  R_064ON7LdeDHpA6W          <NA>    <NA> NA
# 6  R_07Bmuf9KvloM4JM          <NA>    <NA> NA
# 7  R_07JdVcansioR5cO          <NA>    <NA> NA
# 8  R_080M1NYB7Zvji8m          <NA>    <NA> NA
# 9  R_088ZsbHZh3vWNx4          <NA>    <NA> NA
# 12 R_09glXsS5d2Bcv9I          <NA>    <NA> NA
Contrasts set to contr.sum for the following variables: MoodValenceIV, ImageIV
Anova Table (Type 3 tests)

Response: feelingsDV
                 Effect     df  MSE      F   pes p.value
1         MoodValenceIV 1, 235 2.04 2.82 +  .012    .095
2               ImageIV 1, 235 2.04   0.05 <.001    .828
3 MoodValenceIV:ImageIV 1, 235 2.04   0.05 <.001    .815
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1

Study Design Table Numbers

datasets %>%
group_by(ImageIV) %>% 
  summarise(mean = mean(feelingsDV),
            sd = sd(feelingsDV))
# A tibble: 3 × 3
  ImageIV  mean    sd
  <chr>   <dbl> <dbl>
1 Image    2.01  1.34
2 None     2.05  1.52
3 <NA>    NA    NA   
datasets %>%
group_by(MoodValenceIV) %>% 
  summarise(mean = mean(feelingsDV),
            sd = sd(feelingsDV))
# A tibble: 3 × 3
  MoodValenceIV  mean    sd
  <chr>         <dbl> <dbl>
1 Negative       2.18  1.42
2 Positive       1.88  1.42
3 <NA>          NA    NA   
datasets %>%
group_by(ImageIV, MoodValenceIV) %>% 
  summarise(mean = mean(feelingsDV),
            sd = sd(feelingsDV))
`summarise()` has grouped output by 'ImageIV'. You can override using the
`.groups` argument.
# A tibble: 5 × 4
# Groups:   ImageIV [3]
  ImageIV MoodValenceIV  mean    sd
  <chr>   <chr>         <dbl> <dbl>
1 Image   Negative       2.19  1.36
2 Image   Positive       1.83  1.30
3 None    Negative       2.18  1.49
4 None    Positive       1.92  1.54
5 <NA>    <NA>          NA    NA