##### Potsdam Mind Research Repository ###### ## This script is part of the publication package for the article: # Hohenstein, S., & Kliegl, R. (2013). # Semantic preview benefit during reading. # Journal of Experimental Psychology: Learning, Memory, and Cognition. # http://psycnet.apa.org/doi/10.1037/a0033670 # Sven Hohenstein, 2013 ######## Generate statistics and graphs for Experiment 1 ######### rm(list=ls()) # packages library(lme4) library(ggplot2) library(glmmADMB) # functions source("remef.v0.6.10.R") ##### Analyses and Plots ###### #### 1) Target ### Fixation durations # load data b2 <- readRDS("Exp1.rds") ## main effects # Gaze duration summary(mod1_gd <- lmer(b2, formula = log(tar.GD) ~ PrimeN + (1 + PrimeN | sn) + (1 | id))) # First-fixation duration summary(mod1_ffd <- lmer(b2, formula = log(tar.FFD) ~ PrimeN + (1 + PrimeN | sn) + (1 | id))) # Single-fixation duration summary(mod1_sfd <- lmer(b2, formula = log(tar.SFD) ~ PrimeN + (1 + PrimeN | sn) + (1 | id))) ## influence of distance to pretarget # Gaze duration summary(mod_gd_ls <- lmer(b2, formula = log(tar.GD) ~ PrimeN * scale(distLast, scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) # First-fixation duration summary(mod_ffd_ls <- lmer(b2, formula = log(tar.FFD) ~ PrimeN * scale(distLast, scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) # Single-fixation duration summary(mod_sfd_ls <- lmer(b2, formula = log(tar.SFD) ~ PrimeN * scale(distLast, scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) # Plot (GD) # remove random effects b2$DV_mod_gd_ls <- remef(mod_gd_ls, ran = 'all') # ybreaks = seq(200, 360, 20) xbreaks = seq(1, 8, 1) p <- ggplot(b2[b2$distLast %in% 1:7,], aes(y = DV_mod_gd_ls, x = distLast, linetype=prime, shape=prime) ) p <- p + stat_summary(fun.y = mean, geom = "point", size = 2.5) p <- p + stat_summary(fun.data = "mean_cl_normal", mult = 1, geom = "errorbar", width = 0.2, linetype = 1) p <- p + scale_y_continuous(name="Target gaze duration [ms]", breaks = log(ybreaks), labels = as.character(ybreaks)) p <- p + scale_linetype("Preview", guide = guide_legend(keywidth = 2)) + scale_shape("Preview") p <- p + stat_smooth(method = "lm", formula = y ~ poly(x,2), aes(group = prime), size = 1.2, colour = "black", se = FALSE) p <- p + coord_cartesian(ylim = log(c(min(ybreaks), max(ybreaks)))) p <- p + scale_x_reverse(name = "Launch-site distance [characters]", breaks = xbreaks, labels = as.character(xbreaks)) p <- p + theme_bw() p <- p + theme(legend.position = "top") p ## influence of pretarget viewing time # Gaze duration summary(mod_gd_pt <- lmer(b2, formula = log(tar.GD) ~ PrimeN * scale(log(pretar.GD), scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) summary(lmer(b2, formula = log(tar.GD) ~ PrimeN * scale(log(pretar.FFD), scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) summary(lmer(b2, formula = log(tar.GD) ~ PrimeN * scale(log(pretar.SFD), scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) # First-fixation duration summary(lmer(b2, formula = log(tar.FFD) ~ PrimeN * scale(log(pretar.GD), scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) summary(lmer(b2, formula = log(tar.FFD) ~ PrimeN * scale(log(pretar.FFD), scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) summary(lmer(b2, formula = log(tar.FFD) ~ PrimeN * scale(log(pretar.SFD), scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) # Single-fixation duration summary(lmer(b2, formula = log(tar.SFD) ~ PrimeN * scale(log(pretar.GD), scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) summary(lmer(b2, formula = log(tar.SFD) ~ PrimeN * scale(log(pretar.FFD), scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) summary(lmer(b2, formula = log(tar.SFD) ~ PrimeN * scale(log(pretar.SFD), scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) # Plot (GD -> GD) # remove random effects b2$DV_mod_gd_pt <- exp(remef(mod_gd_pt, ran = 'all')) # combine data for two-panel plot dat_f2 <- rbind(b2, b2) dat_f2$DVc <- c(b2$tar.GD, b2$DV_mod_gd_pt) dat_f2$adjust <- gl(2, nrow(b2), labels = c("observed data", "adjusted data")) # ybreaks = seq(200, 400, 50) xbreaks = seq(100, 500, 50) p <- ggplot(dat_f2, aes(y=DVc, x = pretar.GD, linetype=prime, shape=prime) ) p <- p + scale_y_continuous(name="Target gaze duration [ms]", breaks = (ybreaks), labels = as.character(ybreaks), trans = "log") p <- p + scale_linetype("Preview", guide = guide_legend(keywidth = 2)) + scale_shape("Preview") p <- p + geom_vline(xintercept = exp(mean(log(b2$pretar.GD))), linetype = 5, colour = "darkgrey") p <- p + stat_smooth(method = "lm", formula = y ~ poly(x,2), aes(group = prime), size = 1.2, colour = "black") p <- p + coord_cartesian(xlim = exp(quantile(log(b2$pretar.GD), c(0.05, 0.95) )), ylim =(c(min(ybreaks), max(ybreaks)))) p <- p + scale_x_continuous(name = "Pretarget gaze duration [ms]", breaks =(xbreaks), labels = as.character(xbreaks), trans = "log") p <- p + facet_wrap(~ adjust, nrow = 2) p <- p + theme_bw() p <- p + theme(legend.position = "top") p <- p + theme(strip.background = element_rect(colour = "darkgrey", fill = "lightgrey", size = .2)) p ## influence of display-change recognition rate # Gaze duration summary(lmer(b2, formula = log(tar.GD) ~ PrimeN * scale(percent, scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) # First-fixation duration summary(lmer(b2, formula = log(tar.FFD) ~ PrimeN * scale(percent, scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) # Single-fixation duration summary(lmer(b2, formula = log(tar.SFD) ~ PrimeN * scale(percent, scale = FALSE) + (1 + PrimeN | sn) + (1 | id))) ### Other variables ## Target landing position summary(lmer(b2, formula = o ~ PrimeN + (1 | id) + (1 | sn))) ## Target refixation probability summary(glmmadmb(b2, formula = as.integer(refix) ~ PrimeN + (1 | id) + (1 | sn), family = "binomial", link = "logit")) #### Pretarget ## Fixation duration # GD summary(lmer(b2, formula = log(pretar.GD) ~ PrimeN + (1 | id) + (1 | sn))) # FFD summary(lmer(b2, formula = log(pretar.FFD) ~ PrimeN + (1 | id) + (1 | sn))) # SFD summary(lmer(b2, formula = log(pretar.SFD) ~ PrimeN + (1 | id) + (1 | sn))) ### Target skipping # load data b7 <- readRDS("Exp1_skip.rds") ## main effects summary(glmmadmb(b7, formula = as.integer(value) ~ PrimeN + (1 | id) + (1 | sn), family = "binomial", link = "logit"))