Data processing, plotting, and analysis script

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

Read Data

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.

Remove 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()
##                (chr) (int)
## 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
##   (chr)        (chr) (int)
## 1     F  < 27 Months     8
## 2     F >= 27 Months     9
## 3     M  < 27 Months     6
## 4     M >= 27 Months     6
## Source: local data frame [3 x 5]
## 
##      age_group n_distinct(Sub.Num) mean(Months) min(Months) max(Months)
##          (chr)               (int)        (dbl)       (int)       (int)
## 1  < 27 Months                  14     20.71308          16          26
## 2 >= 27 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
##   (chr)    (chr)  (int)
## 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
##   (chr)    (chr)  (int)
## 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
##        (fctr)  (int)
## 1         C_C      1
## 2         C_D    141
## 3         C_T    845
## 4    no_shift     32
## 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 do the same 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-2700ms. We use 2700 ms because it is 500 ms longer than the end of our analysis window (2200ms). 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] 1100
## [1] 1050
## [1] 1000
## [1] 950
## [1] 900
## [1] 850
## [1] 800
## [1] 750
## [1] 700
## [1] 650
## [1] 600
## [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] 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.

Mean Accuracy and RT for each participant

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 shift accuracy analysis

First we need to categorize each trial type based on the analysis window.

Then we add this information to the summary data frame.

Median RT

Filter kids for RT analysis

Correlations

##                 mean_accuracy C_T_prop mean_correct_rt median_ct_rt
## mean_accuracy            1.00     0.58           -0.54        -0.49
## C_T_prop                 0.58     1.00           -0.02        -0.14
## mean_correct_rt         -0.54    -0.02            1.00         0.94
## median_ct_rt            -0.49    -0.14            0.94         1.00
## signs_produced           0.44     0.31           -0.41        -0.46
## Months                   0.62     0.38           -0.32        -0.36
##                 signs_produced Months
## mean_accuracy             0.44   0.62
## C_T_prop                  0.31   0.38
## mean_correct_rt          -0.41  -0.32
## median_ct_rt             -0.46  -0.36
## signs_produced            1.00   0.76
## Months                    0.76   1.00
## 
## n
##                 mean_accuracy C_T_prop mean_correct_rt median_ct_rt
## mean_accuracy              29       29              29           29
## C_T_prop                   29       29              29           29
## mean_correct_rt            29       29              29           29
## median_ct_rt               29       29              29           29
## signs_produced             28       28              28           28
## Months                     29       29              29           29
##                 signs_produced Months
## mean_accuracy               28     29
## C_T_prop                    28     29
## mean_correct_rt             28     29
## median_ct_rt                28     29
## signs_produced              28     28
## Months                      28     29
## 
## P
##                 mean_accuracy C_T_prop mean_correct_rt median_ct_rt
## mean_accuracy                 0.0010   0.0027          0.0067      
## C_T_prop        0.0010                 0.9112          0.4565      
## mean_correct_rt 0.0027        0.9112                   0.0000      
## median_ct_rt    0.0067        0.4565   0.0000                      
## signs_produced  0.0205        0.1122   0.0298          0.0132      
## Months          0.0003        0.0436   0.0922          0.0553      
##                 signs_produced Months
## mean_accuracy   0.0205         0.0003
## C_T_prop        0.1122         0.0436
## mean_correct_rt 0.0298         0.0922
## median_ct_rt    0.0132         0.0553
## signs_produced                 0.0000
## Months          0.0000

Just RT.

##                 mean_correct_rt median_ct_rt signs_produced Months
## mean_correct_rt            1.00         0.92          -0.61  -0.47
## median_ct_rt               0.92         1.00          -0.65  -0.49
## signs_produced            -0.61        -0.65           1.00   0.74
## Months                    -0.47        -0.49           0.74   1.00
## 
## n
##                 mean_correct_rt median_ct_rt signs_produced Months
## mean_correct_rt              24           24             23     24
## median_ct_rt                 24           24             23     24
## signs_produced               23           23             23     23
## Months                       24           24             23     24
## 
## P
##                 mean_correct_rt median_ct_rt signs_produced Months
## mean_correct_rt                 0.0000       0.0021         0.0204
## median_ct_rt    0.0000                       0.0009         0.0150
## signs_produced  0.0021          0.0009                      0.0000
## Months          0.0204          0.0150       0.0000

T.tests

