使用下面的数据框,我设法计算了受试者反应时间的重复测量方差分析。这是有问题的数据框:
> str(a)
'data.frame': 2778 obs. of 9 variables:
$ Phase : Factor w/ 1 level "Test": 1 1 1 1 1 1 1 1 1 1 ...
$ Subject : Factor w/ 17 levels "1","2","3","5",..: 7 7 7 7 7 7 7 7 7 7 ...
$ Group : Factor w/ 2 levels "Attn","Dist": 1 1 1 1 1 1 1 1 1 1 ...
$ Global : Factor w/ 2 levels "D","S": 1 1 1 1 1 1 1 1 1 1 ...
$ Local : Factor w/ 2 levels "D","S": 1 1 1 1 1 1 1 1 1 1 ...
$ trialtype: Factor w/ 1 level "Dist": 1 1 1 1 1 1 1 1 1 1 ...
$ RT : num 477 682 720 NaN 604 720 910 707 705 758 ...
$ ACC : logi TRUE TRUE TRUE FALSE TRUE TRUE ...
这是我用来计算反应时间方差分析的代码:
raw<-read.table('R_notarg_noattn.tdf',header=T)
head(raw)
str(raw)
raw$Subject = factor(raw$Subject)
raw$logrt = log10(raw$RT) # logorithm of RT
hist(raw$logrt)
tsttrl_nooutliers = subset(raw, logrt>2 & ACC==TRUE) # take values greater than 2 logs AND where subj responded correctly
attach(tsttrl_nooutliers) # make column names available as global variables
hist(logrt)
summary(aovrt <- aov(logrt ~ Group*Global*Local + Error(Subject/(Global*Local)), subset=Phase=='Test', data=tsttrl_nooutliers)) # ANOVA table
meanrt=10^tapply(logrt,list( Global=Global, Local=Local, Group=Group), mean) # de-log and calculate means by condition
par(mfcol=c(1,2)) # c() *combines* values into vector/list; par() sets graphical parameters... equivalent to Matlab's set() ????
barplot(meanrt[,,'Attn'],beside=T,ylim=c(700,1000),xpd=F)
barplot(meanrt[,,'Dist'],beside=T,ylim=c(700,1000),xpd=F)
detach(tsttrl_nooutliers)
我想对错误率重复类似的分析,这些错误率编码在 boolean columnACC
中。我想知道我应该怎么做,因为这个计算需要一个中间步骤,即按每个条件按主题计算错误率。当我说“条件”时,我的意思是说因素的独特组合,即 $Group、$Global、$Local、$trialtype(仅选择 $Phase == Test 的试验,如前面的片段)。
有人能指出我正确的方向吗?简而言之,我不清楚如何获得错误率,然后将其输入aov
函数应该没有问题。