#R-Code based on data collected and analysed for MA Thesis by Nina Selina Mueller, January 2020, University of Fribourg (CH)
#abbreviated code for the article

#Code organized by:
###Import and organize data
###Initial differences
###Improvement by treatment and Yes/No test
###Linear mixed effect regression model

library("tidyverse")
## -- Attaching packages ----------------------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.2     v purrr   0.3.4
## v tibble  3.0.3     v dplyr   1.0.1
## v tidyr   1.1.1     v stringr 1.4.0
## v readr   1.3.1     v forcats 0.5.0
## -- Conflicts -------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library("ggplot2")
library("lme4")
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack
library("lmerTest")
## 
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
## 
##     lmer
## The following object is masked from 'package:stats':
## 
##     step
###################### IMPORT AND ORGANIZE DATA ########################

data <- read.csv("dataMueller2020.csv") #complete data
summary(data)
##       ID               Class              Group              wnw_istd     
##  Length:260         Length:260         Length:260         Min.   :0.0000  
##  Class :character   Class :character   Class :character   1st Qu.:0.2575  
##  Mode  :character   Mode  :character   Mode  :character   Median :0.4300  
##                                                           Mean   :0.4158  
##                                                           3rd Qu.:0.5700  
##                                                           Max.   :0.9300  
##                                                                           
##     tasks_n        evaluation       T1cogtsz        T1cogpf        T1cogdth    
##  Min.   :0.000   Min.   :0.250   Min.   :0.000   Min.   :0.00   Min.   :0.000  
##  1st Qu.:2.000   1st Qu.:1.750   1st Qu.:1.000   1st Qu.:2.00   1st Qu.:2.000  
##  Median :3.000   Median :2.250   Median :2.000   Median :3.00   Median :4.000  
##  Mean   :3.125   Mean   :2.133   Mean   :2.446   Mean   :2.55   Mean   :3.454  
##  3rd Qu.:4.000   3rd Qu.:2.500   3rd Qu.:3.000   3rd Qu.:3.00   3rd Qu.:5.000  
##  Max.   :7.000   Max.   :3.000   Max.   :6.000   Max.   :4.00   Max.   :7.000  
##  NA's   :140     NA's   :140                                                   
##     T1cogck         T1cogkch        T1noncog        T1total     
##  Min.   :0.000   Min.   :0.000   Min.   :0.000   Min.   : 3.00  
##  1st Qu.:2.000   1st Qu.:1.000   1st Qu.:1.000   1st Qu.:11.00  
##  Median :3.000   Median :1.000   Median :2.000   Median :15.50  
##  Mean   :3.035   Mean   :1.196   Mean   :2.523   Mean   :15.20  
##  3rd Qu.:4.000   3rd Qu.:2.000   3rd Qu.:4.000   3rd Qu.:19.25  
##  Max.   :5.000   Max.   :2.000   Max.   :6.000   Max.   :30.00  
##                                                                 
##      T1cog          T2cogtsz        T2cogpf         T2cogdth        T2cogck    
##  Min.   : 2.00   Min.   :0.000   Min.   :0.000   Min.   :0.000   Min.   :0.00  
##  1st Qu.: 9.00   1st Qu.:2.000   1st Qu.:2.000   1st Qu.:2.000   1st Qu.:3.00  
##  Median :13.00   Median :4.000   Median :3.000   Median :3.000   Median :4.00  
##  Mean   :12.68   Mean   :3.469   Mean   :2.681   Mean   :3.454   Mean   :3.45  
##  3rd Qu.:16.00   3rd Qu.:5.000   3rd Qu.:4.000   3rd Qu.:5.000   3rd Qu.:5.00  
##  Max.   :24.00   Max.   :6.000   Max.   :4.000   Max.   :7.000   Max.   :5.00  
##                                                                                
##     T2cogkch        T2noncog        T2total          T2cog      
##  Min.   :0.000   Min.   :0.000   Min.   : 0.00   Min.   : 0.00  
##  1st Qu.:1.000   1st Qu.:1.000   1st Qu.:13.00   1st Qu.:11.00  
##  Median :2.000   Median :3.000   Median :18.00   Median :15.00  
##  Mean   :1.365   Mean   :2.538   Mean   :16.96   Mean   :14.42  
##  3rd Qu.:2.000   3rd Qu.:4.000   3rd Qu.:22.00   3rd Qu.:19.00  
##  Max.   :2.000   Max.   :6.000   Max.   :29.00   Max.   :24.00  
##                                                                 
##     T3cogtsz        T3cogpf         T3cogdth        T3cogck     
##  Min.   :0.000   Min.   :0.000   Min.   :0.000   Min.   :0.000  
##  1st Qu.:2.000   1st Qu.:1.000   1st Qu.:2.000   1st Qu.:1.000  
##  Median :3.000   Median :2.000   Median :3.000   Median :3.000  
##  Mean   :2.973   Mean   :2.131   Mean   :2.942   Mean   :2.685  
##  3rd Qu.:4.000   3rd Qu.:3.000   3rd Qu.:4.000   3rd Qu.:4.000  
##  Max.   :6.000   Max.   :4.000   Max.   :7.000   Max.   :5.000  
##                                                                 
##     T3cogkch         T3noncog        T3total          T3cog      
##  Min.   :0.0000   Min.   :0.000   Min.   : 0.00   Min.   : 0.00  
##  1st Qu.:0.0000   1st Qu.:1.000   1st Qu.:10.00   1st Qu.: 8.00  
##  Median :1.0000   Median :2.000   Median :14.00   Median :12.00  
##  Mean   :0.9923   Mean   :2.362   Mean   :14.08   Mean   :11.72  
##  3rd Qu.:2.0000   3rd Qu.:3.000   3rd Qu.:18.00   3rd Qu.:15.00  
##  Max.   :2.0000   Max.   :6.000   Max.   :29.00   Max.   :24.00  
## 
#wnw_istd = Index of Signal Detection, Yes/No vocabulary test 1 Level 1 (Meara 1992)
#tasks_n / evaluation = feedback of intervention group on number of tasks completed and pleasantness/usefulness/novelty
#T1/T2/T3 = pre-/post-/delayed post-test vocabulary learning activity, cog = cognates

