Abraham Mathew
2013-May-24 16:42 UTC
[R] Generating Predicted Probabilities in a Data Frame from a Logit Model
I'm trying to run a logit model in R which has only one predictor. I then want to construct a data frame with the predictor values on one column and the probabilities in another column. Using LDA methodology, I'm able to do the following. # RUN LDA r <- lda(y ~ x) ## FIND AND PLOT MODEL PROBABILITIES xx <- seq(min(x), max(x), length=1000) pred <- predict(r, data.frame(x=xx), type='response') yy <- pred$posterior[,2] t = data.frame(Our_Bid=c(xx), "Pr(win)"=c(yy)) head(t, 10)> head(t, 10)Our_Bid Pr.win. 1 0.000000 0.1525893 2 3.096096 0.1538502 3 6.192192 0.1551196 4 9.288288 0.1563976 5 12.384384 0.1576841 6 15.480480 0.1589792 7 18.576577 0.1602829 8 21.672673 0.1615952 9 24.768769 0.1629162 10 27.864865 0.1642459 I want to do something similar with glm but I'm not finding that I'm able to manipulate predict() such that I can get a similar output as ^^. mod1 = glm(posted ~ amount, data=ndat, family=binomial(link="probit")) summary(mod1) Can anyone help? Thanks! -- *Abraham Mathew Statistical Analyst **720-648-0108* *abmathewks@gmail.com * *Twitter <https://twitter.com/abmathewks> **LinkedIn<http://www.linkedin.com/pub/abraham-mathew/29/21b/212/> **Blog <https://mathewanalytics.wordpress.com/> **Tumblr<http://fitnessplusfashion.tumblr.com/> About.Me <http://about.me/abraham_mathew>* [[alternative HTML version deleted]]