MB Final Analysis

Load 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.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.4.4     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── 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
if (!require(psych)){
  install.packages("psych", dependencies = TRUE)
  require(psych)
}
Loading required package: psych

Attaching package: 'psych'
The following objects are masked from 'package:ggplot2':

    %+%, alpha

Importing & Cleaning Data

Importing

dataset.sav <- read_sav ("SOP3214C+Experiment+-+MyersBriggs_April+19,+2024_15.03.sav") 

Cleaning - Time

(dataset.sav %>%
  filter(Duration__in_seconds_ > 120) %>% 
  mutate(careerprefDV = as.numeric(QID8)) -> dataset.clean)
# A tibble: 48 × 28
   StartDate           EndDate             Status         IPAddress     Progress
   <dttm>              <dttm>              <dbl+lbl>      <chr>            <dbl>
 1 2024-03-27 23:10:00 2024-03-27 23:16:14 0 [IP Address] 172.56.97.245      100
 2 2024-03-25 14:43:35 2024-03-28 08:10:23 0 [IP Address] 75.148.67.158      100
 3 2024-03-28 08:10:37 2024-03-28 08:12:54 0 [IP Address] 75.148.67.158      100
 4 2024-03-28 08:10:52 2024-03-28 08:15:02 0 [IP Address] 75.148.67.158      100
 5 2024-03-25 14:00:22 2024-03-28 08:17:21 0 [IP Address] 71.190.112.71      100
 6 2024-03-28 08:24:06 2024-03-28 08:26:43 0 [IP Address] 71.190.112.71      100
 7 2024-03-28 08:53:27 2024-03-28 08:55:52 0 [IP Address] 12.244.50.246      100
 8 2024-03-28 09:15:53 2024-03-28 09:20:38 0 [IP Address] 12.75.114.33       100
 9 2024-03-25 14:47:14 2024-03-28 09:42:18 0 [IP Address] 32.141.131.1…      100
10 2024-03-28 10:18:53 2024-03-28 10:22:36 0 [IP Address] 172.56.96.113      100
# ℹ 38 more rows
# ℹ 23 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>, QID15 <dbl+lbl>, QID8 <dbl+lbl>, QID10 <chr>,
#   QID17 <chr>, QID18 <dbl>, QID19 <chr>, FL_11_DO_ISTJCondition <dbl>, …

Cleaning - Energy Trait

(dataset.clean %>% 
  mutate(energyIV = case_when(FL_11_DO_ISTJCondition == 1 ~ "introverted",
                              FL_11_DO_ISFJCondition == 1 ~ "introverted",
                              FL_11_DO_ESFJCondition == 1 ~ "extroverted",
                              FL_11_DO_ESTJCondition == 1 ~ "extroverted")) -> dataset.clean)
# A tibble: 48 × 29
   StartDate           EndDate             Status         IPAddress     Progress
   <dttm>              <dttm>              <dbl+lbl>      <chr>            <dbl>
 1 2024-03-27 23:10:00 2024-03-27 23:16:14 0 [IP Address] 172.56.97.245      100
 2 2024-03-25 14:43:35 2024-03-28 08:10:23 0 [IP Address] 75.148.67.158      100
 3 2024-03-28 08:10:37 2024-03-28 08:12:54 0 [IP Address] 75.148.67.158      100
 4 2024-03-28 08:10:52 2024-03-28 08:15:02 0 [IP Address] 75.148.67.158      100
 5 2024-03-25 14:00:22 2024-03-28 08:17:21 0 [IP Address] 71.190.112.71      100
 6 2024-03-28 08:24:06 2024-03-28 08:26:43 0 [IP Address] 71.190.112.71      100
 7 2024-03-28 08:53:27 2024-03-28 08:55:52 0 [IP Address] 12.244.50.246      100
 8 2024-03-28 09:15:53 2024-03-28 09:20:38 0 [IP Address] 12.75.114.33       100
 9 2024-03-25 14:47:14 2024-03-28 09:42:18 0 [IP Address] 32.141.131.1…      100
10 2024-03-28 10:18:53 2024-03-28 10:22:36 0 [IP Address] 172.56.96.113      100
# ℹ 38 more rows
# ℹ 24 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>, QID15 <dbl+lbl>, QID8 <dbl+lbl>, QID10 <chr>,
#   QID17 <chr>, QID18 <dbl>, QID19 <chr>, FL_11_DO_ISTJCondition <dbl>, …

Cleaning - Decision Trait

(dataset.clean %>% 
  mutate(decisionIV = case_when(FL_11_DO_ISTJCondition == 1 ~ "thinking",
                              FL_11_DO_ISFJCondition == 1 ~ "feeling",
                              FL_11_DO_ESFJCondition == 1 ~ "feeling",
                              FL_11_DO_ESTJCondition == 1 ~ "thinking")) -> dataset.clean)