#Improvement from T1 to T2 and T3 and overall score on vocabulary learning activities
data$T2T1cog <- data$T2cog - data$T1cog #improvement on cognates from T1 to T2
data$T3T1cog <- data$T3cog - data$T1cog #improvement on cognates from T1 to T3
data$overall <- data$T1total + data$T2total + data$T3total #overall performance across three tests on all items
data$cognates <- data$T1cog + data$T2cog + data$T3cog #overall performance across three tests on cognates

#Improvement from T1 to T2 on cognates by correspondence
data$T2T1tsz <- (data$T2cogtsz - data$T1cogtsz)/6
data$T2T1pf <- (data$T2cogpf - data$T1cogpf)/4
data$T2T1thdt <- (data$T2cogdth - data$T1cogdth)/7
data$T2T1ck <- (data$T2cogck - data$T1cogck)/5
data$T2T1kch <- (data$T2cogkch - data$T1cogkch)/2

#Improvement from T1 to T3 on cognates by correspondence
data$T3T1tsz <- (data$T3cogtsz - data$T1cogtsz)/6
data$T3T1pf <- (data$T3cogpf - data$T1cogpf)/4
data$T3T1thdt <- (data$T3cogdth - data$T1cogdth)/7
data$T3T1ck <- (data$T3cogck - data$T1cogck)/5
data$T3T1kch <- (data$T3cogkch - data$T1cogkch)/2

#sum-code treatment groups and center Yes/No test
data$n.Group <- ifelse(data$Group == "intervention", 1, 0)
data$c.wnw_istd <- data$wnw_istd - mean(data$wnw_istd, na.rm = TRUE)

#Create subset intervention group only
dataint <- subset(data,n.Group==1)



######################### INITIAL DIFFERENCES ###############################

#Boxplots T1 by treatment (vocabulary learning activity and yes-no test) 
yesnotreatment <- ggplot(data = data, 
                         aes(x = Group, 
                             y = (wnw_istd), color = Group)) +
  scale_color_grey(start=0.6, end=0.1) +
  theme_classic() +
  geom_boxplot() + 
  geom_point(position = position_jitter(width = 0.4,
                                        height = 0.0),
             shape = 1) +
  xlab("Treatment group") + 
  ylab("Performance") + 
  theme_bw() +
  ggtitle("Yes/No test",
          sub = "initial vocabulary knowledge")

