Functions for analyzing psychophysical data in R