Zen meditation neutralises emotional evaluation, but not implicit affective processing of words

# Load necessary libraries
pacman::p_load(pacman, ggplot2, dplyr, GGally, readxl)

# Read the datasets
MWT_B_Intelligence_Test <- read_excel("MWT-B, Intelligence Test , Lusnig, Radach, Mueller, Hofmann, 2020.xlsx")
D2_R_Concentration_Capacity_Test <- read_excel("D2-R, Concentration Capacity Test, Lusnig, Radach, Mueller, Hofmann, 2020.xlsx")
Big_5_Personality_Test <- read_excel("Big 5, Personality Test, Lusnig, Radach, Mueller, Hofmann, 2020.xlsx")
Valence_Rating_Data <- read_excel("Valence Rating Data, Lusnig, Radach, Mueller, Hofmann, 2020.xlsx")
Response_Time_Data <- read_excel("Response Time Data, Lusnig, Radach, Mueller, Hofmann, 2020.xlsx")

# Create a function to examine datasets
examine_data <- function(data, dataset_name) {
  cat("\n============================\n")
  cat("Dataset: ", dataset_name, "\n")
  cat("============================\n")
  
  # View structure of the dataset
  cat("\nStructure of the dataset:\n")
  str(data)
  
  # Summary of the dataset
  cat("\nSummary statistics:\n")
  print(summary(data))
  
  # First few rows of the dataset
  cat("\nFirst 6 rows of the dataset:\n")
  print(head(data))
}

