In this study, children and adults answered questions while playing an iPad game. We varied
In this analysis, we fit hierarchical Bayesian models to characterize the distribution of reaction times
The graphs below show the distribution of normaliszed RTs across conditions. When the answer was less predictable, participants were slower to respond. But there was no interaction in the non-distributional analyses.
## Warning: Removed 61 rows containing non-finite values (stat_bin).
## Warning: Removed 6 rows containing missing values (geom_path).
An ex-gaussian distribution convolves a normal distribution with an exponential – this gives it a long and heavy right tail. We aimed to fit an ex-Gaussian to the response time data, comparing adults with children, and hierarchically modeling the mu parameter, the sigma parameter, and the tau parameter. Mu is the mean of the normal and sigma its standard deviation, while tau is the rate of the exponential. We modeled how these varied across conditions, accounting for random subjec intercepts. Informally, our model had the form:
Mu ~ B0 + (B1 * Match) + (B2 * Pred) + (B3 * Age (5)) + (B4 * Age (3)) + … (the full set of interactions) + (1|Subject)
Sigma ~ B0 + (B1 * Match) + (B2 * Pred) + (B3 * Age (5))+ (B4 * Age (3)) + … (the full set of interactions) + (1|Subject)
Tau ~ B0 + (B1 * Match) + (B2 * Pred) + (B3 * Age (5)) + (B4 * Age (3)) + … (the full set of interactions) + (1|Subject)
This model initially did not converge that well. Following Jake Westfall’s ManyBabies Bayesian analysis (p.c.) we started using Beta distributions as priors for the standard deviation of the prior on By subject intercepts. Once we did that, things converged more nicely.
z <- 0
convert_stan_to_dataframe <- function(stan_object){
sum.df <- data.frame(summary(stan_object, pars = c("beta0","beta","beta_s0","beta_s","beta_t0","beta_t"), probs = c(0.025,0.975))$summary)
colnames(sum.df) <- c("mean","se","sd","X2.5","X97.5","n_eff","R_hat")
sum.df <- sum.df[,c("mean","se","sd","n_eff","R_hat","X2.5","X97.5")]
sum.df$Diff_from_zero <- ifelse((sum.df$X2.5 * sum.df$X97.5) > 0, "***","-")
return(sum.df)
}
stan_col_names = c("Parameter","Mean","S.E.","S.D.","Eff. Samples","R_hat","2.5%","97.5%","Significance")
expt1.full.summary <- convert_stan_to_dataframe(eg_expt1_full)
kable(data.frame("Params" = age_factors,expt1.full.summary), digits = 2,
col.names = stan_col_names)| Parameter | Mean | S.E. | S.D. | Eff. Samples | R_hat | 2.5% | 97.5% | Significance | |
|---|---|---|---|---|---|---|---|---|---|
| beta0 | mu_intercept | -0.74 | 0.00 | 0.03 | 280.94 | 1.01 | -0.81 | -0.68 | *** |
| beta[1] | mu_Match | 0.00 | 0.00 | 0.01 | 2350.41 | 1.00 | -0.03 | 0.01 | - |
| beta[2] | mu_Pred | -0.05 | 0.00 | 0.02 | 1003.60 | 1.00 | -0.08 | -0.01 | *** |
| beta[3] | mu_Fives | 0.06 | 0.00 | 0.07 | 213.20 | 1.02 | -0.02 | 0.22 | - |
| beta[4] | mu_Threes | -0.01 | 0.00 | 0.03 | 594.80 | 1.00 | -0.11 | 0.04 | - |
| beta[5] | mu_MatchByPred | -0.01 | 0.00 | 0.01 | 2162.16 | 1.00 | -0.03 | 0.01 | - |
| beta[6] | mu_MatchByFives | 0.02 | 0.00 | 0.01 | 808.25 | 1.00 | 0.00 | 0.04 | - |
| beta[7] | mu_MatchByThrees | 0.00 | 0.00 | 0.01 | 4000.00 | 1.00 | -0.03 | 0.02 | - |
| beta[8] | mu_PredByFives | 0.02 | 0.00 | 0.02 | 1102.45 | 1.00 | 0.00 | 0.05 | - |
| beta[9] | mu_PredByThrees | 0.00 | 0.00 | 0.01 | 4000.00 | 1.00 | -0.02 | 0.02 | - |
| beta[10] | mu_MatchByPredByFives | -0.01 | 0.00 | 0.01 | 1208.87 | 1.00 | -0.03 | 0.01 | - |
| beta[11] | mu_MatchByPredByThrees | 0.01 | 0.00 | 0.01 | 1727.24 | 1.00 | -0.01 | 0.05 | - |
| beta_s0 | sig_intercept | -1.73 | 0.00 | 0.08 | 1279.66 | 1.00 | -1.89 | -1.58 | *** |
| beta_s[1] | sig_Match | 0.02 | 0.00 | 0.04 | 1448.54 | 1.00 | -0.04 | 0.13 | - |
| beta_s[2] | sig_Pred | 0.01 | 0.00 | 0.04 | 2217.81 | 1.00 | -0.06 | 0.10 | - |
| beta_s[3] | sig_Fives | -0.01 | 0.00 | 0.06 | 1623.11 | 1.00 | -0.17 | 0.09 | - |
| beta_s[4] | sig_Threes | 0.02 | 0.00 | 0.07 | 1000.95 | 1.00 | -0.08 | 0.20 | - |
| beta_s[5] | sig_MatchByPred | 0.00 | 0.00 | 0.03 | 2890.97 | 1.00 | -0.08 | 0.07 | - |
| beta_s[6] | sig_MatchByFives | 0.06 | 0.00 | 0.07 | 616.49 | 1.01 | -0.02 | 0.24 | - |
| beta_s[7] | sig_MatchByThrees | 0.00 | 0.00 | 0.04 | 2175.80 | 1.00 | -0.08 | 0.11 | - |
| beta_s[8] | sig_PredByFives | 0.03 | 0.00 | 0.05 | 992.19 | 1.00 | -0.03 | 0.17 | - |
| beta_s[9] | sig_PredByThrees | 0.01 | 0.00 | 0.04 | 2649.68 | 1.00 | -0.07 | 0.12 | - |
| beta_s[10] | sig_MatchByPredByFives | 0.00 | 0.00 | 0.04 | 2282.73 | 1.00 | -0.07 | 0.09 | - |
| beta_s[11] | sig_MatchByPredByThrees | 0.01 | 0.00 | 0.04 | 1675.77 | 1.00 | -0.07 | 0.12 | - |
| beta_t0 | tau_intercept | -0.16 | 0.00 | 0.10 | 458.64 | 1.01 | -0.36 | 0.03 | - |
| beta_t[1] | tau_Match | -0.02 | 0.00 | 0.04 | 4000.00 | 1.00 | -0.11 | 0.06 | - |
| beta_t[2] | tau_Pred | -0.31 | 0.00 | 0.06 | 1513.76 | 1.00 | -0.43 | -0.19 | *** |
| beta_t[3] | tau_Fives | -1.73 | 0.01 | 0.25 | 604.21 | 1.00 | -2.21 | -1.24 | *** |
| beta_t[4] | tau_Threes | 0.69 | 0.01 | 0.26 | 539.38 | 1.01 | 0.08 | 1.14 | *** |
| beta_t[5] | tau_MatchByPred | 0.07 | 0.00 | 0.05 | 2120.62 | 1.00 | -0.02 | 0.18 | - |
| beta_t[6] | tau_MatchByFives | 0.00 | 0.00 | 0.05 | 2346.86 | 1.00 | -0.10 | 0.10 | - |
| beta_t[7] | tau_MatchByThrees | -0.03 | 0.00 | 0.05 | 1478.16 | 1.00 | -0.15 | 0.06 | - |
| beta_t[8] | tau_PredByFives | -0.01 | 0.00 | 0.05 | 4000.00 | 1.00 | -0.12 | 0.09 | - |
| beta_t[9] | tau_PredByThrees | 0.03 | 0.00 | 0.05 | 2076.14 | 1.00 | -0.06 | 0.14 | - |
| beta_t[10] | tau_MatchByPredByFives | -0.01 | 0.00 | 0.04 | 4000.00 | 1.00 | -0.10 | 0.08 | - |
| beta_t[11] | tau_MatchByPredByThrees | -0.04 | 0.00 | 0.05 | 2186.64 | 1.00 | -0.16 | 0.05 | - |
no_age_factors <- c("mu_intercept","mu_Match","mu_Pred","mu_MatchByPred",
"sig_intercept","sig_Match","sig_Pred","sig_MatchByPred",
"tau_intercept","tau_Match","tau_Pred","tau_MatchByPred")
#expt1.adult.summary <- convert_stan_to_dataframe(eg_expt1_adults)
#kable(data.frame("Params" = no_age_factors,expt1.adult.summary), digits = 2,
# col.names = stan_col_names)expt1.kids.summary <- convert_stan_to_dataframe(eg_expt1_kids_items)
z<-0
kable(data.frame("Params" = kid_factors,expt1.kids.summary), digits = 2,
col.names = stan_col_names)| Parameter | Mean | S.E. | S.D. | Eff. Samples | R_hat | 2.5% | 97.5% | Significance | |
|---|---|---|---|---|---|---|---|---|---|
| beta0 | mu_Intercept | -0.83 | 0 | 0.03 | 809.99 | 1.00 | -0.89 | -0.76 | *** |
| beta[1] | mu_Match | 0.01 | 0 | 0.01 | 2650.62 | 1.00 | -0.01 | 0.04 | - |
| beta[2] | mu_Pred | -0.06 | 0 | 0.02 | 2894.82 | 1.00 | -0.10 | -0.02 | *** |
| beta[3] | mu_Age | -0.01 | 0 | 0.02 | 1017.72 | 1.01 | -0.07 | 0.03 | - |
| beta[4] | mu_MatchByPred | 0.01 | 0 | 0.01 | 3587.75 | 1.00 | -0.02 | 0.04 | - |
| beta[5] | mu_MatchByAge | 0.00 | 0 | 0.01 | 4952.79 | 1.00 | -0.02 | 0.02 | - |
| beta[6] | mu_PredByAge | 0.01 | 0 | 0.01 | 4590.60 | 1.00 | -0.01 | 0.03 | - |
| beta[7] | mu_MatchByPredByAge | 0.01 | 0 | 0.01 | 2588.60 | 1.00 | -0.01 | 0.04 | - |
| beta_s0 | sigma_Intercept | -1.92 | 0 | 0.10 | 2524.41 | 1.00 | -2.12 | -1.75 | *** |
| beta_s[1] | sigma_Match | -0.02 | 0 | 0.06 | 1833.66 | 1.00 | -0.19 | 0.07 | - |
| beta_s[2] | sigma_Pred | -0.02 | 0 | 0.06 | 2377.78 | 1.00 | -0.19 | 0.08 | - |
| beta_s[3] | sigma_Age | 0.05 | 0 | 0.10 | 1312.83 | 1.00 | -0.06 | 0.33 | - |
| beta_s[4] | sigma_MatchByPred | 0.02 | 0 | 0.06 | 2564.98 | 1.00 | -0.07 | 0.19 | - |
| beta_s[5] | sigma_MatchByAge | 0.01 | 0 | 0.05 | 2743.29 | 1.00 | -0.08 | 0.15 | - |
| beta_s[6] | sigma_PredByAge | 0.02 | 0 | 0.06 | 2630.07 | 1.00 | -0.07 | 0.17 | - |
| beta_s[7] | sigma_MatchByPredByAge | 0.01 | 0 | 0.05 | 3212.20 | 1.00 | -0.10 | 0.15 | - |
| beta_t0 | tau_Intercept | 0.10 | 0 | 0.10 | 1170.33 | 1.00 | -0.08 | 0.31 | - |
| beta_t[1] | tau_Match | -0.02 | 0 | 0.05 | 2309.26 | 1.00 | -0.13 | 0.07 | - |
| beta_t[2] | tau_Pred | -0.26 | 0 | 0.08 | 3568.89 | 1.00 | -0.41 | -0.11 | *** |
| beta_t[3] | tau_Age | -0.02 | 0 | 0.09 | 1944.12 | 1.00 | -0.24 | 0.15 | - |
| beta_t[4] | tau_MatchByPred | 0.05 | 0 | 0.06 | 2947.50 | 1.00 | -0.03 | 0.18 | - |
| beta_t[5] | tau_MatchByAge | -0.01 | 0 | 0.04 | 4660.12 | 1.00 | -0.10 | 0.06 | - |
| beta_t[6] | tau_PredByAge | 0.02 | 0 | 0.04 | 4835.00 | 1.00 | -0.05 | 0.12 | - |
| beta_t[7] | tau_MatchByPredByAge | -0.04 | 0 | 0.05 | 2808.62 | 1.00 | -0.14 | 0.04 | - |
In this study, children and adults answered questions while playing an iPad game. We varied
In this analysis, we fit hierarchical Bayesian models to characterize the distribution of reaction times
The graphs below show the distribution of normaliszed RTs across conditions (we exclude trials where participants were incorrect, and participants who produced fewer than 20 datapoints). When information comes early, adults respond reliably faster in predictable contexts (see non-distributional analyses). It is not clear if the same is true for children.
## Warning: Removed 104 rows containing non-finite values (stat_bin).
## Warning: Removed 6 rows containing missing values (geom_path).
We could not fit a whole group analysis, as the adult data were not well fit by an ex-gaussian. Instead, we fit a normal to the adults, and an ex-gaussian to the children. We were finally able to fit a whole group analysis, but separately exponentiating the intercept and the predictors of the scale (sigma and tau) terms. The final regression had roughly this structure:
Mu ~ B0 + (B1 * Early) + (B2 * Pred) + (B3 * Age) + … (the full set of interactions) + (1|Subject)
Sigma ~ B0 + (B1 * Early) + (B2 * Pred) + (B3 * Age) + … (the full set of interactions) + (1|Subject)
Tau ~ B0 + (B1 * Early) + (B2 * Pred) + (B3 * Age) + … (the full set of interactions) + (1|Subject)
load("./Expt2/eg_expt2_simpleage.RDATA")
z<-0levels= c("Intercept","Early","Pred","Age","EarlyByPred","EarlyByAge","PredByAge","EarlyByPredByAge")
whole_factors <- c(paste("mu_", levels, sep = ""),
paste("sigma_", levels, sep = ""),
paste("tau_", levels, sep = ""))
expt2.whole.summary <- convert_stan_to_dataframe(eg_expt2_full)
kable(data.frame("Params" = whole_factors,expt2.whole.summary), digits = 2,
col.names = stan_col_names)| Parameter | Mean | S.E. | S.D. | Eff. Samples | R_hat | 2.5% | 97.5% | Significance | |
|---|---|---|---|---|---|---|---|---|---|
| beta0 | mu_Intercept | -0.63 | 0.00 | 0.02 | 576.90 | 1.01 | -0.67 | -0.60 | *** |
| beta[1] | mu_Early | -0.11 | 0.00 | 0.02 | 867.04 | 1.00 | -0.15 | -0.08 | *** |
| beta[2] | mu_Pred | -0.05 | 0.00 | 0.03 | 630.46 | 1.00 | -0.11 | 0.01 | - |
| beta[3] | mu_Age | 0.13 | 0.00 | 0.04 | 576.50 | 1.00 | 0.06 | 0.20 | *** |
| beta[4] | mu_EarlyByPred | -0.04 | 0.00 | 0.01 | 4000.00 | 1.00 | -0.06 | -0.03 | *** |
| beta[5] | mu_EarlyByAge | 0.07 | 0.00 | 0.01 | 4000.00 | 1.00 | 0.05 | 0.08 | *** |
| beta[6] | mu_PredByAge | 0.01 | 0.00 | 0.03 | 779.98 | 1.01 | -0.04 | 0.07 | - |
| beta[7] | mu_EarlyByPredByAge | 0.01 | 0.00 | 0.01 | 4000.00 | 1.00 | 0.00 | 0.03 | - |
| beta_s0 | sigma_Intercept | -2.21 | 0.00 | 0.06 | 2205.38 | 1.00 | -2.32 | -2.10 | *** |
| beta_s[1] | sigma_Early | -0.18 | 0.00 | 0.07 | 3100.86 | 1.00 | -0.32 | -0.02 | *** |
| beta_s[2] | sigma_Pred | -0.02 | 0.00 | 0.07 | 3224.99 | 1.00 | -0.17 | 0.12 | - |
| beta_s[3] | sigma_Age | -0.27 | 0.00 | 0.12 | 1737.87 | 1.00 | -0.49 | -0.02 | *** |
| beta_s[4] | sigma_EarlyByPred | 0.04 | 0.00 | 0.05 | 4000.00 | 1.00 | -0.05 | 0.16 | - |
| beta_s[5] | sigma_EarlyByAge | 0.11 | 0.00 | 0.06 | 4000.00 | 1.00 | 0.00 | 0.24 | *** |
| beta_s[6] | sigma_PredByAge | 0.10 | 0.00 | 0.09 | 2448.33 | 1.00 | -0.05 | 0.30 | - |
| beta_s[7] | sigma_EarlyByPredByAge | 0.00 | 0.00 | 0.05 | 4000.00 | 1.00 | -0.10 | 0.09 | - |
| beta_t0 | tau_Intercept | -0.47 | 0.00 | 0.08 | 866.15 | 1.00 | -0.62 | -0.31 | *** |
| beta_t[1] | tau_Early | -0.25 | 0.00 | 0.06 | 2429.04 | 1.00 | -0.38 | -0.13 | *** |
| beta_t[2] | tau_Pred | -0.33 | 0.01 | 0.16 | 720.73 | 1.00 | -0.64 | -0.03 | *** |
| beta_t[3] | tau_Age | -1.81 | 0.01 | 0.15 | 753.98 | 1.00 | -2.10 | -1.52 | *** |
| beta_t[4] | tau_EarlyByPred | 0.05 | 0.00 | 0.04 | 4000.00 | 1.00 | -0.02 | 0.13 | - |
| beta_t[5] | tau_EarlyByAge | 0.01 | 0.00 | 0.04 | 4000.00 | 1.00 | -0.06 | 0.08 | - |
| beta_t[6] | tau_PredByAge | 0.01 | 0.00 | 0.11 | 1150.81 | 1.00 | -0.21 | 0.25 | - |
| beta_t[7] | tau_EarlyByPredByAge | -0.09 | 0.00 | 0.04 | 4000.00 | 1.00 | -0.17 | -0.02 | *** |
tt_adult <- subset(tt, Age == "Adult")
load("./Expt2/eg_expt2_simpleAdult.RDATA")
z<-0
convert_stan_to_dataframe_normal <- function(stan_object){
sum.df <- data.frame(summary(stan_object, pars = c("beta0","beta","beta_s0","beta_s"), probs = c(0.025,0.975))$summary)
colnames(sum.df) <- c("mean","se","sd","X2.5","X97.5","n_eff","R_hat")
sum.df <- sum.df[,c("mean","se","sd","n_eff","R_hat","X2.5","X97.5")]
sum.df$Diff_from_zero <- ifelse((sum.df$X2.5 * sum.df$X97.5) > 0, "***","-")
return(sum.df)
}z<-1
levels= c("Intercept","Early","Pred","EarlyByPred")
adult_factors <- c(paste("mu_", levels, sep = ""),
paste("sigma_", levels, sep = ""),
paste("tau_",levels, sep = ""))
expt2.adults.summary <- convert_stan_to_dataframe(eg_expt2_adult)
kable(data.frame("Params" = adult_factors,expt2.adults.summary), digits = 2,
col.names = stan_col_names)| Parameter | Mean | S.E. | S.D. | Eff. Samples | R_hat | 2.5% | 97.5% | Significance | |
|---|---|---|---|---|---|---|---|---|---|
| beta0 | mu_Intercept | -0.67 | 0.00 | 0.05 | 180.77 | 1.02 | -0.77 | -0.58 | *** |
| beta[1] | mu_Early | -0.10 | 0.00 | 0.02 | 714.46 | 1.00 | -0.14 | -0.05 | *** |
| beta[2] | mu_Pred | -0.06 | 0.00 | 0.08 | 284.54 | 1.00 | -0.24 | 0.06 | - |
| beta[3] | mu_EarlyByPred | -0.04 | 0.00 | 0.01 | 1683.57 | 1.00 | -0.07 | -0.01 | *** |
| beta_s0 | sigma_Intercept | -1.89 | 0.00 | 0.11 | 936.39 | 1.01 | -2.11 | -1.70 | *** |
| beta_s[1] | sigma_Early | -0.08 | 0.00 | 0.08 | 1463.15 | 1.00 | -0.26 | 0.04 | - |
| beta_s[2] | sigma_Pred | 0.00 | 0.00 | 0.11 | 1481.74 | 1.00 | -0.24 | 0.26 | - |
| beta_s[3] | sigma_EarlyByPred | 0.01 | 0.00 | 0.06 | 2623.38 | 1.00 | -0.12 | 0.15 | - |
| beta_t0 | tau_Intercept | -0.42 | 0.01 | 0.13 | 462.59 | 1.01 | -0.67 | -0.16 | *** |
| beta_t[1] | tau_Early | -0.26 | 0.00 | 0.11 | 980.31 | 1.00 | -0.46 | -0.04 | *** |
| beta_t[2] | tau_Pred | -0.27 | 0.01 | 0.24 | 261.99 | 1.01 | -0.79 | 0.12 | - |
| beta_t[3] | tau_EarlyByPred | -0.05 | 0.00 | 0.06 | 2308.83 | 1.00 | -0.18 | 0.06 | - |
tt_kids <- subset(tt, Age != "Adult")
z<-0
levels = c("Intercept","Early","Pred","AgeThree","EarlyByPred","EarlyByThree","PredByThree","EarlyByPredByThree")
kid_factors <- c(paste("mu_",levels, sep = ""),
paste("sigma_",levels, sep = ""),
paste("tau_",levels, sep = ""))
load("./Expt2/eg_expt2_simpleChild.RDATA")expt2.kids.summary <- convert_stan_to_dataframe(eg_expt2_child)
z<-0
kable(data.frame("Params" = adult_factors,expt2.kids.summary), digits = 2,
col.names = stan_col_names)| Parameter | Mean | S.E. | S.D. | Eff. Samples | R_hat | 2.5% | 97.5% | Significance | |
|---|---|---|---|---|---|---|---|---|---|
| beta0 | mu_Intercept | -0.75 | 0.00 | 0.02 | 579.79 | 1.01 | -0.78 | -0.71 | *** |
| beta[1] | mu_Early | -0.20 | 0.00 | 0.02 | 1094.51 | 1.00 | -0.25 | -0.16 | *** |
| beta[2] | mu_Pred | -0.05 | 0.00 | 0.03 | 662.64 | 1.01 | -0.11 | 0.01 | - |
| beta[3] | mu_EarlyByPred | -0.04 | 0.00 | 0.01 | 1839.89 | 1.00 | -0.07 | -0.02 | *** |
| beta_s0 | sigma_Intercept | -2.33 | 0.00 | 0.10 | 1289.27 | 1.00 | -2.54 | -2.16 | *** |
| beta_s[1] | sigma_Early | -0.26 | 0.00 | 0.14 | 1288.15 | 1.00 | -0.53 | 0.00 | - |
| beta_s[2] | sigma_Pred | -0.18 | 0.00 | 0.14 | 1682.20 | 1.00 | -0.48 | 0.06 | - |
| beta_s[3] | sigma_EarlyByPred | 0.07 | 0.00 | 0.10 | 1521.60 | 1.00 | -0.10 | 0.28 | - |
| beta_t0 | tau_Intercept | 0.11 | 0.00 | 0.09 | 515.36 | 1.01 | -0.04 | 0.31 | - |
| beta_t[1] | tau_Early | -0.23 | 0.00 | 0.07 | 1652.20 | 1.00 | -0.38 | -0.08 | *** |
| beta_t[2] | tau_Pred | -0.33 | 0.01 | 0.18 | 389.64 | 1.01 | -0.68 | 0.01 | - |
| beta_t[3] | tau_EarlyByPred | 0.18 | 0.00 | 0.05 | 1989.57 | 1.00 | 0.07 | 0.28 | *** |