# convert condition labels also to factors, relabel factor levels d <- cbind(d, colsplit(d$EXP, names=c("Cue", "Target"))) d$Cue <- relevel(d$Cue, 2) d$Target <- relevel(d$Target, 2) # add variables with usefule contrasts # ... for C-T combinations # ... ... treatment (EXP=EXP0; default) d$EXP0 <- C(d$EXP, matrix(c( 0, 1, 0, 0, # (1) VA vs VV 0, 0, 1, 0, # (2) AV vs VV 0, 0, 0, 1 # (3) AA vs VV ), 4, 3), 3) contrasts(d$EXP0) # ... ... nested d$EXP1 <- C(d$EXP, matrix(c(-.5, +.5, 0, 0, # (1) type of target |visual cue 0, 0, -.5, +.5, # (2) type of target |auditory cue -.5, -.5, +.5, +.5 # (3) type of cue ), 4, 3), 3) contrasts(d$EXP1) # ... ... crossed d$EXP2 <- C(d$EXP, matrix(c(-.5, -.5, +.5, +.5, # (1) type of cue -.5, +.5, -.5, +.5, # (2) type of target +.5, -.5, -.5, +.5 # (3) cue x target ), 4, 3), 3) contrasts(d$EXP2) # ... for number of microsaccades--see contr.sdif(3) of MASS package # ... ... repeated #d$MN0 <- C(d$MN, matrix(c( -2/3, +1/3, +1/3, # (1) 0 vs. 1 # -1/3, -1/3, +2/3 # (2) 1 vs. 2 # ), 3, 2), 2) #contrasts(d$MN0) # ... ... Helmert #d$MN1 <- C(d$MN, matrix(c(-1, +.5, +.5, # (1) 0 vs. 1, 2+ # 0, -.5, +.5 # (2) 1 vs. 2+ # ), 3, 2), 2) #contrasts(d$MN1)