# Examine each dataset
examine_data(MWT_B_Intelligence_Test, "MWT-B Intelligence Test")
## 
## ============================
## Dataset:  MWT-B Intelligence Test 
## ============================
## 
## Structure of the dataset:
## tibble [40 × 3] (S3: tbl_df/tbl/data.frame)
##  $ group  : num [1:40] 0 0 0 0 0 0 0 0 0 0 ...
##  $ subject: num [1:40] 1 2 3 4 5 6 7 8 9 10 ...
##  $ Score  : num [1:40] 32 28 31 29 26 17 22 25 22 32 ...
## 
## Summary statistics:
##      group        subject          Score      
##  Min.   :0.0   Min.   : 1.00   Min.   :17.00  
##  1st Qu.:0.0   1st Qu.: 5.75   1st Qu.:22.00  
##  Median :0.5   Median :10.50   Median :25.00  
##  Mean   :0.5   Mean   :10.50   Mean   :25.02  
##  3rd Qu.:1.0   3rd Qu.:15.25   3rd Qu.:28.00  
##  Max.   :1.0   Max.   :20.00   Max.   :32.00  
## 
## First 6 rows of the dataset:
## # A tibble: 6 × 3
##   group subject Score
##   <dbl>   <dbl> <dbl>
## 1     0       1    32
## 2     0       2    28
## 3     0       3    31
## 4     0       4    29
## 5     0       5    26
## 6     0       6    17
examine_data(D2_R_Concentration_Capacity_Test, "D2-R Concentration Capacity Test")
## 
## ============================
## Dataset:  D2-R Concentration Capacity Test 
## ============================
## 
## Structure of the dataset:
## tibble [40 × 5] (S3: tbl_df/tbl/data.frame)
##  $ group                             : num [1:40] 0 0 0 0 0 0 0 0 0 0 ...
##  $ subject                           : num [1:40] 1 2 3 4 5 6 7 8 9 10 ...
##  $ Number of Processed Target Objects: num [1:40] 161 218 164 113 200 190 152 204 167 158 ...
##  $ Concentration Capacity            : num [1:40] 134 168 132 110 158 152 141 187 159 148 ...
##  $ Percentage of Errors              : num [1:40] 16.77 22.94 19.51 2.65 21 ...
## 
## Summary statistics:
##      group        subject      Number of Processed Target Objects
##  Min.   :0.0   Min.   : 1.00   Min.   :113.0                     
##  1st Qu.:0.0   1st Qu.: 5.75   1st Qu.:153.5                     
##  Median :0.5   Median :10.50   Median :167.0                     
##  Mean   :0.5   Mean   :10.50   Mean   :168.7                     
##  3rd Qu.:1.0   3rd Qu.:15.25   3rd Qu.:191.8                     
##  Max.   :1.0   Max.   :20.00   Max.   :218.0                     
##  Concentration Capacity Percentage of Errors
##  Min.   : 73.0          Min.   : 0.5556     
##  1st Qu.:128.5          1st Qu.: 6.9947     
##  Median :154.5          Median :12.8817     
##  Mean   :146.0          Mean   :13.7258     
##  3rd Qu.:164.5          3rd Qu.:18.9870     
##  Max.   :197.0          Max.   :37.1951     
## 
## First 6 rows of the dataset:
## # A tibble: 6 × 5
##   group subject `Number of Processed Target Objects` `Concentration Capacity`
##   <dbl>   <dbl>                                <dbl>                    <dbl>
## 1     0       1                                  161                      134
## 2     0       2                                  218                      168
## 3     0       3                                  164                      132
## 4     0       4                                  113                      110
## 5     0       5                                  200                      158
## 6     0       6                                  190                      152
## # ℹ 1 more variable: `Percentage of Errors` <dbl>
examine_data(Big_5_Personality_Test, "Big 5 Personality Test")
## 
## ============================
## Dataset:  Big 5 Personality Test 
## ============================
## 
## Structure of the dataset:
## tibble [40 × 10] (S3: tbl_df/tbl/data.frame)
##  $ group                               : num [1:40] 0 0 0 0 0 0 0 0 0 0 ...
##  $ subject                             : num [1:40] 1 2 3 4 5 6 7 8 9 10 ...
##  $ Neuroticism                         : num [1:40] 4 3 5 6 4 2 5 4 6 6 ...
##  $ Extraversion                        : num [1:40] 4 4 7 7 5 7 5 5 3 5 ...
##  $ Openness                            : num [1:40] 4 6 8 8 6 6 8 5 8 8 ...
##  $ Conscientiousness                   : num [1:40] 3 6 3 3 4 4 6 4 5 6 ...
##  $ Agreeableness                       : num [1:40] 5 5 6 6 4 6 8 5 6 3 ...
##  $ Need for Achievement and Performance: num [1:40] 4 3 5 2 3 4 3 5 1 3 ...
##  $ Need for Safety and Peace           : num [1:40] 4 4 4 1 6 2 3 3 5 6 ...
##  $ Need for Power and Influence        : num [1:40] 4 6 5 2 7 3 3 6 1 3 ...
## 
## Summary statistics:
##      group        subject       Neuroticism    Extraversion     Openness  
##  Min.   :0.0   Min.   : 1.00   Min.   :1.00   Min.   :2.00   Min.   :2.0  
##  1st Qu.:0.0   1st Qu.: 5.75   1st Qu.:3.75   1st Qu.:5.00   1st Qu.:4.0  
##  Median :0.5   Median :10.50   Median :4.00   Median :6.00   Median :6.0  
##  Mean   :0.5   Mean   :10.50   Mean   :4.25   Mean   :5.75   Mean   :5.4  
##  3rd Qu.:1.0   3rd Qu.:15.25   3rd Qu.:5.00   3rd Qu.:7.00   3rd Qu.:7.0  
##  Max.   :1.0   Max.   :20.00   Max.   :7.00   Max.   :8.00   Max.   :9.0  
##  Conscientiousness Agreeableness  Need for Achievement and Performance
##  Min.   :2.00      Min.   :1.00   Min.   :1.0                         
##  1st Qu.:3.00      1st Qu.:4.00   1st Qu.:3.0                         
##  Median :5.00      Median :5.00   Median :5.0                         
##  Mean   :4.65      Mean   :5.20   Mean   :4.6                         
##  3rd Qu.:6.00      3rd Qu.:6.25   3rd Qu.:6.0                         
##  Max.   :8.00      Max.   :9.00   Max.   :8.0                         
##  Need for Safety and Peace Need for Power and Influence
##  Min.   :1.000             Min.   :1.00                
##  1st Qu.:4.000             1st Qu.:4.00                
##  Median :5.000             Median :5.00                
##  Mean   :4.725             Mean   :4.95                
##  3rd Qu.:5.250             3rd Qu.:6.00                
##  Max.   :9.000             Max.   :7.00                
## 
## First 6 rows of the dataset:
## # A tibble: 6 × 10
##   group subject Neuroticism Extraversion Openness Conscientiousness
##   <dbl>   <dbl>       <dbl>        <dbl>    <dbl>             <dbl>
## 1     0       1           4            4        4                 3
## 2     0       2           3            4        6                 6
## 3     0       3           5            7        8                 3
## 4     0       4           6            7        8                 3
## 5     0       5           4            5        6                 4
## 6     0       6           2            7        6                 4
## # ℹ 4 more variables: Agreeableness <dbl>,
## #   `Need for Achievement and Performance` <dbl>,
## #   `Need for Safety and Peace` <dbl>, `Need for Power and Influence` <dbl>
examine_data(Valence_Rating_Data, "Valence Rating Data")
## 
## ============================
## Dataset:  Valence Rating Data 
## ============================
## 
## Structure of the dataset:
## tibble [7,963 × 8] (S3: tbl_df/tbl/data.frame)
##  $ subject : chr [1:7963] "C1" "C1" "C1" "C1" ...
##  $ group   : num [1:7963] 1 1 1 1 1 1 1 1 1 1 ...
##  $ Rating  : num [1:7963] -3 -3 -3 -3 -3 -3 -3 -3 -2 -2 ...
##  $ neg_high: num [1:7963] 1 1 1 1 0 0 0 0 1 1 ...
##  $ neg_low : num [1:7963] 0 0 0 0 1 1 1 1 0 0 ...
##  $ pos     : num [1:7963] 0 0 0 0 0 0 0 0 0 0 ...
##  $ time    : num [1:7963] 0 0 0 0 0 0 0 0 0 0 ...
##  $ item    : chr [1:7963] "ERDBEBEN" "RAUB" "SABOTAGE" "MALARIA" ...
## 
## Summary statistics:
##    subject              group            Rating           neg_high 
##  Length:7963        Min.   :0.0000   Min.   :-3.0000   Min.   :-1  
##  Class :character   1st Qu.:0.0000   1st Qu.:-1.0000   1st Qu.:-1  
##  Mode  :character   Median :1.0000   Median : 0.0000   Median : 0  
##                     Mean   :0.5001   Mean   :-0.3187   Mean   : 0  
##                     3rd Qu.:1.0000   3rd Qu.: 0.0000   3rd Qu.: 1  
##                     Max.   :1.0000   Max.   : 3.0000   Max.   : 1  
##     neg_low               pos                 time            item          
##  Min.   :-1.000000   Min.   :-1.000000   Min.   :0.0000   Length:7963       
##  1st Qu.:-1.000000   1st Qu.:-1.000000   1st Qu.:0.0000   Class :character  
##  Median : 0.000000   Median : 0.000000   Median :0.0000   Mode  :character  
##  Mean   :-0.001507   Mean   :-0.002386   Mean   :0.4998                     
##  3rd Qu.: 0.000000   3rd Qu.: 0.000000   3rd Qu.:1.0000                     
##  Max.   : 1.000000   Max.   : 1.000000   Max.   :1.0000                     
## 
## First 6 rows of the dataset:
## # A tibble: 6 × 8
##   subject group Rating neg_high neg_low   pos  time item    
##   <chr>   <dbl>  <dbl>    <dbl>   <dbl> <dbl> <dbl> <chr>   
## 1 C1          1     -3        1       0     0     0 ERDBEBEN
## 2 C1          1     -3        1       0     0     0 RAUB    
## 3 C1          1     -3        1       0     0     0 SABOTAGE
## 4 C1          1     -3        1       0     0     0 MALARIA 
## 5 C1          1     -3        0       1     0     0 STAU    
## 6 C1          1     -3        0       1     0     0 VERLIES
examine_data(Response_Time_Data, "Response Time Data")
## 
## ============================
## Dataset:  Response Time Data 
## ============================
## 
## Structure of the dataset:
## tibble [7,016 × 8] (S3: tbl_df/tbl/data.frame)
##  $ subject      : chr [1:7016] "C1" "C1" "C1" "C1" ...
##  $ group        : num [1:7016] 1 1 1 1 1 1 1 1 1 1 ...
##  $ RT           : num [1:7016] 657 594 532 657 844 ...
##  $ negative_high: num [1:7016] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
##  $ negative_low : num [1:7016] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
##  $ positive     : num [1:7016] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
##  $ time         : num [1:7016] 0 0 0 0 0 0 0 0 0 0 ...
##  $ item         : chr [1:7016] "TARNUNG" "SCHWUR" "PEGEL" "SKORPION" ...
## 
## Summary statistics:
##    subject              group              RT           negative_high      
##  Length:7016        Min.   :0.0000   Min.   :  0.3009   Min.   :-1.000000  
##  Class :character   1st Qu.:0.0000   1st Qu.:594.4577   1st Qu.: 0.000000  
##  Mode  :character   Median :0.0000   Median :668.5010   Median : 0.000000  
##                     Mean   :0.4999   Mean   :656.1289   Mean   : 0.006414  
##                     3rd Qu.:1.0000   3rd Qu.:750.3961   3rd Qu.: 1.000000  
##                     Max.   :1.0000   Max.   :999.4331   Max.   : 1.000000  
##   negative_low          positive              time            item          
##  Min.   :-1.000000   Min.   :-1.000000   Min.   :0.0000   Length:7016       
##  1st Qu.: 0.000000   1st Qu.: 0.000000   1st Qu.:0.0000   Class :character  
##  Median : 0.000000   Median : 0.000000   Median :1.0000   Mode  :character  
##  Mean   :-0.007697   Mean   : 0.008694   Mean   :0.5078                     
##  3rd Qu.: 0.000000   3rd Qu.: 1.000000   3rd Qu.:1.0000                     
##  Max.   : 1.000000   Max.   : 1.000000   Max.   :1.0000                     
## 
## First 6 rows of the dataset:
## # A tibble: 6 × 8
##   subject group    RT negative_high negative_low positive  time item    
##   <chr>   <dbl> <dbl>         <dbl>        <dbl>    <dbl> <dbl> <chr>   
## 1 C1          1  657.            -1           -1       -1     0 TARNUNG 
## 2 C1          1  594.            -1           -1       -1     0 SCHWUR  
## 3 C1          1  532.            -1           -1       -1     0 PEGEL   
## 4 C1          1  657.            -1           -1       -1     0 SKORPION
## 5 C1          1  844.            -1           -1       -1     0 SCHEICH 
## 6 C1          1  688.            -1           -1       -1     0 TAUMEL
# Group summary and comparison
MWT_summary <- MWT_B_Intelligence_Test %>%
  group_by(group) %>%
  summarise(mean_score = mean(Score), sd_score = sd(Score))

