if (!require(haven)){
install.packages("haven", dependencies = TRUE)
require(haven)
}Loading required package: haven
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 packages ─────────────────────────────────────── tidyverse 1.3.2 ──
✔ ggplot2 3.4.0 ✔ purrr 1.0.1
✔ tibble 3.1.8 ✔ dplyr 1.0.10
✔ tidyr 1.2.1 ✔ stringr 1.5.0
✔ readr 2.1.3 ✔ forcats 0.5.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
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
- NEWS: emmeans() for ANOVA models now uses model = 'multivariate' as default.
- Get and set global package options with: afex_options()
- Set orthogonal 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
dataset <- read_sav("Project9.sav")(dataset %>%
filter(Duration__in_seconds_ > 45) -> dataset.clean)# A tibble: 66 × 27
StartDate EndDate Status IPAdd…¹ Progr…² Durat…³
<dttm> <dttm> <dbl+lbl> <chr> <dbl> <dbl>
1 2023-04-03 11:51:11 2023-04-06 14:23:36 0 [IP Addres… 104.13… 100 268344
2 2023-04-06 14:33:42 2023-04-06 14:34:35 0 [IP Addres… 173.8.… 100 53
3 2023-04-06 14:31:45 2023-04-06 14:35:14 0 [IP Addres… 72.210… 100 208
4 2023-04-06 14:44:52 2023-04-06 14:45:54 0 [IP Addres… 174.20… 100 62
5 2023-04-06 14:52:47 2023-04-06 14:54:18 0 [IP Addres… 107.11… 100 90
6 2023-04-06 14:56:39 2023-04-06 14:57:40 0 [IP Addres… 174.20… 100 61
7 2023-04-06 15:07:01 2023-04-06 15:08:52 0 [IP Addres… 24.113… 100 110
8 2023-04-06 15:09:34 2023-04-06 15:10:54 0 [IP Addres… 172.56… 100 79
9 2023-04-06 15:16:58 2023-04-06 15:18:13 0 [IP Addres… 107.11… 100 74
10 2023-04-06 15:17:44 2023-04-06 15:18:42 0 [IP Addres… 73.242… 100 57
# … with 56 more rows, 21 more variables: Finished <dbl+lbl>,
# RecordedDate <dttm>, ResponseId <chr>, RecipientLastName <chr>,
# RecipientFirstName <chr>, RecipientEmail <chr>, ExternalReference <chr>,
# LocationLatitude <chr>, LocationLongitude <chr>, DistributionChannel <chr>,
# UserLanguage <chr>, Welcome_and_Consent <dbl+lbl>,
# Dependent_Measure <dbl+lbl>, Gender <chr>, Race <chr>, Age <dbl>,
# Hypothesis <chr>, FL_18_DO_Condition1_WithFood_Healthy <dbl>, …
print(dfSummary(dataset.clean, 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 ''
| No | Variable | Label | Stats / Values | Freqs (% of Valid) | Graph | Valid | Missing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | StartDate [POSIXct, POSIXt] | Start Date |
|
65 distinct values | 66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | EndDate [POSIXct, POSIXt] | End Date |
|
66 distinct values | 66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | Status [haven_labelled, vctrs_vctr, double] | Response Type | 1 distinct value |
|
66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | IPAddress [character] | IP Address |
|
|
66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | Progress [numeric] | Progress |
|
|
66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | Duration__in_seconds_ [numeric] | Duration (in seconds) |
|
53 distinct values | 66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | Finished [haven_labelled, vctrs_vctr, double] | Finished |
|
|
66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | RecordedDate [POSIXct, POSIXt] | Recorded Date |
|
66 distinct values | 66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | ResponseId [character] | Response ID |
|
|
66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | RecipientLastName [character] | Recipient Last Name |
|
66 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | RecipientFirstName [character] | Recipient First Name |
|
66 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | RecipientEmail [character] | Recipient Email |
|
66 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | ExternalReference [character] | External Data Reference |
|
66 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | LocationLatitude [character] | Location Latitude |
|
|
66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | LocationLongitude [character] | Location Longitude |
|
|
66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | DistributionChannel [character] | Distribution Channel |
|
|
66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | UserLanguage [character] | User Language | 1. EN |
|
66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | Welcome_and_Consent [haven_labelled, vctrs_vctr, double] | Purpose of Research and Specific procedures to be used:In this study, you will be asked to participa | 1 distinct value |
|
66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | Dependent_Measure [haven_labelled, vctrs_vctr, double] | How hungry are you? |
|
|
62 (93.9%) | 4 (6.1%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | Gender [character] | What is your gender? |
|
|
66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | Race [character] | What is your race? |
|
|
66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | Age [numeric] | What is your age? |
|
22 distinct values | 57 (86.4%) | 9 (13.6%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | Hypothesis [character] | What did you think our hypotheses were from this survey? |
|
|
66 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | FL_18_DO_Condition1_WithFood_Healthy [numeric] | FL_18 - Block Randomizer - Display Order Condition1:WithFood,Healthy | 1 distinct value |
|
18 (27.3%) | 48 (72.7%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | FL_18_DO_Condition2_WithFood_Unhealthy [numeric] | FL_18 - Block Randomizer - Display Order Condition2:WithFood,Unhealthy | 1 distinct value |
|
15 (22.7%) | 51 (77.3%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | FL_18_DO_Condition3_Withoutfood_unhealthy [numeric] | FL_18 - Block Randomizer - Display Order Condition3:Withoutfood,unhealthy | 1 distinct value |
|
11 (16.7%) | 55 (83.3%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | FL_18_DO_Condition4_Withoutfood_healthy [numeric] | FL_18 - Block Randomizer - Display Order Condition4:Withoutfood,healthy | 1 distinct value |
|
22 (33.3%) | 44 (66.7%) |
Generated by summarytools 1.0.1 (R version 4.2.2)
2023-04-24
(dataset.clean %>%
mutate(FoodIV = case_when(FL_18_DO_Condition1_WithFood_Healthy == 1 ~ "food", FL_18_DO_Condition2_WithFood_Unhealthy == 1 ~ "food", FL_18_DO_Condition3_Withoutfood_unhealthy == 1 ~ "no food", FL_18_DO_Condition4_Withoutfood_healthy == 1 ~ "no food")) -> dataset.clean)# A tibble: 66 × 28
StartDate EndDate Status IPAdd…¹ Progr…² Durat…³
<dttm> <dttm> <dbl+lbl> <chr> <dbl> <dbl>
1 2023-04-03 11:51:11 2023-04-06 14:23:36 0 [IP Addres… 104.13… 100 268344
2 2023-04-06 14:33:42 2023-04-06 14:34:35 0 [IP Addres… 173.8.… 100 53
3 2023-04-06 14:31:45 2023-04-06 14:35:14 0 [IP Addres… 72.210… 100 208
4 2023-04-06 14:44:52 2023-04-06 14:45:54 0 [IP Addres… 174.20… 100 62
5 2023-04-06 14:52:47 2023-04-06 14:54:18 0 [IP Addres… 107.11… 100 90
6 2023-04-06 14:56:39 2023-04-06 14:57:40 0 [IP Addres… 174.20… 100 61
7 2023-04-06 15:07:01 2023-04-06 15:08:52 0 [IP Addres… 24.113… 100 110
8 2023-04-06 15:09:34 2023-04-06 15:10:54 0 [IP Addres… 172.56… 100 79
9 2023-04-06 15:16:58 2023-04-06 15:18:13 0 [IP Addres… 107.11… 100 74
10 2023-04-06 15:17:44 2023-04-06 15:18:42 0 [IP Addres… 73.242… 100 57
# … with 56 more rows, 22 more variables: Finished <dbl+lbl>,
# RecordedDate <dttm>, ResponseId <chr>, RecipientLastName <chr>,
# RecipientFirstName <chr>, RecipientEmail <chr>, ExternalReference <chr>,
# LocationLatitude <chr>, LocationLongitude <chr>, DistributionChannel <chr>,
# UserLanguage <chr>, Welcome_and_Consent <dbl+lbl>,
# Dependent_Measure <dbl+lbl>, Gender <chr>, Race <chr>, Age <dbl>,
# Hypothesis <chr>, FL_18_DO_Condition1_WithFood_Healthy <dbl>, …
(dataset.clean %>%
mutate(HealthyIV = case_when(FL_18_DO_Condition1_WithFood_Healthy == 1 ~ "healthy", FL_18_DO_Condition2_WithFood_Unhealthy == 1 ~ "unhealthy", FL_18_DO_Condition3_Withoutfood_unhealthy == 1 ~ "unhealthy", FL_18_DO_Condition4_Withoutfood_healthy == 1 ~ "healthy")) -> dataset.clean)# A tibble: 66 × 29
StartDate EndDate Status IPAdd…¹ Progr…² Durat…³
<dttm> <dttm> <dbl+lbl> <chr> <dbl> <dbl>
1 2023-04-03 11:51:11 2023-04-06 14:23:36 0 [IP Addres… 104.13… 100 268344
2 2023-04-06 14:33:42 2023-04-06 14:34:35 0 [IP Addres… 173.8.… 100 53
3 2023-04-06 14:31:45 2023-04-06 14:35:14 0 [IP Addres… 72.210… 100 208
4 2023-04-06 14:44:52 2023-04-06 14:45:54 0 [IP Addres… 174.20… 100 62
5 2023-04-06 14:52:47 2023-04-06 14:54:18 0 [IP Addres… 107.11… 100 90
6 2023-04-06 14:56:39 2023-04-06 14:57:40 0 [IP Addres… 174.20… 100 61
7 2023-04-06 15:07:01 2023-04-06 15:08:52 0 [IP Addres… 24.113… 100 110
8 2023-04-06 15:09:34 2023-04-06 15:10:54 0 [IP Addres… 172.56… 100 79
9 2023-04-06 15:16:58 2023-04-06 15:18:13 0 [IP Addres… 107.11… 100 74
10 2023-04-06 15:17:44 2023-04-06 15:18:42 0 [IP Addres… 73.242… 100 57
# … with 56 more rows, 23 more variables: Finished <dbl+lbl>,
# RecordedDate <dttm>, ResponseId <chr>, RecipientLastName <chr>,
# RecipientFirstName <chr>, RecipientEmail <chr>, ExternalReference <chr>,
# LocationLatitude <chr>, LocationLongitude <chr>, DistributionChannel <chr>,
# UserLanguage <chr>, Welcome_and_Consent <dbl+lbl>,
# Dependent_Measure <dbl+lbl>, Gender <chr>, Race <chr>, Age <dbl>,
# Hypothesis <chr>, FL_18_DO_Condition1_WithFood_Healthy <dbl>, …
(dataset.clean %>%
mutate(hungerDV = as.numeric(Dependent_Measure)) -> dataset.clean)# A tibble: 66 × 30
StartDate EndDate Status IPAdd…¹ Progr…² Durat…³
<dttm> <dttm> <dbl+lbl> <chr> <dbl> <dbl>
1 2023-04-03 11:51:11 2023-04-06 14:23:36 0 [IP Addres… 104.13… 100 268344
2 2023-04-06 14:33:42 2023-04-06 14:34:35 0 [IP Addres… 173.8.… 100 53
3 2023-04-06 14:31:45 2023-04-06 14:35:14 0 [IP Addres… 72.210… 100 208
4 2023-04-06 14:44:52 2023-04-06 14:45:54 0 [IP Addres… 174.20… 100 62
5 2023-04-06 14:52:47 2023-04-06 14:54:18 0 [IP Addres… 107.11… 100 90
6 2023-04-06 14:56:39 2023-04-06 14:57:40 0 [IP Addres… 174.20… 100 61
7 2023-04-06 15:07:01 2023-04-06 15:08:52 0 [IP Addres… 24.113… 100 110
8 2023-04-06 15:09:34 2023-04-06 15:10:54 0 [IP Addres… 172.56… 100 79
9 2023-04-06 15:16:58 2023-04-06 15:18:13 0 [IP Addres… 107.11… 100 74
10 2023-04-06 15:17:44 2023-04-06 15:18:42 0 [IP Addres… 73.242… 100 57
# … with 56 more rows, 24 more variables: Finished <dbl+lbl>,
# RecordedDate <dttm>, ResponseId <chr>, RecipientLastName <chr>,
# RecipientFirstName <chr>, RecipientEmail <chr>, ExternalReference <chr>,
# LocationLatitude <chr>, LocationLongitude <chr>, DistributionChannel <chr>,
# UserLanguage <chr>, Welcome_and_Consent <dbl+lbl>,
# Dependent_Measure <dbl+lbl>, Gender <chr>, Race <chr>, Age <dbl>,
# Hypothesis <chr>, FL_18_DO_Condition1_WithFood_Healthy <dbl>, …
aov_ez(id = "ResponseId",
dv = "hungerDV",
data = dataset.clean,
between=c("HealthyIV", "FoodIV"))Converting to factor: HealthyIV, FoodIV
Warning: Missing values for following ID(s):
R_1eLhVLIXjJc3OTE, R_2OTOBFmnx7tGf26, R_2ScvaTLRYt1NDJj, R_3kcvEuOt7yYp5JR
Removing those cases from the analysis.
Contrasts set to contr.sum for the following variables: HealthyIV, FoodIV
Anova Table (Type 3 tests)
Response: hungerDV
Effect df MSE F ges p.value
1 HealthyIV 1, 58 5.24 4.16 * .067 .046
2 FoodIV 1, 58 5.24 1.43 .024 .237
3 HealthyIV:FoodIV 1, 58 5.24 2.16 .036 .147
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
dataset.clean %>%
group_by(HealthyIV, FoodIV) %>%
summarise(mean = mean(hungerDV, na.rm = TRUE), sd = sd(hungerDV, na.rm = TRUE))`summarise()` has grouped output by 'HealthyIV'. You can override using the
`.groups` argument.
# A tibble: 4 × 4
# Groups: HealthyIV [2]
HealthyIV FoodIV mean sd
<chr> <chr> <dbl> <dbl>
1 healthy food 4.59 2.94
2 healthy no food 3 2.25
3 unhealthy food 4.93 2.27
4 unhealthy no food 5.09 0.539
dataset.clean %>%
group_by(FoodIV) %>%
summarise(mean = mean(hungerDV, na.rm = TRUE), sd = sd(hungerDV, na.rm = TRUE))# A tibble: 2 × 3
FoodIV mean sd
<chr> <dbl> <dbl>
1 food 4.74 2.62
2 no food 3.74 2.08
dataset.clean %>%
group_by(HealthyIV) %>%
summarise(mean = mean(hungerDV, na.rm = TRUE), sd = sd(hungerDV, na.rm = TRUE))# A tibble: 2 × 3
HealthyIV mean sd
<chr> <dbl> <dbl>
1 healthy 3.73 2.67
2 unhealthy 5 1.71