Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels
The message comes from the R function model.matrix which is called by secr.design.MS which is called by secr.fit which is called by mask.check! Obviously there is a problem with a factor. In this case the fitted model had specified groups using an individual covariate 'sex', but within each session only one sex was present, so the grouping factor had only one level. The same error would be expected from secr.fit, and from other functions that call secr.design.MS.
The solution is easy: use 'groups' only when there is more than one group

Murray
P.S. You can reproduce the message with
- Code: Select all
cars$type <- rep('n',50) ## add dummy factor to dataset 'cars'
model.matrix(dist ~ type, data = cars)
## compare
cars$type <- rep(c('n','p'),25)
model.matrix(dist ~ type, data = cars)