Data processing, plotting, and analysis script for SOL PEEK data

rm(list=ls())
knitr::opts_chunk$set(warning=FALSE, message=FALSE, sanitize = T, 
                      fig.height=5, fig.width=8, echo=F)
## [1] "loading library"

Demographics

Eye movement data

Stimuli information

Filter dataset

Filter out participants that should not go into analyses based on exclusionary criteria: a) age, b) didn’t know signs in the task, c) not enough ASL exposure.

Filter unknown signs

Create a clean target image variable.

Add unknown signs variable. Taken from sol_demo data frame.

Now we can filter the iChart, removing the “unknown” signs.

Get total number of trials removed because of known signs

## [1] 22

Remove prescreened out trials

Remove participants for having too few trials

We define too few trials as less than or equal to 25% of the total number of trials in the task.

## Source: local data frame [2 x 2]
## 
##   exclude_few_trials n()
## 1            exclude   5
## 2            include  45

Create final exclusions table

Get median split by age

##   median(Months) max(Months) min(Months) sd(Months) n()
## 1             27          53          16   9.140259  29
## Source: local data frame [4 x 3]
## Groups: Sex
## 
##   Sex     age_group count
## 1   F < 26.5 Months     8
## 2   F > 26.5 Months     9
## 3   M < 26.5 Months     6
## 4   M > 26.5 Months     6
## Source: local data frame [3 x 5]
## 
##       age_group n_distinct(Sub.Num) mean(Months) min(Months) max(Months)
## 1 < 26.5 Months                  14     20.71308          16          26
## 2 > 26.5 Months                  15     36.18715          27          53
## 3        Adults                  16    430.57634         246         695

Process iChart

First, we need to process the data, keeping only those trials on which the child was looking at the signer at F0.

  • C: Center
  • D: Distractor
  • T: Target
  • A: Away

includeOffCenter == FALSE -> only include trials child was looking at center at F0

includeOffCenter == TRUE -> include trials child was looking at center, target, or distractor at F0

## Source: local data frame [4 x 3]
## Groups: "0"
## 
##   "0" Response Trials
## 1   0        A     22
## 2   0        C   1019
## 3   0        D     35
## 4   0        T     43
## Source: local data frame [2 x 3]
## Groups: "0"
## 
##   "0" Response Trials
## 1   0        A    100
## 2   0        D   1019

Flag C_T and C_D Trials

Datawiz does not tell us which shifts land on a target vs. a disctractor. So we need to use a function that flags each trial as one of the following:

  • C_T: center to target
  • C_D: center to distractor
  • C-C: center to center (child leaves the signer, goes away, and comes back to signer)
  • no_shift
  • off_signer
## Source: local data frame [5 x 2]
## 
##   trial_types Trials
## 1         C_C      1
## 2         C_D    128
## 3         C_T    824
## 4    no_shift     66
## 5  off_signer    100

Next, we compute statistics over long window 0-5000 ms. This will allow us to see a distribution of RTs, which we will use to determine our analysis window.

First, for adults.

## [1] "### Trials left ###"
## [1] 500
## [1] 450
## [1] 400
## [1] 350
## [1] 300
## [1] 250
## [1] 200
## [1] 150
## [1] 100
## [1] 50
## [1] 0

Now, for kids.

## [1] "### Trials left ###"
## [1] 550
## [1] 500
## [1] 450
## [1] 400
## [1] 350
## [1] 300
## [1] 250
## [1] 200
## [1] 150
## [1] 100
## [1] 50
## [1] 0

Compute statistics over analysis window: 0-2600ms. We use 2600 ms because it is 500 ms longer than the end of our analysis window (2100ms). This allows us to include trials in which the participant to initiates and completes a shift at the very end of the analysis window.

## [1] "### Trials left ###"
## [1] 550
## [1] 500
## [1] 450
## [1] 400
## [1] 350
## [1] 300
## [1] 250
## [1] 200
## [1] 150
## [1] 100
## [1] 50
## [1] 0
## [1] "### Trials left ###"
## [1] 500
## [1] 450
## [1] 400
## [1] 350
## [1] 300
## [1] 250
## [1] 200
## [1] 150
## [1] 100
## [1] 50
## [1] 0

Reject trials with really long RTs and with long gaps. Gaps are defined as a sequence of frames when the child is not looking at either picture or at the signer.

Get mean Accuracy and RT for each participant

Get mean Acc and RT for each participant by condition

Statistics

Get mean accuracy and rt for each participant

Some munging to get data frame for analysis. Variables needed for each subject:

  • Mean acc
  • Mean rt
  • Signs produced
  • Age
  • Age condition

First shifts

Set up filter to just include kids for correlation analyses.

Correlations

