Hi all, Where f(x) is a logistic function, I have data that follow: g(x) = f(x)*.5 + .5
How would you suggest I modify the standard glm(..., family='binomial') function to fit this? Here's an example of a clearly ill-advised attempt to simply use the standard glm(..., family='binomial') approach: ######## # First generate some data ######## #define the scale and location of the modified logistic to be fit location = 20 scale = 30 # choose some x values x = runif(200,-200,200) # generate some random noise to add to x in order to # simulate real-word measurement and avoid perfect fits x.noise = runif(length(x),-10,10) # define the probability of success for each x given the modified logistic prob.success = plogis(x+x.noise,location,scale)*.5 + .5 # obtain y, the observed success/failure at each x y = rep(NA,length(x)) for(i in 1:length(x)){ y[i] = sample( x = c(1,0) , size = 1 , prob = c(prob.success[i], 1-prob.success[i]) ) } #show the data and the source modified logistic plot(x,y) curve(plogis(x,location,scale)*.5 + .5,add=T) ######## # Now try to fit the data ######## #fit using standard glm and plot the result fit = glm(y~x,family='binomial') curve(plogis(fit$coefficients[1]+x*fit$coefficients[2])*.5+.5,add=T,col='red',lty=2) # It's clear that it's inappropriate to use the standard "glm(y~x,family='binomial')" # method to fit the modified logistic data, but what is the alternative? -- Mike Lawrence Graduate Student Department of Psychology Dalhousie University www.thatmike.com Looking to arrange a meeting? Check my public calendar and find a time that is mutually free: http://tinyurl.com/mikescalendar (tiny url redirects to google calendar) ~ Certainty is folly... I think. ~ [[alternative HTML version deleted]] ______________________________________________ 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.