print(MWT_summary)
## # A tibble: 2 × 3
##   group mean_score sd_score
##   <dbl>      <dbl>    <dbl>
## 1     0       25.0     4.10
## 2     1       25.1     3.24
# Boxplot comparing intelligence scores by group
ggplot(MWT_B_Intelligence_Test, aes(x = factor(group), y = Score)) +
  geom_boxplot() +
  labs(title = "MWT-B Intelligence Test Scores by Group", x = "Group", y = "Score") +
  theme()

# Correlation between processed target objects, concentration capacity, and errors
correlation_matrix <- cor(D2_R_Concentration_Capacity_Test %>% select(`Number of Processed Target Objects`, `Concentration Capacity`, `Percentage of Errors`))
print(correlation_matrix)
##                                    Number of Processed Target Objects
## Number of Processed Target Objects                         1.00000000
## Concentration Capacity                                     0.79951087
## Percentage of Errors                                      -0.02501962
##                                    Concentration Capacity Percentage of Errors
## Number of Processed Target Objects              0.7995109          -0.02501962
## Concentration Capacity                          1.0000000          -0.45874739
## Percentage of Errors                           -0.4587474           1.00000000
# Scatter plot between concentration capacity and error percentage
ggplot(D2_R_Concentration_Capacity_Test, aes(x = `Concentration Capacity`, y = `Percentage of Errors`, color = factor(group))) +
  geom_point() +
  labs(title = "Concentration Capacity vs. Error Percentage", x = "Concentration Capacity", y = "Error Percentage") +
  theme()

