> > >>> > -----Original Message----- > > >>> > From: [EMAIL PROTECTED] > > >>> > [mailto:[EMAIL PROTECTED] On Behalf Of Mario Maiworm > > >>> > Sent: Thursday, August 21, 2008 7:05 AM > > >>> > To: r-help@r-project.org > > >>> > Subject: [R] psychometric functions > > >>> > > > >>> > Hi, > > >>> > I want to fit some psychophysical data with cumulative > > gaussians. > > >>> > There is quite a convenient toolbox for matlab called > > 'psignifit' > > >>> > (formerly known as 'psychofit'). It allows the lower > > bound of the > > >>> > sigmoid to vary slightly from zero, aswell as the upper > > bound to > > >>> > vary from one. with these two free parameters, the > > fitted function > > >>> > is less sensitive to noisy data and outliers.
Two comments. First, it isn't clear to me why you want the upper bound to differ from 1. Apparently you have some theoretical reason for using a cumulative gaussian. Wouldn't the same theory tell you that the upper bound should be 1? Second, putting that aside, one of the very first things I did when I started using R (in 2000, way before the ltm package) was to fit item-characteristic curves to some test data using nls(), and these allowed both upper and lower bound to vary. I used a logit function rather than what you are using. The code is probably useless now - I didn't worry about many things and just wanted to get something crude and descriptive - but here are the main parts: logit <- function(x) {exp(x)/(1+exp(x))} astart <- c(.5,.8,.8,.8,.65,.8,.8,.5,.5,.5,.5, NA,NA,.5,.5,.5,.5,.5,.5,.5,.5,.5, .5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5) icc <- matrix(NA,nitems,4) # A,B,C,D coefficients # the loop is over the items for (i in 1:ns) { icc.tmp<-nls(score[,i]~pmin(1,pmax(0,C*logit((mscore-A)/B)+D)), start=list(A=astart[i],B=.1,C=.5,D=.5), control=nls.control(tol=.025) icc[i,] <- coef(icc.tmp)} # mscore is the mean score for each item -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.