ME_DATA_PATH <- here("data/0_metaanalysis_data.csv")
ma_raw <- read_csv(ME_DATA_PATH) %>%
  select(1:4, 6:8, 10:16, 18,19,21, 27:29, 31:34, 48:50, 59) %>%
  mutate_if(is.character, as.factor)

AVG_MONTH <- 30.43688
ma_c <- ma_raw %>%
  filter(!is.na(d_calc)) %>%
  mutate(mean_age = mean_age_1/AVG_MONTH,
         year = as.numeric(str_sub(short_cite, -5, -2)),
         condition_type = as.factor(ifelse(infant_type == "typical" & ME_trial_type == "FN", "TFN", 
                                 ifelse(infant_type == "typical" & ME_trial_type == "NN", "TNN", 
                                        as.character(infant_type))))) %>%
  filter(mean_age < 144)   

multilingual data

test_data <- filter(ma_c, infant_type == "multilingual")  %>%
  select(2,8,9,10,11,12,13, 26, 27, 29)
DT::datatable(test_data)

No grouping by infant

model1 <- rma.mv(d_calc ~ mean_age, V = d_var_calc,
                      random = ~ 1 | short_cite,
                      method = "REML",
                      data = test_data)

summary(model1)
## 
## Multivariate Meta-Analysis Model (k = 12; method: REML)
## 
##   logLik  Deviance       AIC       BIC      AICc  
##  -5.3870   10.7740   16.7740   17.6818   20.7740  
## 
## Variance Components: 
## 
##             estim    sqrt  nlvls  fixed      factor
## sigma^2    0.4922  0.7016      6     no  short_cite
## 
## Test for Residual Heterogeneity: 
## QE(df = 10) = 65.1730, p-val < .0001
## 
## Test of Moderators (coefficient(s) 2): 
## QM(df = 1) = 3.1439, p-val = 0.0762
## 
## Model Results:
## 
##           estimate      se    zval    pval    ci.lb   ci.ub   
## intrcpt     0.0452  0.4200  0.1077  0.9142  -0.7779  0.8684   
## mean_age    0.0155  0.0088  1.7731  0.0762  -0.0016  0.0327  .
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Grouping by infant

model2 <- rma.mv(d_calc ~ mean_age, V = d_var_calc,
                      random = ~ 1 | same_infant/short_cite,
                      method = "REML",
                      data = test_data)
summary(model2)
## 
## Multivariate Meta-Analysis Model (k = 12; method: REML)
## 
##   logLik  Deviance       AIC       BIC      AICc  
## -10.5686   21.1372   29.1372   30.3475   37.1372  
## 
## Variance Components: 
## 
##             estim    sqrt  nlvls  fixed                  factor
## sigma^2.1  0.2024  0.4499     12     no             same_infant
## sigma^2.2  0.2024  0.4499     12     no  same_infant/short_cite
## 
## Test for Residual Heterogeneity: 
## QE(df = 10) = 65.1730, p-val < .0001
## 
## Test of Moderators (coefficient(s) 2): 
## QM(df = 1) = 3.9434, p-val = 0.0471
## 
## Model Results:
## 
##           estimate      se     zval    pval    ci.lb   ci.ub   
## intrcpt    -0.1068  0.4387  -0.2435  0.8076  -0.9667  0.7531   
## mean_age    0.0192  0.0097   1.9858  0.0471   0.0002  0.0381  *
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1