> # ============================================================ > # Pre-task_Grammar_Instruction_LREs_Young_Learners – Table 4 > # Wilcoxon Signed-Rank Tests (within-group) > # Between Dictogloss 1 and Dictogloss 2 per target feature > # ============================================================ > library(readxl) > library(dplyr) > # ---- Load the Excel file ---- > data_path <- "C:/Users/dmard/Documents/PTGI_LRE_repro_package/data/PTGI_LRE_data_1.xlsx" > # Load both dictogloss sheets > d1 <- read_excel(data_path, sheet = "Dict. 1") > d2 <- read_excel(data_path, sheet = "Dict. 2") > # ---- Select and merge relevant columns ---- > combined <- d1 %>% + select(Code, Group, `HE/SHE_D1_SUM`, `3ps_D1_SUM`) %>% + left_join( + d2 %>% select(Code, `HE/SHE_D2_SUM`, `3ps_D2_SUM`), + by = "Code" + ) > # ---- Split by group ---- > ctrl <- subset(combined, Group == "Control") > exp <- subset(combined, Group == "Experimental") > # ============================================================ > # WILCOXON SIGNED-RANK TESTS > # ============================================================ > sink("Table4_Wilcoxon_results.txt") # Optional: save console output to file > cat("\n==============================\nCONTROL GROUP\n==============================\n") ============================== CONTROL GROUP ============================== > cat("\nHE/SHE (Dictogloss 1 vs 2)\n") HE/SHE (Dictogloss 1 vs 2) > print(wilcox.test(ctrl$`HE/SHE_D1_SUM`, ctrl$`HE/SHE_D2_SUM`, paired = TRUE, exact = FALSE, correct = TRUE)) Wilcoxon signed rank test with continuity correction data: ctrl$`HE/SHE_D1_SUM` and ctrl$`HE/SHE_D2_SUM` V = 1, p-value = 0.4227 alternative hypothesis: true location shift is not equal to 0 > cat("\n3ps -s (Dictogloss 1 vs 2)\n") 3ps -s (Dictogloss 1 vs 2) > print(wilcox.test(ctrl$`3ps_D1_SUM`, ctrl$`3ps_D2_SUM`, paired = TRUE, exact = FALSE, correct = TRUE)) Wilcoxon signed rank test with continuity correction data: ctrl$`3ps_D1_SUM` and ctrl$`3ps_D2_SUM` V = 0, p-value = 0.09467 alternative hypothesis: true location shift is not equal to 0 > cat("\n==============================\nEXPERIMENTAL GROUP\n==============================\n") ============================== EXPERIMENTAL GROUP ============================== > cat("\nHE/SHE (Dictogloss 1 vs 2)\n") HE/SHE (Dictogloss 1 vs 2) > print(wilcox.test(exp$`HE/SHE_D1_SUM`, exp$`HE/SHE_D2_SUM`, paired = TRUE, exact = FALSE, correct = TRUE)) Wilcoxon signed rank test with continuity correction data: exp$`HE/SHE_D1_SUM` and exp$`HE/SHE_D2_SUM` V = 2, p-value = 1 alternative hypothesis: true location shift is not equal to 0 > cat("\n3ps -s (Dictogloss 1 vs 2)\n") 3ps -s (Dictogloss 1 vs 2) > print(wilcox.test(exp$`3ps_D1_SUM`, exp$`3ps_D2_SUM`, paired = TRUE, exact = FALSE, correct = TRUE)) Wilcoxon signed rank test with continuity correction data: exp$`3ps_D1_SUM` and exp$`3ps_D2_SUM` V = 10, p-value = 0.5716 alternative hypothesis: true location shift is not equal to 0 > cat("\nAll Wilcoxon signed-rank tests for Table 4 completed successfully.\n") All Wilcoxon signed-rank tests for Table 4 completed successfully. > sink() # Close output file