T1cogtreatment <- ggplot(data = data, 
                         aes(x = Group, 
                             y = (T1cog), color = Group)) +
  scale_color_grey(start=0.6, end=0.1) +
  theme_classic() +
  geom_boxplot() + 
  geom_point(position = position_jitter(width = 0.4,
                                        height = 0.0),
             shape = 1) +
  xlab("Treatment group") + 
  ylab("Performance") + 
  theme_bw() +
  ggtitle("Performance on cognates",
          sub ="Vocabulary learning activity T1") 

# Group initial differences between treatment groups
t.test(data$T1total~data$Group)
## 
##  Welch Two Sample t-test
## 
## data:  data$T1total by data$Group
## t = 1.7762, df = 257.99, p-value = 0.07687
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.1319172  2.5604886
## sample estimates:
##      mean in group control mean in group intervention 
##                   15.76429                   14.55000
t.test(data$T1cog~data$Group)
## 
##  Welch Two Sample t-test
## 
## data:  data$T1cog by data$Group
## t = 1.6756, df = 256.23, p-value = 0.09503
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.1618784  2.0094975
## sample estimates:
##      mean in group control mean in group intervention 
##                   13.10714                   12.18333
t.test(data$wnw_istd~data$Group)
## 
##  Welch Two Sample t-test
## 
## data:  data$wnw_istd by data$Group
## t = 0.25019, df = 257.21, p-value = 0.8026
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.04858794  0.06273079
## sample estimates:
##      mean in group control mean in group intervention 
##                  0.4190714                  0.4120000
################## IMPROVEMENT BY TREATMENT AND YES/NO TEST  #######################

# Boxplots improvement on cognates by treatment
impbytreat1 <- ggplot(data = data, 
                      aes(x = Group, 
                          y = T2T1cog)) +
  geom_boxplot() + 
  geom_point(position = position_jitter(width = 0.4,
                                        height = 0.0),
             shape = 1) +
  xlab("Treatment group") + 
  ylab("Improvement T2-T1") + 
  theme_bw() +
  ggtitle("Improvement on cognates T2-T1", 
          sub = "by treatment group") 

impbytreat2 <- ggplot(data = data, 
                      aes(x = Group, 
                          y = (T3T1cog))) +
  geom_boxplot() + 
  geom_point(position = position_jitter(width = 0.4,
                                        height = 0.0),
             shape = 1) +
  xlab("Treatment group") + 
  ylab("Improvement T3-T1") + 
  theme_bw() + 
  ggtitle("Improvement on cognates T3-T1", 
          sub = "by treatment group") 

ggsave(file = "impbytreat1.eps", plot=impbytreat1, width = 3.10, height= 4.14)
ggsave(file = "impbytreat2.eps", plot=impbytreat2, width = 3.10, height= 4.14)


#Boxplots Improvement by class grey scales
T2T1byclass <- ggplot(data = data, 
                      aes(x = fct_reorder(Class,(T2T1cog)), 
                          y = (T2T1cog), color = Group),
                      outlier.shape = NA) +
  scale_color_grey(start=0.6, end=0.1) +
  theme_classic() +
  geom_boxplot() + 
  geom_point(position = position_jitter(width = 0.4,
                                        height = 0.0),
             shape = 1) +
  xlab("Class") + 
  ylab("Improvement T2-T1") + 
  theme_bw() +
  ggtitle("Improvement on cognates from T1 to T2",
          sub = "by class") 

T3T1byclass <- ggplot(data = data, 
                      aes(x = fct_reorder(Class,(T3T1cog)), 
                          y = (T3T1cog), color = Group)) +
  scale_color_grey(start=0.6, end=0.1) +
  theme_classic() +
  geom_boxplot() + 
  geom_point(position = position_jitter(width = 0.4,
                                        height = 0.0),
             shape = 1) +
  xlab("Class") + 
  ylab("Improvement T3-T1") + 
  theme_bw() +
  ggtitle("Improvement on cognates from T1 to T3", 
          sub = "by class") 

