rm(list=ls()) ################################################################################ # LOADING RELEVANT PACKAGES ################################################################################ library(lmerTest) ################################################################################ ################################################################################ # BEHAVIOUR ################################################################################ ################################################################################ ################################################################################ # READ AND EDIT RAW DATA ################################################################################ behavedat<-read.table("Behaviour.txt",header=TRUE) str(behavedat) # --> Total of 56 observations of 20 variables ################################################################################ # FIRST LOOK DIRECTION ################################################################################ # Creating response variable suited for binomial GLMM with first look # left-gaze coded as success (i.e. "1") and with two observations of subjects # with a binocular look duration of 30 s re-coded from "0" to "NA" behavedat$Direction.First.look.LEFT<-behavedat$Direction.First.look levels(behavedat$Direction.First.look.LEFT)<-c(NA,"1","0") behavedat$Direction.First.look.LEFT ################################################################################################### # Binomial GLMMs accounting for potential dependency from multiple observations of the same subject ################################################################################################### # Full model Model1<-glmer(Direction.First.look.LEFT~Emotion+(1|Subject),family=binomial,data=behavedat,na.action=na.exclude) summary(Model1) # Estimate Std. Error z value Pr(>|z|) #(Intercept) -0.9163 0.4183 -2.190 0.0285 * #Emotionhappy 0.4463 0.5809 0.768 0.4424 # Null model Model0<-glmer(Direction.First.look.LEFT~1+(1|Subject),family=binomial,data=behavedat,na.action=na.exclude) summary(Model0) # Estimate Std. Error z value Pr(>|z|) #(Intercept) -0.6931 0.2887 -2.401 0.0163 * # Model comparison to test for significance of emotion anova(Model1,Model0) # Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq) #Model0 2 72.744 76.721 -34.372 68.744 #Model1 3 74.150 80.117 -34.075 68.150 0.594 1 0.4409 # --> No significant effect of emotion (p=0.44), but evidence for a general leftward bias in first looks (p=0.02). ################################################################################ # FIRST LOOK DURATION ################################################################################ # Visual inspection boxplot(Laterality.index...Duration~Emotion,xlab="Emotion",ylab="Laterality index",cex.lab=1.4,cex.axis=1.2,notch=T,data=behavedat) ###################################################################################### # LME accounting for dependency arising from multiple observations of the same subject ###################################################################################### # Full model Model1<-lmer(Laterality.index...Duration~Emotion+(1|Subject),REML=FALSE,data=behavedat) summary(Model1) # Estimate Std. Error df t value Pr(>|t|) #(Intercept) 0.22893 0.06330 56.00000 3.617 0.000641 *** #Emotionhappy -0.13536 0.08949 28.00000 -1.513 0.141611 # Null model Model0<-lmer(Laterality.index...Duration~1+(1|Subject),REML=FALSE,data=behavedat) summary(Model0) # Estimate Std. Error df t value Pr(>|t|) #(Intercept) 0.16125 0.04566 56.00000 3.531 0.000836 *** # --> No significant effect of emotion (p=0.14), but strong evidence for a generally higher leftward looking duration (p=0.008). ################################################################################ ################################################################################ # HEART RATE ################################################################################ ################################################################################ ################################################################################ # READ AND EDIT RAW DATA ################################################################################ heartdat<-read.table("Heart Rate.txt",header=TRUE) str(heartdat) # --> Total of 34 observations of 14 variables ################################################################################ # LATENCY TO REACH MAXIMUM HEART RATE ################################################################################ hist(heartdat$Latency.to.reach.max.HR,breaks=160,xlab="Latency to reach maximum heart rate (s)",ylab="Frequency",main="") sort(heartdat$Latency.to.reach.max.HR) # --> Three observations have a latency of zero or 0.4 s mean(heartdat$Test.mean);sd(heartdat$Test.mean) # --> Mean ± SD heartrate during test period = 39.4 ± 9.3 ################################################################################