> # ============================================================ > # Pre-task_Grammar_Instruction_LREs_Young_Learners – Table 7 > # Pearson correlations between MLAT-ES scores and week-to-week LRE gains > # ============================================================ > library(readxl) > library(dplyr) > # ---- 1. Import all sheets ---- > d1 <- read_excel("C:/Users/dmard/Documents/PTGI_LRE_repro_package/data/PTGI_LRE_data_1.xlsx", + sheet = "Dict. 1") > d2 <- read_excel("C:/Users/dmard/Documents/PTGI_LRE_repro_package/data/PTGI_LRE_data_1.xlsx", + sheet = "Dict. 2") > datos <- read_excel("C:/Users/dmard/Documents/PTGI_LRE_repro_package/data/PTGI_LRE_data_1.xlsx", + sheet = "D1+D2+IDs") > # ---- 2. Combine 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" + ) %>% + left_join( + datos %>% select(Code, MLAT_Q) %>% + mutate(MLAT_Q = as.numeric(gsub(",", ".", MLAT_Q))), + by = "Code" + ) > # ---- 3. Compute gains ---- > combined <- combined %>% + mutate( + HE_SHE_Gain = `HE/SHE_D2_SUM` - `HE/SHE_D1_SUM`, + X3ps_Gain = `3ps_D2_SUM` - `3ps_D1_SUM` + ) > # ---- 4. Split by group ---- > ctrl <- subset(combined, Group == "Control") > exp <- subset(combined, Group == "Experimental") > # ---- 5. Pearson correlations ---- > cat("\n--- CONTROL GROUP ---\n") --- CONTROL GROUP --- > print(cor.test(ctrl$MLAT_Q, ctrl$HE_SHE_Gain, method = "pearson")) Pearson's product-moment correlation data: ctrl$MLAT_Q and ctrl$HE_SHE_Gain t = -1.1567, df = 3, p-value = 0.3311 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.9648653 0.6409667 sample estimates: cor -0.5553547 > print(cor.test(ctrl$MLAT_Q, ctrl$X3ps_Gain, method = "pearson")) Pearson's product-moment correlation data: ctrl$MLAT_Q and ctrl$X3ps_Gain t = 0.04, df = 3, p-value = 0.9706 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.8770436 0.8872807 sample estimates: cor 0.02308785 > cat("\n--- EXPERIMENTAL GROUP ---\n") --- EXPERIMENTAL GROUP --- > print(cor.test(exp$MLAT_Q, exp$HE_SHE_Gain, method = "pearson")) Pearson's product-moment correlation data: exp$MLAT_Q and exp$HE_SHE_Gain t = 1.236, df = 3, p-value = 0.3044 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.6182274 0.9673743 sample estimates: cor 0.5808689 > print(cor.test(exp$MLAT_Q, exp$X3ps_Gain, method = "pearson")) Pearson's product-moment correlation data: exp$MLAT_Q and exp$X3ps_Gain t = -0.3329, df = 3, p-value = 0.7611 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.9181222 0.8320833 sample estimates: cor -0.1887431