ggsave(file = "T2T1byclass.eps", plot=T2T1byclass, width = 6.21, height= 3.55)
ggsave(file = "T3T1byclass.eps", plot=T3T1byclass, width = 6.21, height= 3.55)

#Linear Regression Model
summary(lmer(T2T1cog~n.Group*c.wnw_istd+(1|Class), data=data))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: T2T1cog ~ n.Group * c.wnw_istd + (1 | Class)
##    Data: data
## 
## REML criterion at convergence: 1393.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0124 -0.5442 -0.0443  0.6086  4.0713 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  Class    (Intercept)  0.289   0.5376  
##  Residual             12.625   3.5531  
## Number of obs: 260, groups:  Class, 17
## 
## Fixed effects:
##                    Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)          0.6811     0.3493  14.7805   1.950 0.070416 .  
## n.Group              2.3529     0.5190  13.0494   4.533 0.000557 ***
## c.wnw_istd           1.0010     1.2699 255.0962   0.788 0.431278    
## n.Group:c.wnw_istd  -1.2440     1.9835 255.9789  -0.627 0.531094    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) n.Grop c.wnw_
## n.Group     -0.673              
## c.wnw_istd  -0.001  0.001       
## n.Grp:c.wn_  0.001  0.012 -0.640
summary(lmer(T3T1cog~n.Group*c.wnw_istd+(1|Class), data=data))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: T3T1cog ~ n.Group * c.wnw_istd + (1 | Class)
##    Data: data
## 
## REML criterion at convergence: 1407.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.2065 -0.5702 -0.0141  0.6526  2.2211 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  Class    (Intercept)  1.07    1.034   
##  Residual             12.93    3.595   
## Number of obs: 260, groups:  Class, 17
## 
## Fixed effects:
##                    Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)         -2.0608     0.4538  15.4340  -4.541 0.000364 ***
## n.Group              2.4782     0.6846  13.9096   3.620 0.002812 ** 
## c.wnw_istd          -0.9346     1.2964 251.5793  -0.721 0.471635    
## n.Group:c.wnw_istd  -1.4201     2.0307 253.4828  -0.699 0.484972    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) n.Grop c.wnw_
## n.Group     -0.663              
## c.wnw_istd   0.009 -0.006       
## n.Grp:c.wn_ -0.006  0.017 -0.638
################## IMPROVEMENT BY TYPE OF CORRESPONDENCE #######################

#Improvement by class per correspondence rule
imp_cog_rule <- data %>% 
  group_by(Class, Group, n.Group) %>% 
  summarise(
    mean_T2T1_ck = mean(T2T1ck), mean_T3T1_ck = mean(T3T1ck),
    mean_T2T1_pf = mean(T2T1pf), mean_T3T1_pf = mean(T3T1pf),
    mean_T2T1_thdt = mean(T2T1thdt), mean_T3T1_thdt = mean(T3T1thdt),
    mean_T2T1_tsz = mean(T2T1tsz), mean_T3T1_tsz = mean(T3T1tsz),
    mean_T2T1_kch = mean(T2T1kch), mean_T3T1_kch = mean(T3T1kch),
    .groups = "drop"
  )

#rearrange data
imp_cog <- imp_cog_rule %>%
  pivot_longer(cols = starts_with("mean"),
  names_to = c("time", "rule"),
  names_pattern = "mean_(.*)_(.*)",
  values_to = "mean",
  values_drop_na = TRUE)
imp_cog$rule <- factor(imp_cog$rule,
                            levels=c("ck", "pf", "thdt", "tsz", "kch"))

#boxplot
imp_correspondence <- ggplot(data = imp_cog,
       aes(x = Group, 
           y = (mean))) +
  ylim(c(-0.4, +0.4)) +
  theme_classic() +
  geom_boxplot() + 
  geom_point(position = position_jitter(width = 0.1,
                                        height = 0.0),
             shape = 1) +
  facet_grid(time~rule) +
  xlab("Treatment group") + 
  ylab("Progress") + 
  theme_bw() +
  ggtitle("Improvement by type of correspondence",
          sub = "by treatment (M per class) and test time")

