Dear R-help, I have fitted a glm logistic function to dichotomous forced choices responses varying according to time interval between two stimulus. x values are time separation in miliseconds, and the y values are proportion responses for one of the stimulus. Now I am trying to extrapolate x values for the y value (proportion) at .25, .5, and .75. I have tried several predict parameters, and they don't appear to be working. Is this correct use and understanding of the predict function? It would be nice to know the parameters for the glm best fit, but all I really need are the extrapolated x values for those proportions. Thank you for your help. Here is the code:
x <- c(-283.9, -267.2, -250.5, -233.8, -217.1, -200.4, -183.7, -167, -150.3, -133.6, -116.9, -100.2, -83.5, -66.8, -50.1, -33.4, -16.7, 16.7, 33.4, 50.1, 66.8, 83.5, 100.2, 116.9, 133.6, 150.3, 167, 183.7, 200.4, 217.1, 233.8, 250.5, 267.2, 283.9) y <- c(0, 0.333333333333333, 0, 0, 0, 0, 0, 0, 0, 0.333333333333333, 0, 0.133333333333333, 0.238095238095238, 0.527777777777778, 0.566666666666667, 0.845238095238095, 0.55, 1, 0.888888888888889, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.5) weight <- c(1, 3, 2, 5, 4, 4, 3, 5, 5, 4, 5, 11, 22, 11, 15, 16, 11, 7, 14, 10, 16, 19, 11, 5, 4, 5, 6, 9, 4, 2, 5, 5, 2, 2) mylogit <- glm(y~x,weights=weight, family = binomial) # now I try plotting the predicted value, and it looks like a good fit, hopefully I can access what the glm is doing ypred <- predict(mylogit,newdata=as.data.frame(x),type="response") plot(x, ypred,type="l") points(x,y) # so I try to predict the x value when y (proportion) is at .5, but something is wrong.. predict(mylogit,newdata=as.data.frame(0.5)) [[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.