Modeling psychometric functions in R