#Linear Mixed-Effect Regression Models T2-T1
summary(lmer(T2T1ck~n.Group+(1|Class), data=data))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: T2T1ck ~ n.Group + (1 | Class)
##    Data: data
## 
## REML criterion at convergence: 52.2
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.55632 -0.61851 -0.01167  0.62805  2.47739 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  Class    (Intercept) 0.002593 0.05092 
##  Residual             0.067223 0.25927 
## Number of obs: 260, groups:  Class, 17
## 
## Fixed effects:
##             Estimate Std. Error       df t value Pr(>|t|)  
## (Intercept)  0.04323    0.02760 16.66389   1.566   0.1361  
## n.Group      0.08342    0.04122 14.77796   2.024   0.0615 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##         (Intr)
## n.Group -0.670
summary(lmer(T2T1pf~n.Group+(1|Class), data=data))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: T2T1pf ~ n.Group + (1 | Class)
##    Data: data
## 
## REML criterion at convergence: 116.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1387 -0.6612  0.1423  0.8217  2.7558 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  Class    (Intercept) 0.004715 0.06867 
##  Residual             0.085648 0.29266 
## Number of obs: 260, groups:  Class, 17
## 
## Fixed effects:
##             Estimate Std. Error       df t value Pr(>|t|)   
## (Intercept) -0.03923    0.03345 15.47588  -1.173  0.25855   
## n.Group      0.16731    0.05017 13.79543   3.335  0.00499 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##         (Intr)
## n.Group -0.667
summary(lmer(T2T1thdt~n.Group+(1|Class), data=data))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: T2T1thdt ~ n.Group + (1 | Class)
##    Data: data
## 
## REML criterion at convergence: -16.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.6327 -0.7248 -0.0572  0.6722  3.2101 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  Class    (Intercept) 0.002727 0.05222 
##  Residual             0.051199 0.22627 
## Number of obs: 260, groups:  Class, 17
## 
## Fixed effects:
##             Estimate Std. Error       df t value Pr(>|t|)  
## (Intercept) -0.03500    0.02567 16.58268  -1.363   0.1910  
## n.Group      0.08515    0.03849 14.77952   2.212   0.0431 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##         (Intr)
## n.Group -0.667
summary(lmer(T2T1tsz~n.Group+(1|Class), data=data))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: T2T1tsz ~ n.Group + (1 | Class)
##    Data: data
## 
## REML criterion at convergence: 31.4
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -3.12462 -0.55625  0.08973  0.77913  2.75051 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  Class    (Intercept) 0.00116  0.03407 
##  Residual             0.06278  0.25055 
## Number of obs: 260, groups:  Class, 17
## 
## Fixed effects:
##             Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)  0.12687    0.02402 13.97110   5.283 0.000116 ***
## n.Group      0.09554    0.03563 12.33509   2.682 0.019569 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##         (Intr)
## n.Group -0.674
summary(lmer(T2T1kch~n.Group+(1|Class), data=data))
## boundary (singular) fit: see ?isSingular
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: T2T1kch ~ n.Group + (1 | Class)
##    Data: data
## 
## REML criterion at convergence: 267.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.7798 -0.2717 -0.1612  0.9823  2.3469 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  Class    (Intercept) 0.000    0.0000  
##  Residual             0.159    0.3987  
## Number of obs: 260, groups:  Class, 17
## 
## Fixed effects:
##              Estimate Std. Error        df t value Pr(>|t|)  
## (Intercept)   0.06429    0.03370 258.00000   1.908   0.0575 .
## n.Group       0.04405    0.04960 258.00000   0.888   0.3753  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##         (Intr)
## n.Group -0.679
## convergence code: 0
## boundary (singular) fit: see ?isSingular
#Linear Mixed-Effect Regression Models T3-T1
summary(lmer(T3T1ck~n.Group+(1|Class), data=data))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: T3T1ck ~ n.Group + (1 | Class)
##    Data: data
## 
## REML criterion at convergence: 96.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.3353 -0.7768 -0.0743  0.5978  3.7003 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  Class    (Intercept) 0.004499 0.06708 
##  Residual             0.079179 0.28139 
## Number of obs: 260, groups:  Class, 17
## 
## Fixed effects:
##             Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept) -0.13151    0.03239 17.02798  -4.061 0.000811 ***
## n.Group      0.12598    0.04859 15.19965   2.593 0.020236 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##         (Intr)
## n.Group -0.666
summary(lmer(T3T1pf~n.Group+(1|Class), data=data))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: T3T1pf ~ n.Group + (1 | Class)
##    Data: data
## 
## REML criterion at convergence: 108
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.6113 -0.5759 -0.1241  0.6094  2.6216 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  Class    (Intercept) 0.005911 0.07688 
##  Residual             0.082169 0.28665 
## Number of obs: 260, groups:  Class, 17
## 
## Fixed effects:
##             Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept) -0.18877    0.03489 14.16051  -5.410 8.83e-05 ***
## n.Group      0.18559    0.05252 12.69758   3.534  0.00379 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##         (Intr)
## n.Group -0.664
summary(lmer(T3T1thdt~n.Group+(1|Class), data=data))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: T3T1thdt ~ n.Group + (1 | Class)
##    Data: data
## 
## REML criterion at convergence: -28.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.4746 -0.6189  0.0357  0.6578  3.2892 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  Class    (Intercept) 0.005836 0.07639 
##  Residual             0.047625 0.21823 
## Number of obs: 260, groups:  Class, 17
## 
## Fixed effects:
##             Estimate Std. Error       df t value Pr(>|t|)  
## (Intercept) -0.08927    0.03086 15.65601  -2.892   0.0108 *
## n.Group      0.04601    0.04682 14.29743   0.983   0.3421  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##         (Intr)
## n.Group -0.659
summary(lmer(T3T1tsz~n.Group+(1|Class), data=data))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: T3T1tsz ~ n.Group + (1 | Class)
##    Data: data
## 
## REML criterion at convergence: 22.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5628 -0.5718  0.1340  0.7291  2.3325 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  Class    (Intercept) 0.005279 0.07266 
##  Residual             0.058498 0.24186 
## Number of obs: 260, groups:  Class, 17
## 
## Fixed effects:
##             Estimate Std. Error       df t value Pr(>|t|)  
## (Intercept)  0.03516    0.03126 15.59927   1.125   0.2776  
## n.Group      0.12054    0.04720 14.09217   2.554   0.0229 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##         (Intr)
## n.Group -0.662
summary(lmer(T3T1kch~n.Group+(1|Class), data=data))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: T3T1kch ~ n.Group + (1 | Class)
##    Data: data
## 
## REML criterion at convergence: 301.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.1770 -0.8667  0.1905  0.3214  2.7177 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  Class    (Intercept) 0.006008 0.07751 
##  Residual             0.177095 0.42083 
## Number of obs: 260, groups:  Class, 17
## 
## Fixed effects:
##             Estimate Std. Error       df t value Pr(>|t|)  
## (Intercept) -0.10969    0.04382 13.48376  -2.503   0.0259 *
## n.Group      0.02603    0.06534 11.92433   0.398   0.6974  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##         (Intr)
## n.Group -0.671
###################### ATTITUDE #############################
cor.test(dataint$evaluation, dataint$T2T1cog) #attitude towards intervention with progress
## 
##  Pearson's product-moment correlation
## 
## data:  dataint$evaluation and dataint$T2T1cog
## t = -0.32121, df = 118, p-value = 0.7486
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2076975  0.1504820
## sample estimates:
##         cor 
## -0.02955654
cor.test(dataint$evaluation, dataint$T3T1cog)
## 
##  Pearson's product-moment correlation
## 
## data:  dataint$evaluation and dataint$T3T1cog
## t = 0.60729, df = 118, p-value = 0.5448
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1246704  0.2327311
## sample estimates:
##        cor 
## 0.05581825
cor.test(dataint$tasks_n, dataint$T2T1cog) #number of tasks completed with progress
## 
##  Pearson's product-moment correlation
## 
## data:  dataint$tasks_n and dataint$T2T1cog
## t = -0.4975, df = 118, p-value = 0.6198
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2231619  0.1345945
## sample estimates:
##         cor 
## -0.04575058
cor.test(dataint$tasks_n, dataint$T3T1cog)
## 
##  Pearson's product-moment correlation
## 
## data:  dataint$tasks_n and dataint$T3T1cog
## t = -0.23777, df = 118, p-value = 0.8125
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2003388  0.1579777
## sample estimates:
##         cor 
## -0.02188329