CIG_analysis

Setup, find files

# Load the packages
# library(psych)
library(rstatix)

Attaching package: 'rstatix'
The following object is masked from 'package:stats':

    filter
library(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.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.4     ✔ tidyr     1.3.1
✔ purrr     1.0.4     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks rstatix::filter(), stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
# library(papaja)
library(knitr)
# library(dplyr)
library(ggpubr)

nov_cols <- c("Cameron_Novelty", "kaelyn_novelty", "Cameron_Cameron","Cameron _Novelty")

files <- list.files(path="allfiles", full.names = TRUE)

Do joining and merging

CIG_merge <- read_csv(files[1], col_types = cols(session.ended = col_character())) %>%
  select(-c(ends_with("notes"), title, body, id, vote.index, contains("direction"), 
            contains("reply_to_id"), contains("cast")))%>%
  rename_with(~ "novelty" , any_of(nov_cols))

session_names <- CIG_merge$session.name[1]

for (i in 2:length(files)){
  # for (i in 2:50){
  
  #get the session name of the current file, see if it's in the dataset already
  tempdat <- read_csv(files[i], col_types = cols(session.ended = col_character()), show_col_types = FALSE)
  temp_session <- tempdat$session.name[1]
  
  if (temp_session %in% session_names){
    # print(i)
    tempdat <- read_csv(files[i], col_types = cols(session.ended = col_character()), show_col_types = FALSE) %>%
      select(-c(ends_with("notes"), title, body, id, vote.index, contains("direction"), 
                contains("reply_to_id"), contains("cast"))) %>%
      rename_with(~ paste0("novelty",i) , any_of(nov_cols))
    CIG_merge <- full_join(CIG_merge, tempdat)
  } else {
    tempdat <- read_csv(files[i], col_types = cols(session.ended = col_character()), show_col_types = FALSE) %>%
      select(-c(ends_with("notes"), title, body, id, vote.index, contains("direction"), 
                contains("reply_to_id"), contains("cast"))) %>%
      rename_with(~ "novelty" , any_of(nov_cols))
    CIG_merge <- bind_rows(CIG_merge, tempdat)
    
    session_names <- c(session_names, temp_session)
  }
  
}

Average ratings where there are two raters, combine I or E columns

CIG_merge_averaged <- CIG_merge %>%
  mutate(nov_avg = rowMeans(across(contains("novelty")), na.rm = T),
         nraters = rowSums(!is.na(across(contains("novelty")))), .keep = "unused")

CIG_merge_averaged <- CIG_merge_averaged %>%
  tidyr::unite(col = "i_e",
               Anakaren_idea_or_elab, kaelyn_idea_or_elab, kaelyn_kaelyn_idea_or_elab,
               remove = T,na.rm = TRUE)

Summarize, do stats

session_nov_summary <- CIG_merge_averaged %>%
  filter(i_e %in% c("i", "e")) %>% 
  group_by(session.name, condition.name) %>%
  summarize(
    avg_nov_ideas = mean(nov_avg[i_e == "i"], na.rm = TRUE),
    avg_nov_elabs = mean(nov_avg[i_e == "e"], na.rm = TRUE),
    total_ideas = sum(i_e == "i", na.rm = TRUE),
    total_elabs = sum(i_e == "e", na.rm = TRUE),
    nraters = first(nraters),
    .groups = "drop"
  )

session_nov_summary <- session_nov_summary %>%
  mutate(Feedback = case_when(
    grepl("F", condition.name) ~ "F",
    .default = "Not F"
  ),
  Two_or_three = case_when(
    grepl("2", condition.name) ~ "two",
    .default = "three"
  ))

anova_ideas <- anova_test(avg_nov_ideas ~ Feedback * Two_or_three, 
                          data = session_nov_summary, 
                          type = 3)
anova_ideas
ANOVA Table (type III tests)

                 Effect DFn DFd         F     p p<.05      ges
1              Feedback   1  81 3.370e-01 0.563       4.00e-03
2          Two_or_three   1  81 3.226e+00 0.076       3.80e-02
3 Feedback:Two_or_three   1  81 1.440e-08 1.000       1.78e-10
ggline(data = session_nov_summary, 
       x= "Feedback", 
       y = "avg_nov_ideas", 
       color = "Two_or_three", 
       add = "mean_se")

anova_elabs <- anova_test(avg_nov_elabs ~ Feedback * Two_or_three, 
                          data = session_nov_summary, 
                          type = 3)
Warning: NA detected in rows: 8,10,13,15,21,22,23,24,25,30,31,33,34,35,36,37,39,40,42,43,44,45,47,48,49,50,53,54,57,61,62,63,64,65,66,67,68,70,71,72,75,76,81,83,85.
Removing this rows before the analysis.
anova_elabs
ANOVA Table (type III tests)

                 Effect DFn DFd     F     p p<.05   ges
1              Feedback   1  36 2.893 0.098       0.074
2          Two_or_three   1  36 3.105 0.087       0.079
3 Feedback:Two_or_three   1  36 1.014 0.321       0.027
ggline(data = session_nov_summary, 
       x= "Feedback", 
       y = "avg_nov_elabs", 
       color = "Two_or_three", 
       add = "mean_se")
Warning: Removed 45 rows containing non-finite outside the scale range
(`stat_summary()`).

anova_countideas <- anova_test(total_ideas ~ Feedback * Two_or_three, 
                               data = session_nov_summary, 
                               type = 3)
anova_countideas
ANOVA Table (type III tests)

                 Effect DFn DFd     F     p p<.05   ges
1              Feedback   1  81 0.375 0.542       0.005
2          Two_or_three   1  81 0.121 0.729       0.001
3 Feedback:Two_or_three   1  81 0.134 0.716       0.002
ggline(data = session_nov_summary, 
       x= "Feedback", 
       y = "total_ideas", 
       color = "Two_or_three", 
       add = "mean_se")

anova_countelabs <- anova_test(total_elabs ~ Feedback * Two_or_three, 
                               data = session_nov_summary, 
                               type = 3)
anova_countelabs
ANOVA Table (type III tests)

                 Effect DFn DFd     F     p p<.05      ges
1              Feedback   1  81 0.015 0.903       0.000183
2          Two_or_three   1  81 2.195 0.142       0.026000
3 Feedback:Two_or_three   1  81 0.497 0.483       0.006000
ggline(data = session_nov_summary, 
       x= "Feedback", 
       y = "total_elabs", 
       color = "Two_or_three", 
       add = "mean_se")