# A tibble: 48 × 30
   StartDate           EndDate             Status         IPAddress     Progress
   <dttm>              <dttm>              <dbl+lbl>      <chr>            <dbl>
 1 2024-03-27 23:10:00 2024-03-27 23:16:14 0 [IP Address] 172.56.97.245      100
 2 2024-03-25 14:43:35 2024-03-28 08:10:23 0 [IP Address] 75.148.67.158      100
 3 2024-03-28 08:10:37 2024-03-28 08:12:54 0 [IP Address] 75.148.67.158      100
 4 2024-03-28 08:10:52 2024-03-28 08:15:02 0 [IP Address] 75.148.67.158      100
 5 2024-03-25 14:00:22 2024-03-28 08:17:21 0 [IP Address] 71.190.112.71      100
 6 2024-03-28 08:24:06 2024-03-28 08:26:43 0 [IP Address] 71.190.112.71      100
 7 2024-03-28 08:53:27 2024-03-28 08:55:52 0 [IP Address] 12.244.50.246      100
 8 2024-03-28 09:15:53 2024-03-28 09:20:38 0 [IP Address] 12.75.114.33       100
 9 2024-03-25 14:47:14 2024-03-28 09:42:18 0 [IP Address] 32.141.131.1…      100
10 2024-03-28 10:18:53 2024-03-28 10:22:36 0 [IP Address] 172.56.96.113      100
# ℹ 38 more rows
# ℹ 25 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>, QID15 <dbl+lbl>, QID8 <dbl+lbl>, QID10 <chr>,
#   QID17 <chr>, QID18 <dbl>, QID19 <chr>, FL_11_DO_ISTJCondition <dbl>, …

Removing Missing Values in CareerPrefDV

(dataset.clean %>% drop_na(careerprefDV) -> dataset.clean)
# A tibble: 40 × 30
   StartDate           EndDate             Status         IPAddress     Progress
   <dttm>              <dttm>              <dbl+lbl>      <chr>            <dbl>
 1 2024-03-27 23:10:00 2024-03-27 23:16:14 0 [IP Address] 172.56.97.245      100
 2 2024-03-28 08:10:37 2024-03-28 08:12:54 0 [IP Address] 75.148.67.158      100
 3 2024-03-28 08:10:52 2024-03-28 08:15:02 0 [IP Address] 75.148.67.158      100
 4 2024-03-25 14:00:22 2024-03-28 08:17:21 0 [IP Address] 71.190.112.71      100
 5 2024-03-28 08:24:06 2024-03-28 08:26:43 0 [IP Address] 71.190.112.71      100
 6 2024-03-28 08:53:27 2024-03-28 08:55:52 0 [IP Address] 12.244.50.246      100
 7 2024-03-28 09:15:53 2024-03-28 09:20:38 0 [IP Address] 12.75.114.33       100
 8 2024-03-28 10:18:53 2024-03-28 10:22:36 0 [IP Address] 172.56.96.113      100
 9 2024-03-28 10:22:24 2024-03-28 10:24:29 0 [IP Address] 73.35.87.246       100
10 2024-03-28 06:21:13 2024-03-28 12:15:36 0 [IP Address] 166.199.100.…      100
# ℹ 30 more rows
# ℹ 25 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>, QID15 <dbl+lbl>, QID8 <dbl+lbl>, QID10 <chr>,
#   QID17 <chr>, QID18 <dbl>, QID19 <chr>, FL_11_DO_ISTJCondition <dbl>, …

Calculating Means & Standard Deviations

4 Personality Types

(dataset.clean %>% 
  group_by(decisionIV,energyIV) %>% 
  summarise(mean = mean(careerprefDV), 
            SD = sd(careerprefDV)) -> PersonalityTypeDescriptives) 
`summarise()` has grouped output by 'decisionIV'. You can override using the
`.groups` argument.
# A tibble: 4 × 4
# Groups:   decisionIV [2]
  decisionIV energyIV     mean    SD
  <chr>      <chr>       <dbl> <dbl>
1 feeling    extroverted  4.7   2.36
2 feeling    introverted  5     2.24
3 thinking   extroverted  4.78  2.44
4 thinking   introverted  5.25  2.72

Decision Making Trait

(dataset.clean %>% 
  group_by(decisionIV) %>% 
  summarise(mean = mean(careerprefDV), 
            SD = sd(careerprefDV)) -> decisionDescriptives) 
# A tibble: 2 × 3
  decisionIV  mean    SD
  <chr>      <dbl> <dbl>
1 feeling     4.8   2.24
2 thinking    5.08  2.58

Energy Trait

(dataset.clean %>% 
  group_by(energyIV) %>% 
  summarise(mean = mean(careerprefDV), 
            SD = sd(careerprefDV)) -> energyDescriptives) 
# A tibble: 2 × 3
  energyIV     mean    SD
  <chr>       <dbl> <dbl>
1 extroverted  4.74  2.33
2 introverted  5.19  2.56

Running ANOVA

(dataset.clean.aov <- aov_ez(id = "ResponseId", dv = "careerprefDV", data = dataset.clean, between=c("energyIV", "decisionIV")))
Converting to factor: energyIV, decisionIV
Contrasts set to contr.sum for the following variables: energyIV, decisionIV
Anova Table (Type 3 tests)

Response: careerprefDV
               Effect    df  MSE    F   ges p.value
1            energyIV 1, 36 6.35 0.20  .005    .659
2          decisionIV 1, 36 6.35 0.04 <.001    .851
3 energyIV:decisionIV 1, 36 6.35 0.01 <.001    .921
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1