Tablet comparison script.

Set up some functions.

rm(list=ls())
library(xtable)
library(psych)
library(tidyr)
library(stringr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
## 
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
## 
##     %+%, alpha
library(bootstrap)
library(lme4)
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## The following object is masked from 'package:tidyr':
## 
##     expand
## for bootstrapping 95% confidence intervals
theta <- function(x,xdata,na.rm=T) {mean(xdata[x],na.rm=na.rm)}
ci.low <- function(x,na.rm=T) {
  mean(x,na.rm=na.rm) - quantile(bootstrap(1:length(x),1000,theta,x,na.rm=na.rm)$thetastar,.025,na.rm=na.rm)}
ci.high <- function(x,na.rm=T) {
  quantile(bootstrap(1:length(x),1000,theta,x,na.rm=na.rm)$thetastar,.975,na.rm=na.rm) - mean(x,na.rm=na.rm)}

Reading in experimental data

Demographics.

tab.demo <- read.csv("../data/tablet_demographics.csv")
tab.demo <- tab.demo %>% rename(subid = SID)

story.demo <- read.csv("../data/story_demographics.csv")
story.demo <- story.demo %>% rename(subid = SID)

et.demo <- read.csv("../data/et_demographics.csv")
et.demo <- et.demo %>% rename(subid = SID)

First read tablet.

tab <- read.csv("../data/tabletstudyresults.csv")
tab$reaction.time <- as.numeric(as.character(tab$reaction.time))
tab$trial.type <- factor(tab$trial.type, 
                         levels = c("rec","MEcontrol","MEexperimental","filler"),
                         labels = c("FAM-fam","FAM-nov","NOV-fam","filler"))

Then read storybook.

story <- read.csv("../data/storystudyresults.csv")
story <- story %>% 
  gather(trial, correct, ends_with(".Correct"), na.rm=FALSE) %>%
  select(-starts_with("X")) %>%
  mutate(trial = as.numeric(str_replace_all(str_replace(trial, "X", ""), ".Correct", "")))
lists <- read.csv("../data/lists.csv")

story <- left_join(story, lists, by=c("List","trial"))

story$trial.type <- factor(story$trial.type, 
                           levels = c("familiar-familiar","FAMILIAR-novel",
                                      "familiar-NOVEL","filler"),
                           labels = c("FAM-fam","FAM-nov","NOV-fam", "filler"))

Then read eye-tracking.

et <- read.csv("../eye_tracking/R/eye.tracking.csv", row.names="X")
et$trial.type <- factor(et$word.type, 
                        levels = c("Familiar-Familiar","Familiar-Novel",
                                   "Novel-Familiar"),
                        labels = c("FAM-fam","FAM-nov","NOV-fam"))

Merge these three together. This is quite ugly because of differing naming conventions across data files.

et <- et %>% 
  select(sid, whole.trial.num, trial.type, rt, prop) %>%
  rename(subid = sid, 
         trial.num = whole.trial.num,
         correct = prop)

et <- left_join(et, et.demo, by="subid")
## Warning in left_join_impl(x, y, by$x, by$y, suffix$x, suffix$y): joining
## factors with different levels, coercing to character vector
et$condition  <- "eye-tracker"
et$rt <- et$rt * 1000 # convert to ms

tab <- tab %>%
  mutate(correct = response=="Y") %>%
  select(subject.id, trial.number, trial.type, reaction.time, correct) %>%
  rename(subid = subject.id, 
         trial.num = trial.number, 
         rt = reaction.time)

tab <- left_join(tab, tab.demo)
## Joining, by = "subid"
## Warning in left_join_impl(x, y, by$x, by$y, suffix$x, suffix$y): joining
## factors with different levels, coercing to character vector
tab$condition  <- "tablet"

story <- story %>%
  select(SID, trial, trial.type, correct) %>%
  rename(subid = SID, 
         trial.num = trial)

story <- left_join(story, story.demo)
## Joining, by = "subid"
## Warning in left_join_impl(x, y, by$x, by$y, suffix$x, suffix$y): joining
## factors with different levels, coercing to character vector
story$condition <- "storybook"

d <- rbind_list(et, tab, story) %>%
  mutate(age.grp = floor(age))
## Warning: `rbind_list()` is deprecated. Please use `bind_rows()` instead.
## Warning in rbind_list__impl(environment()): Unequal factor levels: coercing
## to character

## Warning in rbind_list__impl(environment()): Unequal factor levels: coercing
## to character

## Warning in rbind_list__impl(environment()): Unequal factor levels: coercing
## to character

## Warning in rbind_list__impl(environment()): Unequal factor levels: coercing
## to character

## Warning in rbind_list__impl(environment()): Unequal factor levels: coercing
## to character

## Warning in rbind_list__impl(environment()): Unequal factor levels: coercing
## to character

## Warning in rbind_list__impl(environment()): Unequal factor levels: coercing
## to character

Demographics and filtering

Report function.

report <- function(x) {
  x %>%
    group_by(subid, condition, age.grp) %>%
    summarise(age = age[1],
              sex = sex[1]) %>% 
    group_by(condition, age.grp, add=FALSE) %>% 
    summarise(n=n(), 
              m.age = mean(age),
              m.male = mean(sex=="male"))
}

Filter for ages and filler trials.

d <- d %>% 
  filter(age.grp > 0, age.grp < 5, !is.na(age.grp))     
d <- d %>% filter(trial.type != "filler")

Non-inclusion criteria that don’t relate to methods.

d %>% group_by(subid, condition, exclusion.crit) %>%
  summarise(n = 1) %>%
  group_by(condition, exclusion.crit, add=FALSE) %>%
  summarise(n=sum(n)) 
## Source: local data frame [14 x 3]
## Groups: condition [?]
## 
##      condition exclusion.crit     n
##          <chr>          <chr> <dbl>
## 1  eye-tracker                   71
## 2  eye-tracker   interference     4
## 3  eye-tracker           lang    25
## 4    storybook                   73
## 5    storybook             dd     1
## 6    storybook   interference     4
## 7    storybook           lang    16
## 8    storybook  non-compliant     5
## 9       tablet                   86
## 10      tablet             dd     1
## 11      tablet          error     2
## 12      tablet   interference     4
## 13      tablet           lang     7
## 14      tablet  non-compliant     1
n <- d %>% 
  filter(exclusion.crit != "lang", 
         exclusion.crit != "dd")

Now, other exclusion criteria.

d %>% 
  group_by(subid, condition, exclusion.crit) %>%
  summarise(n = 1) %>%
  group_by(condition, exclusion.crit, add=FALSE) %>%
  summarise(n= sum(n)) %>%
  group_by(condition, add=FALSE) %>% 
  mutate(prop = n/ sum(n))
## Source: local data frame [14 x 4]
## Groups: condition [3]
## 
##      condition exclusion.crit     n       prop
##          <chr>          <chr> <dbl>      <dbl>
## 1  eye-tracker                   71 0.71000000
## 2  eye-tracker   interference     4 0.04000000
## 3  eye-tracker           lang    25 0.25000000
## 4    storybook                   73 0.73737374
## 5    storybook             dd     1 0.01010101
## 6    storybook   interference     4 0.04040404
## 7    storybook           lang    16 0.16161616
## 8    storybook  non-compliant     5 0.05050505
## 9       tablet                   86 0.85148515
## 10      tablet             dd     1 0.00990099
## 11      tablet          error     2 0.01980198
## 12      tablet   interference     4 0.03960396
## 13      tablet           lang     7 0.06930693
## 14      tablet  non-compliant     1 0.00990099
d <- d %>% 
  filter(exclude == 0)

xtable(report(d))
## % latex table generated in R 3.3.0 by xtable 1.8-2 package
## % Tue Sep  6 16:07:06 2016
## \begin{table}[ht]
## \centering
## \begin{tabular}{rlrrrr}
##   \hline
##  & condition & age.grp & n & m.age & m.male \\ 
##   \hline
## 1 & eye-tracker & 1.00 &  17 & 1.43 & 0.47 \\ 
##   2 & eye-tracker & 2.00 &  19 & 2.48 & 0.58 \\ 
##   3 & eye-tracker & 3.00 &  17 & 3.55 & 0.76 \\ 
##   4 & eye-tracker & 4.00 &  16 & 4.52 & 0.56 \\ 
##   5 & storybook & 1.00 &  15 & 1.62 & 0.60 \\ 
##   6 & storybook & 2.00 &  19 & 2.49 & 0.32 \\ 
##   7 & storybook & 3.00 &  19 & 3.48 & 0.53 \\ 
##   8 & storybook & 4.00 &  20 & 4.48 & 0.45 \\ 
##   9 & tablet & 1.00 &  18 & 1.71 & 0.44 \\ 
##   10 & tablet & 2.00 &  22 & 2.46 & 0.68 \\ 
##   11 & tablet & 3.00 &  24 & 3.56 & 0.67 \\ 
##   12 & tablet & 4.00 &  22 & 4.51 & 0.59 \\ 
##    \hline
## \end{tabular}
## \end{table}

Data-based exclusions

Did they finish?

qplot(trial.num, facets=~condition, data=d)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

mst <- d %>% group_by(subid, condition, age.grp) %>%
  summarise(max.trial = max(trial.num)) %>%
  group_by(condition, age.grp, add=FALSE) %>%
  summarise(finished = ifelse(condition[1]=="storybook", mean(max.trial==23), 
                              mean(max.trial==28)), 
            num.trials = mean(max.trial))

qplot(age.grp, finished, col=condition, 
      geom="line", stat="identity",
      position="dodge",
      data=mst)
## Warning: `stat` is deprecated
## Warning: `position` is deprecated

Reaction time pruning

Reaction time distribution. We also remove incorrect trials for the tablet, and target-initial trials for the eye-tracker.

d$rt[d$condition == "tablet" & !d$correct] <- NA # start by removing false trials
d$rt[d$condition == "eye-tracker" & d$rt < 317] <- NA # remove T initial trials

d %>% 
  group_by(condition) %>%
  summarise(m = mean(log(rt), na.rm=TRUE), 
            s = sd(log(rt), na.rm=TRUE))
## # A tibble: 3 x 3
##     condition        m         s
##         <chr>    <dbl>     <dbl>
## 1 eye-tracker 6.855382 0.5848310
## 2   storybook      NaN        NA
## 3      tablet 7.561642 0.6179562
qplot(rt/1000,
      data=filter(d, condition != "storybook")) + 
  facet_grid(.~condition) + 
  #   geom_vline(xintercept=exp(m - 2*s)/1000, col="red",lty=2) + 
  #   geom_vline(xintercept=exp(m + 2*s)/1000, col="red",lty=2) + 
  scale_x_log10(breaks=c(1,2,5,10,20,50))
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 722 rows containing non-finite values (stat_bin).

Age effects:

ggplot(d) + 
  geom_bar(aes(x = rt/1000, y=..count..)) +
  scale_x_log10(breaks=c(1,5,10,50)) +
  facet_grid(condition~age.grp)
## Warning: Removed 2182 rows containing non-finite values (stat_count).

Prune excessive reaction times. (Arbitrary threshold).

d$rt[d$rt > 4000 |
       d$rt < 500] <- NA

Actual analysis starts here

Aggregation.

mss <- d %>%
  group_by(subid, trial.type, age.grp, condition) %>%
  summarise(age=age[1],
            rt=mean(rt, na.rm=TRUE), 
            correct=mean(correct)) 

mss$trial.type <- factor(mss$trial.type, 
                         levels = c("FAM-fam","FAM-nov","NOV-fam"), 
                         labels=c("Familiar Word","ME Control","ME Inference"))

ms <- mss %>%
  group_by(trial.type, age.grp, condition, add=FALSE) %>%
  summarise(rt.cih=ci.high(rt),
            rt.cil=ci.low(rt),
            rt=mean(rt,na.rm=TRUE), 
            acc.cih=ci.high(correct),
            acc.cil=ci.low(correct),
            acc=mean(correct,na.rm=TRUE)) 

Accuracy as a barplot.

ggplot(ms, aes(x = age.grp, y = acc, fill=trial.type)) + 
  geom_bar(stat = "identity",
           position="dodge") + 
  geom_linerange(aes(ymin=acc-acc.cil, ymax=acc+acc.cih),
                 position=position_dodge(width=.9)) + 
  facet_grid(condition ~ .) + 
  xlab("Age (Years)") + 
  ylab("Accuracy") + 
  geom_hline(yintercept=.5,lty=2) + 
  scale_fill_discrete(name="Trial Type") 

Accuracy (continuous)

qplot(age, correct, col=trial.type, data=mss) + 
  facet_grid(. ~ condition) + 
  geom_smooth(method="lm", formula=y ~ boot::inv.logit(x)) + 
  geom_hline(yintercept=.5,lty=2) + 
  ylim(c(0,1.2))

and RT:

ggplot(filter(ms, condition != "storybook"), 
       aes(x = age.grp, y =rt/1000, fill=trial.type)) + 
  geom_bar(position=position_dodge(width=.9), 
           stat="identity") + 
  geom_linerange(aes(ymin=rt/1000-rt.cil/1000,
                     ymax=rt/1000+rt.cih/1000), 
                 position=position_dodge(width=.9)) + 
  xlab("Age (Years)") + 
  ylab("Reaction Time (s)") + 
  scale_fill_discrete(name="Trial Type") + 
  facet_grid(condition ~ . , scales="free_y") 

Number of trials

Nearly everyone sticks it out to the end!

mst <- d %>% 
  group_by(subid, age.grp, condition) %>%
  summarise(max.trial = max(trial.num))

qplot(max.trial, facets=condition~age.grp, data=mst)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

and means across groups.

mstm <-  mst %>% 
  group_by(age.grp, condition, add=FALSE) %>%
  summarise(trials = mean(max.trial), 
            trials.cih = ci.high(max.trial), 
            trials.cil = ci.low(max.trial))

ggplot(mstm, aes(x = age.grp, y =trials)) + 
  geom_bar(aes(fill=factor(age.grp)), 
           stat="identity",
           position=position_dodge(width=.9)) + 
  geom_linerange(aes(ymin=trials-trials.cil,
                     ymax=trials+trials.cih), 
                 position=position_dodge(width=.9)) + 
  facet_grid(.~condition) + 
  geom_hline(yintercept=28, lty=2)

Statistics

t-tests vs. chance.

Accuracies for eye-tracker.

t.test(mss$correct[mss$condition == "eye-tracker" & 
                     mss$trial.type == "Familiar Word" & 
                     mss$age.grp == 1] - .5)
## 
##  One Sample t-test
## 
## data:  mss$correct[mss$condition == "eye-tracker" & mss$trial.type ==     "Familiar Word" & mss$age.grp == 1] - 0.5
## t = 1.2337, df = 16, p-value = 0.2351
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  -0.03976846  0.15048986
## sample estimates:
## mean of x 
## 0.0553607
t.test(mss$correct[mss$condition == "eye-tracker" & 
                     mss$trial.type == "ME Control" & 
                     mss$age.grp == 1] - .5)
## 
##  One Sample t-test
## 
## data:  mss$correct[mss$condition == "eye-tracker" & mss$trial.type ==     "ME Control" & mss$age.grp == 1] - 0.5
## t = 4.4867, df = 12, p-value = 0.0007437
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  0.08842591 0.25538958
## sample estimates:
## mean of x 
## 0.1719077
t.test(mss$correct[mss$condition == "eye-tracker" & 
                     mss$trial.type == "ME Inference" & 
                     mss$age.grp == 1] - .5)
## 
##  One Sample t-test
## 
## data:  mss$correct[mss$condition == "eye-tracker" & mss$trial.type ==     "ME Inference" & mss$age.grp == 1] - 0.5
## t = 0.51624, df = 11, p-value = 0.6159
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  -0.06401885  0.10325235
## sample estimates:
##  mean of x 
## 0.01961675
t.test(mss$correct[mss$condition == "eye-tracker" & 
                     mss$trial.type == "ME Inference" & 
                     mss$age.grp == 2] - .5)
## 
##  One Sample t-test
## 
## data:  mss$correct[mss$condition == "eye-tracker" & mss$trial.type ==     "ME Inference" & mss$age.grp == 2] - 0.5
## t = 1.9766, df = 17, p-value = 0.06454
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  -0.005588977  0.171484150
## sample estimates:
##  mean of x 
## 0.08294759

Other accuracies.

t.test(mss$correct[mss$condition == "storybook" & 
                     mss$trial.type == "Familiar Word" & 
                     mss$age.grp == 1] - .5)
## 
##  One Sample t-test
## 
## data:  mss$correct[mss$condition == "storybook" & mss$trial.type ==     "Familiar Word" & mss$age.grp == 1] - 0.5
## t = 3.9561, df = 14, p-value = 0.001434
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  0.1024722 0.3451468
## sample estimates:
## mean of x 
## 0.2238095
t.test(mss$correct[mss$condition == "tablet" & 
                     mss$trial.type == "Familiar Word" & 
                     mss$age.grp == 1] - .5)
## 
##  One Sample t-test
## 
## data:  mss$correct[mss$condition == "tablet" & mss$trial.type == "Familiar Word" &     mss$age.grp == 1] - 0.5
## t = 2.5764, df = 17, p-value = 0.01961
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  0.03227744 0.32420404
## sample estimates:
## mean of x 
## 0.1782407
t.test(mss$correct[mss$condition == "tablet" & 
                     mss$trial.type == "ME Control" & 
                     mss$age.grp == 1] - .5)
## 
##  One Sample t-test
## 
## data:  mss$correct[mss$condition == "tablet" & mss$trial.type == "ME Control" &     mss$age.grp == 1] - 0.5
## t = 2.2316, df = 17, p-value = 0.03939
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  0.008170309 0.291168315
## sample estimates:
## mean of x 
## 0.1496693

Accuracy model.

acc.mod <- lmer(correct ~ age * trial.type * condition + 
                   (trial.type | subid), 
                 family="binomial",
                 data=filter(d, condition != "eye-tracker"))
## Warning in lmer(correct ~ age * trial.type * condition + (trial.type |
## subid), : calling lmer with 'family' is deprecated; please use glmer()
## instead
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge with max|grad| = 0.243542 (tol =
## 0.001, component 1)
summary(acc.mod)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: correct ~ age * trial.type * condition + (trial.type | subid)
##    Data: filter(d, condition != "eye-tracker")
## Control: 
## structure(list(optimizer = c("bobyqa", "Nelder_Mead"), calc.derivs = TRUE,  
##     use.last.params = FALSE, restart_edge = FALSE, boundary.tol = 1e-05,  
##     tolPwrss = 1e-07, compDev = TRUE, nAGQ0initStep = TRUE, checkControl = structure(list( 
##         check.nobs.vs.rankZ = "ignore", check.nobs.vs.nlev = "stop",  
##         check.nlev.gtreq.5 = "ignore", check.nlev.gtr.1 = "stop",  
##         check.nobs.vs.nRE = "stop", check.rankX = "message+drop.cols",  
##         check.scaleX = "warning", check.formula.LHS = "stop",  
##         check.response.not.const = "stop"), .Names = c("check.nobs.vs.rankZ",  
##     "check.nobs.vs.nlev", "check.nlev.gtreq.5", "check.nlev.gtr.1",  
##     "check.nobs.vs.nRE", "check.rankX", "check.scaleX", "check.formula.LHS",  
##     "check.response.not.const")), checkConv = structure(list( 
##         check.conv.grad = structure(list(action = "warning",  
##             tol = 0.001, relTol = NULL), .Names = c("action",  
##         "tol", "relTol")), check.conv.singular = structure(list( 
##             action = "ignore", tol = 1e-04), .Names = c("action",  
##         "tol")), check.conv.hess = structure(list(action = "warning",  
##             tol = 1e-06), .Names = c("action", "tol"))), .Names = c("check.conv.grad",  
##     "check.conv.singular", "check.conv.hess")), optCtrl = list()), .Names = c("optimizer",  
## "calc.derivs", "use.last.params", "restart_edge", "boundary.tol",  
## "tolPwrss", "compDev", "nAGQ0initStep", "checkControl", "checkConv",  
## "optCtrl"), class = c("glmerControl", "merControl"))
## 
##      AIC      BIC   logLik deviance df.resid 
##   1882.7   1993.1   -923.4   1846.7     3376 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -11.8794   0.0817   0.1561   0.2931   2.1647 
## 
## Random effects:
##  Groups Name              Variance Std.Dev. Corr       
##  subid  (Intercept)       1.2167   1.1031              
##         trial.typeFAM-nov 0.5661   0.7524    0.18      
##         trial.typeNOV-fam 0.1771   0.4208   -0.99 -0.35
## Number of obs: 3394, groups:  subid, 159
## 
## Fixed effects:
##                                       Estimate Std. Error z value Pr(>|z|)
## (Intercept)                            -0.1918     0.6837  -0.280  0.77911
## age                                     1.1733     0.2580   4.547 5.44e-06
## trial.typeFAM-nov                      -3.8573     0.9593  -4.021 5.80e-05
## trial.typeNOV-fam                      -1.3564     0.6808  -1.992  0.04632
## conditiontablet                        -0.4475     0.9523  -0.470  0.63840
## age:trial.typeFAM-nov                   1.3893     0.4242   3.275  0.00106
## age:trial.typeNOV-fam                   0.1374     0.2758   0.498  0.61823
## age:conditiontablet                     0.1326     0.3572   0.371  0.71045
## trial.typeFAM-nov:conditiontablet       3.3941     1.2377   2.742  0.00610
## trial.typeNOV-fam:conditiontablet       0.2555     0.9457   0.270  0.78700
## age:trial.typeFAM-nov:conditiontablet  -1.2359     0.5141  -2.404  0.01622
## age:trial.typeNOV-fam:conditiontablet  -0.3073     0.3736  -0.823  0.41079
##                                          
## (Intercept)                              
## age                                   ***
## trial.typeFAM-nov                     ***
## trial.typeNOV-fam                     *  
## conditiontablet                          
## age:trial.typeFAM-nov                 ** 
## age:trial.typeNOV-fam                    
## age:conditiontablet                      
## trial.typeFAM-nov:conditiontablet     ** 
## trial.typeNOV-fam:conditiontablet        
## age:trial.typeFAM-nov:conditiontablet *  
## age:trial.typeNOV-fam:conditiontablet    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) age    tr.FAM- tr.NOV- cndtnt ag:.FAM- ag:.NOV- ag:cnd
## age         -0.906                                                       
## trl.typFAM- -0.317  0.310                                                
## trl.typNOV- -0.722  0.675  0.342                                         
## conditntblt -0.714  0.654  0.225   0.513                                 
## ag:trl.FAM-  0.248 -0.324 -0.931  -0.274  -0.182                         
## ag:trl.NOV-  0.626 -0.733 -0.310  -0.903  -0.454  0.327                  
## ag:cndtntbl  0.664 -0.711 -0.230  -0.497  -0.934  0.228    0.519         
## trl.tyFAM-:  0.242 -0.244 -0.770  -0.261  -0.392  0.719    0.244    0.404
## trl.tyNOV-:  0.515 -0.490 -0.244  -0.716  -0.752  0.202    0.653    0.734
## ag:tr.FAM-: -0.212  0.261  0.755   0.234   0.356 -0.789   -0.264   -0.422
## ag:tr.NOV-: -0.471  0.530  0.236   0.679   0.693 -0.235   -0.724   -0.775
##             t.FAM-: t.NOV-: a:.FAM-:
## age                                 
## trl.typFAM-                         
## trl.typNOV-                         
## conditntblt                         
## ag:trl.FAM-                         
## ag:trl.NOV-                         
## ag:cndtntbl                         
## trl.tyFAM-:                         
## trl.tyNOV-:  0.412                  
## ag:tr.FAM-: -0.944  -0.377          
## ag:tr.NOV-: -0.401  -0.936   0.420  
## convergence code: 0
## Model failed to converge with max|grad| = 0.243542 (tol = 0.001, component 1)

RT models.

rt.mod <- lmer(log(rt) ~ age * trial.type * condition + 
                 (trial.type | subid), 
               data=filter(d, condition != "storybook"))
summary(rt.mod)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(rt) ~ age * trial.type * condition + (trial.type | subid)
##    Data: filter(d, condition != "storybook")
## 
## REML criterion at convergence: 1521.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8516 -0.6074 -0.0980  0.5213  3.8837 
## 
## Random effects:
##  Groups   Name              Variance  Std.Dev. Corr     
##  subid    (Intercept)       0.0189439 0.13764           
##           trial.typeFAM-nov 0.0005773 0.02403  0.73     
##           trial.typeNOV-fam 0.0165280 0.12856  0.17 0.80
##  Residual                   0.1064916 0.32633           
## Number of obs: 2048, groups:  subid, 153
## 
## Fixed effects:
##                                        Estimate Std. Error t value
## (Intercept)                            7.385535   0.087705   84.21
## age                                   -0.135068   0.026131   -5.17
## trial.typeFAM-nov                      0.008596   0.107699    0.08
## trial.typeNOV-fam                      0.069957   0.122063    0.57
## conditiontablet                        0.323953   0.113886    2.84
## age:trial.typeFAM-nov                 -0.003914   0.032139   -0.12
## age:trial.typeNOV-fam                 -0.008950   0.036132   -0.25
## age:conditiontablet                    0.030964   0.033510    0.92
## trial.typeFAM-nov:conditiontablet      0.075405   0.130686    0.58
## trial.typeNOV-fam:conditiontablet     -0.133566   0.154553   -0.86
## age:trial.typeFAM-nov:conditiontablet -0.028968   0.038376   -0.75
## age:trial.typeNOV-fam:conditiontablet  0.089003   0.044948    1.98
## 
## Correlation of Fixed Effects:
##             (Intr) age    tr.FAM- tr.NOV- cndtnt ag:.FAM- ag:.NOV- ag:cnd
## age         -0.939                                                       
## trl.typFAM- -0.534  0.493                                                
## trl.typNOV- -0.468  0.431  0.454                                         
## conditntblt -0.770  0.723  0.411   0.361                                 
## ag:trl.FAM-  0.493 -0.514 -0.941  -0.421  -0.380                         
## ag:trl.NOV-  0.435 -0.452 -0.425  -0.946  -0.335  0.444                  
## ag:cndtntbl  0.732 -0.780 -0.385  -0.336  -0.946  0.401    0.353         
## trl.tyFAM-:  0.440 -0.406 -0.824  -0.374  -0.500  0.775    0.350    0.466
## trl.tyNOV-:  0.370 -0.340 -0.358  -0.790  -0.422  0.333    0.747    0.391
## ag:tr.FAM-: -0.413  0.430  0.788   0.353   0.467 -0.837   -0.372   -0.484
## ag:tr.NOV-: -0.350  0.364  0.341   0.760   0.397 -0.357   -0.804   -0.409
##             t.FAM-: t.NOV-: a:.FAM-:
## age                                 
## trl.typFAM-                         
## trl.typNOV-                         
## conditntblt                         
## ag:trl.FAM-                         
## ag:trl.NOV-                         
## ag:cndtntbl                         
## trl.tyFAM-:                         
## trl.tyNOV-:  0.448                  
## ag:tr.FAM-: -0.947  -0.421          
## ag:tr.NOV-: -0.425  -0.952   0.443
et.rt.mod <- lmer(log(rt) ~ age * trial.type + 
                    (trial.type | subid), 
                  data=filter(d, condition == "eye-tracker"))
summary(et.rt.mod)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(rt) ~ age * trial.type + (trial.type | subid)
##    Data: filter(d, condition == "eye-tracker")
## 
## REML criterion at convergence: 668.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.3674 -0.6692 -0.1325  0.5546  3.0401 
## 
## Random effects:
##  Groups   Name              Variance Std.Dev. Corr       
##  subid    (Intercept)       0.02185  0.1478              
##           trial.typeFAM-nov 0.01515  0.1231    0.20      
##           trial.typeNOV-fam 0.03613  0.1901   -0.23  0.91
##  Residual                   0.17611  0.4197              
## Number of obs: 524, groups:  subid, 68
## 
## Fixed effects:
##                        Estimate Std. Error t value
## (Intercept)            7.384524   0.107729   68.55
## age                   -0.134633   0.031966   -4.21
## trial.typeFAM-nov      0.003722   0.145471    0.03
## trial.typeNOV-fam      0.044870   0.157934    0.28
## age:trial.typeFAM-nov -0.003417   0.043503   -0.08
## age:trial.typeNOV-fam -0.001021   0.046922   -0.02
## 
## Correlation of Fixed Effects:
##             (Intr) age    t.FAM- t.NOV- a:.FAM
## age         -0.939                            
## trl.typFAM- -0.538  0.499                     
## trl.typNOV- -0.571  0.532  0.526              
## ag:trl.FAM-  0.495 -0.518 -0.940 -0.491       
## ag:trl.NOV-  0.532 -0.561 -0.494 -0.945  0.520
tab.rt.mod <- lmer(log(rt) ~ age * trial.type + 
                     (trial.type | subid), 
                   data=filter(d, condition == "tablet"))
summary(tab.rt.mod)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(rt) ~ age * trial.type + (trial.type | subid)
##    Data: filter(d, condition == "tablet")
## 
## REML criterion at convergence: 731
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.3576 -0.6111 -0.0899  0.5615  3.3786 
## 
## Random effects:
##  Groups   Name              Variance  Std.Dev. Corr       
##  subid    (Intercept)       0.0154384 0.12425             
##           trial.typeFAM-nov 0.0006457 0.02541  -0.01      
##           trial.typeNOV-fam 0.0099593 0.09980   0.42 -0.91
##  Residual                   0.0832721 0.28857             
## Number of obs: 1524, groups:  subid, 85
## 
## Fixed effects:
##                       Estimate Std. Error t value
## (Intercept)            7.70014    0.06473  118.95
## age                   -0.10170    0.01871   -5.44
## trial.typeFAM-nov      0.10037    0.06566    1.53
## trial.typeNOV-fam     -0.05791    0.08108   -0.71
## age:trial.typeFAM-nov -0.03712    0.01861   -2.00
## age:trial.typeNOV-fam  0.07887    0.02282    3.46
## 
## Correlation of Fixed Effects:
##             (Intr) age    t.FAM- t.NOV- a:.FAM
## age         -0.957                            
## trl.typFAM- -0.498  0.470                     
## trl.typNOV- -0.280  0.260  0.335              
## ag:trl.FAM-  0.479 -0.489 -0.962 -0.321       
## ag:trl.NOV-  0.267 -0.265 -0.323 -0.963  0.334

–> –>

–>

–> –> –> –> –> –> –> –> –> –>

–> –>

–> –> –> –> –> –>

–> –> –> –> –> –> –>

–>

–>

–> –> –>

–> –> –> –> –> –> –> –> –> –> –> –>

–> –> –> –>

–> –>

–> –> –> –> –>

–> –> –> –> –> –> –> –>

–> –> –> –> –> –> –> –>

–> –> –> –> –> –> –> –> –> –>

–> –> –> –> –> –> –> –> –> –> –> –> –>

–> –>

–> –> –> –> –> –> –> –> –> –> –> –> –> –> –> –> –> –>

–>

–> –> –> –> –> –> –> –> –> –> –> –>

–> –>

–> –> –> –> –> –> –> –> –> –> –> –> –> –>

–> –> –> –> –> –> –> –> –> –> –>