## 
##  Two Sample t-test
## 
## data:  mean_correct_rt by age_group
## t = 2.2137, df = 22, p-value = 0.03752
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##   12.11964 371.55653
## sample estimates:
##  mean in group < 27 Months mean in group >= 27 Months 
##                   1429.099                   1237.261
## 
##  Two Sample t-test
## 
## data:  mean_accuracy by age_group
## t = -2.8347, df = 27, p-value = 0.008581
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.12566730 -0.02013377
## sample estimates:
##  mean in group < 27 Months mean in group >= 27 Months 
##                  0.6040133                  0.6769139
## 
##  Two Sample t-test
## 
## data:  mean_correct_rt by age_group_collapsed
## t = -8.8497, df = 43, p-value = 0.00000000003075
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -720.4198 -453.0145
## sample estimates:
## mean in group Adults   mean in group Kids 
##             716.6112            1303.3284
## 
##  Two Sample t-test
## 
## data:  mean_accuracy by hearing_status_participant
## t = 1.1101, df = 27, p-value = 0.2767
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.02710879  0.09101862
## sample estimates:
##    mean in group deaf mean in group hearing 
##             0.6560451             0.6240902
## 
##  Two Sample t-test
## 
## data:  C_T_prop by hearing_status_participant
## t = 1.7148, df = 27, p-value = 0.09785
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.01990326  0.22240326
## sample estimates:
##    mean in group deaf mean in group hearing 
##               0.76125               0.66000
## 
##  Two Sample t-test
## 
## data:  mean_correct_rt by hearing_status_participant
## t = 0.65197, df = 27, p-value = 0.5199
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -120.1615  232.0884
## sample estimates:
##    mean in group deaf mean in group hearing 
##              1328.415              1272.452

Get confidence intervals for graph values

PP for each participant

Some munging to format data for plotting

dplyr::summarise graph values for all participants.

PP for children (younger, older) and adults.

Summary bar plots for all participants

Now we make the summary bar plots.

Tanenhaus plot: all types of looking

First, we munge the raw iChart data.

Grab just the eye movement data and group information

Convert to long format

Summarize for each participant - get proportion looking at each time slice

Get means and CIs for proportion looking at each time slice across particpants

Now we make Tanenhaus style plot.

Window accuracy analysis

Here I want to see what happens to window accuracy when we don’t penalize kids for looking at the signer.

Grab just the eye movement data and group information

Convert to long format

Get means and CIs for each participant.

Get means and CIS collapsing across participants

Now plot.

CODAs vs. Deaf Analysis

Summary data plots for CODAs vs. Deaf children.

T.tests deaf vs. codas

## 
##  Two Sample t-test
## 
## data:  mean_accuracy by hearing_status_participant
## t = 1.1101, df = 27, p-value = 0.2767
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.02710879  0.09101862
## sample estimates:
##    mean in group deaf mean in group hearing 
##             0.6560451             0.6240902
## 
##  Two Sample t-test
## 
## data:  C_T_prop by hearing_status_participant
## t = 1.7148, df = 27, p-value = 0.09785
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.01990326  0.22240326
## sample estimates:
##    mean in group deaf mean in group hearing 
##               0.76125               0.66000
## 
##  Two Sample t-test
## 
## data:  mean_correct_rt by hearing_status_participant
## t = 0.65197, df = 27, p-value = 0.5199
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -120.1615  232.0884
## sample estimates:
##    mean in group deaf mean in group hearing 
##              1328.415              1272.452

Effect size deaf vs. codas

PP for CODAs vs. Deaf

PP for CODAs vs. Deaf Signer removed

Get means and CIs for each participant for each time slice. Using two different Accuracy computations:

  • Including looks to the signer
  • Not including looks to the signer

Get means and CIs for each group

Now plot the two accuracy measures against each other.

Summary plots comparing accuracy measures: CODAs vs. Deaf

## 
##  Two Sample t-test
## 
## data:  m_acc by hearing_status_participant
## t = 1.2432, df = 27, p-value = 0.2245
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.03895116  0.15870804
## sample estimates:
##    mean in group deaf mean in group hearing 
##             0.8134356             0.7535572

Tanenhaus plot codas vs. deaf

Individual Participants Analysis

Item-level Analysis

PP by item

Read in graph values.

Munge data for plotting

Plot by item data

Plot all items for both stimulus sets

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.

Plot difference between participants’ mean RT by item and offset of that sign.

Scatter plots of individual differences