# Ensure only numeric columns are selected for scaling.
Big_5_scaled <- Big_5_Personality_Test %>%
  select(group, Neuroticism:`Need for Power and Influence`) %>%  # Select the necessary columns
  mutate(across(Neuroticism:`Need for Power and Influence`, scale))  # Scale numeric columns

# Parallel coordinate plot
ggparcoord(Big_5_scaled, columns = 2:9, groupColumn = 1, scale = "globalminmax") +
  labs(title = "Big 5 Personality Traits Comparison by Group") +
  theme()

# Summary of valence ratings
Valence_summary <- Valence_Rating_Data %>%
  group_by(group) %>%
  summarise(mean_rating = mean(Rating), sd_rating = sd(Rating))

print(Valence_summary)
## # A tibble: 2 × 3
##   group mean_rating sd_rating
##   <dbl>       <dbl>     <dbl>
## 1     0      -0.248      1.34
## 2     1      -0.390      1.48
# Histogram of ratings
ggplot(Valence_Rating_Data, aes(x = Rating, fill = factor(group))) +
  geom_histogram(bins = 20, position = "dodge") +
  labs(title = "Distribution of Valence Ratings by Group", x = "Rating", y = "Count") +
  theme()

# Summary of response times by group
RT_summary <- Response_Time_Data %>%
  group_by(group) %>%
  summarise(mean_RT = mean(RT), sd_RT = sd(RT))

print(RT_summary)
## # A tibble: 2 × 3
##   group mean_RT sd_RT
##   <dbl>   <dbl> <dbl>
## 1     0    667.  188.
## 2     1    646.  183.
# Boxplot of response times by group
ggplot(Response_Time_Data, aes(x = factor(group), y = RT)) +
  geom_boxplot() +
  labs(title = "Response Time by Group", x = "Group", y = "Response Time (ms)") +
  theme()

# Scatter plot of RT vs positive/negative tagging
ggplot(Response_Time_Data, aes(x = RT, y = positive, color = factor(group))) +
  geom_point() +
  labs(title = "Response Time vs Positive Emotional Tagging", x = "Response Time (ms)", y = "Positive Tagging") +
  theme()