##                 mean_accuracy C_T_prop mean_correct_rt signs_produced
## mean_accuracy            1.00     0.55           -0.54           0.46
## C_T_prop                 0.55     1.00           -0.14           0.33
## mean_correct_rt         -0.54    -0.14            1.00          -0.43
## signs_produced           0.46     0.33           -0.43           1.00
## Months                   0.63     0.36           -0.27           0.76
##                 Months
## mean_accuracy     0.63
## C_T_prop          0.36
## mean_correct_rt  -0.27
## signs_produced    0.76
## Months            1.00
## 
## n
##                 mean_accuracy C_T_prop mean_correct_rt signs_produced
## mean_accuracy              29       29              29             28
## C_T_prop                   29       29              29             28
## mean_correct_rt            29       29              29             28
## signs_produced             28       28              28             28
## Months                     29       29              29             28
##                 Months
## mean_accuracy       29
## C_T_prop            29
## mean_correct_rt     29
## signs_produced      28
## Months              29
## 
## P
##                 mean_accuracy C_T_prop mean_correct_rt signs_produced
## mean_accuracy                 0.0021   0.0027          0.0139        
## C_T_prop        0.0021                 0.4569          0.0902        
## mean_correct_rt 0.0027        0.4569                   0.0227        
## signs_produced  0.0139        0.0902   0.0227                        
## Months          0.0003        0.0563   0.1624          0.0000        
##                 Months
## mean_accuracy   0.0003
## C_T_prop        0.0563
## mean_correct_rt 0.1624
## signs_produced  0.0000
## Months

Just RT.

##                 mean_correct_rt signs_produced Months
## mean_correct_rt             1.0          -0.60  -0.40
## signs_produced             -0.6           1.00   0.74
## Months                     -0.4           0.74   1.00
## 
## n
##                 mean_correct_rt signs_produced Months
## mean_correct_rt              24             23     24
## signs_produced               23             23     23
## Months                       24             23     24
## 
## P
##                 mean_correct_rt signs_produced Months
## mean_correct_rt                 0.0023         0.0538
## signs_produced  0.0023                         0.0000
## Months          0.0538          0.0000

T.tests

## 
##  Two Sample t-test
## 
## data:  mean_correct_rt by age_group
## t = 2.0455, df = 22, p-value = 0.02647
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
##  25.69813      Inf
## sample estimates:
## mean in group < 26.5 Months mean in group > 26.5 Months 
##                    1350.768                    1190.691
## 
##  Two Sample t-test
## 
## data:  mean_accuracy by age_group
## t = -2.9596, df = 27, p-value = 0.003171
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
##       -Inf -0.029803
## sample estimates:
## mean in group < 26.5 Months mean in group > 26.5 Months 
##                   0.5931446                   0.6633542
## 
##  Two Sample t-test
## 
## data:  mean_correct_rt by age_group_collapsed
## t = -9.1696, df = 43, p-value = 0.000000000005602
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
##       -Inf -446.3837
## sample estimates:
## mean in group Adults   mean in group Kids 
##             698.6211            1245.2121

Get confidence intervals for graph values

PP by participants

Some munging to format data for plotting

Summarise graph values for all participants and for CODAs and Deaf children.

Profile plot across children (younger, older) and adults.

Profile plot for CODAs vs. Deaf children.

Profile plot for individual participants, with loess curves.

PP by item

Read in graph values.

Munge data for plotting

Plot by item eye movement data.

Plot all items for both stimulus sets together.

Plot RT distribution for each stimulus set.

Add sign length information to iChart.

Get only good RTs: Center to Target shifts, within the analysis window.

Plot RT distribution for each stimulus set and each sign.

Analyze

Plot the mean difference between participants’ shifts and the offset of that sign.

On 4 out of the 16 signs, participants on average shifted before the end of the target sign.

Model the probability of shifting before the end of the target sign.

## 
## Call:
## glm(formula = shift_pre_offset ~ length_ms + Months + signs_produced, 
##     family = "binomial", data = iChart_rt)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.5393  -0.8548  -0.3915   1.0142   1.9681  
## 
## Coefficients:
##                  Estimate Std. Error z value         Pr(>|z|)    
## (Intercept)    -5.1525964  0.8833450  -5.833 0.00000000544230 ***
## length_ms       0.0038487  0.0005555   6.928 0.00000000000426 ***
## Months          0.0120277  0.0210418   0.572            0.568    
## signs_produced  0.0030616  0.0129394   0.237            0.813    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 408.30  on 298  degrees of freedom
## Residual deviance: 334.76  on 295  degrees of freedom
##   (10 observations deleted due to missingness)
## AIC: 342.76
## 
## Number of Fisher Scoring iterations: 4

Shifting before end of sign is strongly predicted by the length of the sign,