knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Read in the data.

data <- backwards2_E1 #.mat file been preprocessed into melted long dataframe
numItemsInStream<- length( data$letterSeq[1,] )  

library(dplyr)

#To use dplyr operations, each column must be a 1d atomic vector or a list. So, can't have array fields like letterSeq
data$letterSeq<- NULL

#Give conditions better names than 1 and 2
names(data)[names(data) == 'target'] <- 'stream'
data <- data %>% mutate( stream =ifelse(stream==1, "Left","Right") )
#mutate condition to Orientation
names(data)[names(data) == 'condition'] <- 'orientation'
data <- data %>% mutate( orientation =ifelse(orientation==1, "Canonical","Inverted") )

df<-data %>% dplyr::filter(subject=="BE",orientation=="Canonical",stream=="Right")

library(mixRSVP)

plotContinuousGaussian<-TRUE
annotateIt<-TRUE
minSPE<- -17; maxSPE<- 17

Check troublesome cases.

# BE,2,1
df<- data %>% dplyr::filter(subject=="AF" & stream=="Right" & orientation=="Canonical")
#df<- data %>% dplyr::filter(subject=="BE" & stream=="Right" & orientation=="Canonical") 
#estimates<- analyzeOneCondition(df,numItemsInStream,parameterBounds())

g<- plot_hist_with_fit(df,minSPE,maxSPE,df$targetSP,numItemsInStream,plotContinuousGaussian,annotateIt, FALSE)
library(ggplot2)
g<-g + annotate("text", x = 12, y = 25, label = "BE, Canonical, Right stream")
show(g)

Above it appears the efficacy may be too high. Problem is that can fit the histogram very well with a tiny precision. This looks like a general problem that will often cause precision to be underestimated and efficacy overestimated. But I am not sure, maybe this is an appropriate fit. Quantization makes it hard to tell.

#BA right Inverted
df <- data %>% dplyr::filter(subject=="BA" & stream=="Right" & orientation=="Inverted")
#estimates<- analyzeOneCondition(df,numItemsInStream,parameterBounds())
g<- plot_hist_with_fit(df,minSPE,maxSPE,df$targetSP,numItemsInStream,plotContinuousGaussian,annotateIt, FALSE)
g + annotate("text", x = 12, y = 25, label = "BA, Inverted, Right stream")

This one above looks fine.

#BO,1,1
df<- data %>% dplyr::filter(subject=="BO" & stream=="Left" & orientation=="Canonical") 
#estimates<- analyzeOneCondition(df,numItemsInStream,parameterBounds())
g<- plot_hist_with_fit(df,minSPE,maxSPE,df$targetSP,numItemsInStream,plotContinuousGaussian,annotateIt, FALSE)
g + annotate("text", x = 12, y = 25, label = "BO, Canonical, Left stream") 

How did BO do it? Never guessed, almost, only twice. We haven't seen/noticed such stellar performance in any other dataset. Of course this indicates precision is low but how low cannot be known!

Running these fits typically yields a few fitting errors. One of them is "Error in eigen(nhatend) : infinite or missing values in 'x'" which optimx's author says might be fine

#AD,2,1
df<- data %>% dplyr::filter(subject=="AD" & stream=="Right" & orientation=="Canonical") 
g<- plot_hist_with_fit(df,minSPE,maxSPE,df$targetSP,numItemsInStream,plotContinuousGaussian,annotateIt, FALSE)
g + annotate("text", x = 12, y = 25, label = "AD, Canonical, Right stream") 

Person has a weird pattern of temporal errors, resulting in a poor fit. Fitting algorithm seems to have done a good job.

#AI,1,2
df<- data %>% dplyr::filter(subject=="AI" & stream=="Left" & orientation=="Inverted") 
g<- plot_hist_with_fit(df,minSPE,maxSPE,df$targetSP,numItemsInStream,plotContinuousGaussian,annotateIt, FALSE)
g + annotate("text", x = 12, y = 25, label = "AI, Inverted, Left stream") 

#estimates %>% dplyr::filter(round(p1,3)==0.280) #BA,2,2 or BE,2,1
#1e-05  4 1e-05 334.385593546 but didn't end up being the winning replicate
#Inspect AD,2,1 and AI,1,2 because very poor fit

Person tended to report a letter several items after the cue if they didn't manage to get the cued letter.



alexholcombe/mixRSVP documentation built on June 7, 2019, 3:50 p.m.